Linux 创建Bridge

安装Bridge工具软件包

Linux可以工作在网桥模式,必须安装网桥工具bridge-utils,运行命令:

  yum install bridge-utils 或 apt-get install bridge-utils

Linux KVM Bridge逻辑结构图

通过命令行创建Bridge

注意:通过命令创建的Brdge在重启后会自动丢失,因此需要在网络配置文件中写入Brdge配置。

1# 创建brdge br0# brctl addbr br0# 将br0绑定到ens33 2# brctl addif br0 ens33

通过网络配置创建创建Bridge

CentOS系统:https://zhidao.baidu.com/question/1046233341920860299.html 

Ubuntu Bridge配置示例

1auto ens33iface ens33 inet manualauto br0 2iface br0 inet static 3 address 192.168.1.2 4 network 192.168.1.0 5 netmask 255.255.255.0 6 broadcast 192.168.1.255 7 bridge_ports eth0 8 bridge_bridgeprio 32767 9 bridge_portprio eth0 129 10 bridge_fd 5

参数

1IFACE OPTIONS 2 3 A little explanation on the new options that can be used on 4 /etc/network/interfaces to setup the bridge, so you don't have to go 5 and look at the scripts... 6 7 bridge_ports interface specification 8 this option must exist for the scripts to setup the bridge, with 9 it you specify the ports you want to add to your bridge, either 10 using "none" if you want a bridge without any interfaces or you 11 want to add them later using brctl, or a list of the interfaces 12 you want to add separated by spaces, for example: 13 bridge_ports eth0 eth4 14 You should not put any lines to configure the interfaces that 15 will be used by the bridge, as this will be setup automatically 16 by the scripts when bringing the bridge up. 17 18 If you need to specify the interfaces more flexibly, you can use 19 the following syntax (most useful on a Xen dom0): 20 bridge_ports regex (eth|vif).* 21 This means to evaluate (as in egrep(1)) the expressions that 22 follow after "regex" until either the end or a "noregex" 23 statement is reached. The regular expressions are evaluated 24 against all local interfaces and those that match are added. 25 26 Specifying "all" is short for "regex eth.* em.* p[0-9].* 27 noregex" and will get all the ethX and biosdevname-format (emX 28 and pX) interfaces added to the bridge. 29 30 Carrying this to the extremes, the following is valid syntax: 31 bridge_ports all regex if.0 noregex ext0 regex vif.* 32 This will add all ethX interfaces, the ifX0 interfaces, the ext0 33 interface and all vifX interfaces. 34 35 bridge_ageing time 36 set ageing time, default is 300, can have a fractional part. 37 38 bridge_bridgeprio priority 39 set bridge priority, priority is between 0 and 65535, default is 40 32768, affects bridge id, lowest priority bridge will be the 41 root. 42 43 bridge_fd time 44 set bridge forward delay to time seconds, default is 15, can 45 have a fractional part. 46 47 bridge_gcint time 48 set garbage collection interval to time seconds, default is 4, 49 can have a fractional part. Available on Linux kernel versions 50 < 2.6.0. 51 52 bridge_hello time 53 set hello time to time seconds, default is 2, can have a 54 fractional part. 55 56 bridge_hw MAC address 57 set the Ethernet MAC address of the bridge to the specified one. 58 There were some concerns of how this was done in the past, see: 59 http://bugs.debian.org/271406 but we are doing it on a new way 60 now that shouldn't be as bad, see: http://bugs.debian.org/725786 61 however you should know what you are doing before using this 62 option. 63 64 bridge_maxage time 65 set max message age to time seconds, default is 20, can have a 66 fractional part. 67 68 bridge_maxwait time 69 forces to time seconds the maximum time that the Debian bridge 70 setup scripts will wait for the bridge ports to get to the 71 forwarding status, doesn't allow factional part. If it is equal 72 to 0 then no waiting is done. 73 74 bridge_pathcost port cost 75 set path cost for a port, default is 100, port is the name of 76 the interface to which this setting applies. 77 78 bridge_portprio port priority 79 set port priority, default is 32, affects port id, port is the 80 name of the interface to which this setting applies. On Linux 81 kernels older than 2.6.0 the max value is 255, the default 128. 82 Newer kernels have a maximum value of 63 and a default of 32. 83 84 bridge_stp state 85 turn spanning tree protocol on/off, state values are on or yes 86 to turn stp on and any other thing to set it off, default has 87 changed to off for security reasons in latest kernels, so you 88 should specify if you want stp on or off with this option, and 89 not rely on your kernel's default behaviour. 90 91 bridge_waitport time [ports] 92 wait for a max of time seconds for the specified ports to become 93 available, if no ports are specified then those specified on 94 bridge_ports will be used here. Specifying no ports here should 95 not be used if we are using regex or "all" on bridge_ports, as 96 it wouldn't work.
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )