博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux 创建Bridge
阅读量:5301 次
发布时间:2019-06-14

本文共 5512 字,大约阅读时间需要 18 分钟。

安装Bridge工具软件包

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

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

 

Linux KVM Bridge逻辑结构图

通过命令行创建Bridge

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

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

 

通过网络配置创建创建Bridge

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

Ubuntu Bridge配置示例

auto ens33 iface ens33 inet manual auto br0iface br0 inet static           address 192.168.1.2           network 192.168.1.0           netmask 255.255.255.0           broadcast 192.168.1.255           bridge_ports eth0           bridge_bridgeprio 32767           bridge_portprio eth0 129           bridge_fd 5

参数

IFACE OPTIONS       A   little  explanation  on  the  new  options  that  can  be  used  on       /etc/network/interfaces to setup the bridge, so you don't  have  to  go       and look at the scripts...       bridge_ports interface specification              this option must exist for the scripts to setup the bridge, with              it you specify the ports you want to add to your bridge,  either              using  "none" if you want a bridge without any interfaces or you              want to add them later using brctl, or a list of the  interfaces              you want to add separated by spaces, for example:              bridge_ports eth0 eth4              You  should  not  put any lines to configure the interfaces that              will be used by the bridge, as this will be setup  automatically              by the scripts when bringing the bridge up.              If you need to specify the interfaces more flexibly, you can use              the following syntax (most useful on a Xen dom0):              bridge_ports regex (eth|vif).*              This means to evaluate (as in  egrep(1))  the  expressions  that              follow  after  "regex"  until  either  the  end  or  a "noregex"              statement is reached.  The  regular  expressions  are  evaluated              against all local interfaces and those that match are added.              Specifying  "all"  is  short  for  "regex  eth.*  em.*  p[0-9].*              noregex" and will get all the ethX and  biosdevname-format  (emX              and pX) interfaces added to the bridge.              Carrying this to the extremes, the following is valid syntax:              bridge_ports all regex if.0 noregex ext0 regex vif.*              This will add all ethX interfaces, the ifX0 interfaces, the ext0              interface and all vifX interfaces.       bridge_ageing time              set ageing time, default is 300, can have a fractional part.       bridge_bridgeprio priority              set bridge priority, priority is between 0 and 65535, default is              32768,  affects  bridge  id,  lowest priority bridge will be the              root.       bridge_fd time              set bridge forward delay to time seconds,  default  is  15,  can              have a fractional part.       bridge_gcint time              set  garbage  collection interval to time seconds, default is 4,              can have a fractional part.  Available on Linux kernel  versions              < 2.6.0.       bridge_hello time              set  hello  time  to  time  seconds,  default  is  2, can have a              fractional part.       bridge_hw MAC address              set the Ethernet MAC address of the bridge to the specified one.              There  were some concerns of how this was done in the past, see:              http://bugs.debian.org/271406 but we are doing it on a  new  way              now that shouldn't be as bad, see: http://bugs.debian.org/725786              however you should know what you are  doing  before  using  this              option.       bridge_maxage time              set  max  message age to time seconds, default is 20, can have a              fractional part.       bridge_maxwait time              forces to time seconds the maximum time that the  Debian  bridge              setup  scripts  will  wait  for  the  bridge ports to get to the              forwarding status, doesn't allow factional part. If it is  equal              to 0 then no waiting is done.       bridge_pathcost port cost              set  path  cost  for a port, default is 100, port is the name of              the interface to which this setting applies.       bridge_portprio port priority              set port priority, default is 32, affects port id, port  is  the              name  of  the interface to which this setting applies.  On Linux              kernels older than 2.6.0 the max value is 255, the default  128.              Newer kernels have a maximum value of 63 and a default of 32.       bridge_stp state              turn  spanning  tree protocol on/off, state values are on or yes              to turn stp on and any other thing to set it  off,  default  has              changed  to  off  for security reasons in latest kernels, so you              should specify if you want stp on or off with this  option,  and              not rely on your kernel's default behaviour.       bridge_waitport time [ports]              wait for a max of time seconds for the specified ports to become              available, if no ports are specified  then  those  specified  on              bridge_ports  will be used here. Specifying no ports here should              not be used if we are using regex or "all" on  bridge_ports,  as              it wouldn't work.

 

转载于:https://www.cnblogs.com/vincenshen/p/8299365.html

你可能感兴趣的文章
ubuntu 安装后的配置
查看>>
web前端之路,js的一些好书(摘自聂微东 )
查看>>
【模板】对拍程序
查看>>
【转】redo与undo
查看>>
解决升级系统导致的 curl: (48) An unknown option was passed in to libcurl
查看>>
Java Session 介绍;
查看>>
spoj TBATTLE 质因数分解+二分
查看>>
Django 模型层
查看>>
dedecms讲解-arc.listview.class.php分析,列表页展示
查看>>
Extjs6 经典版 combo下拉框数据的使用及动态传参
查看>>
【NodeJS】http-server.cmd
查看>>
研磨JavaScript系列(五):奇妙的对象
查看>>
面试题2
查看>>
selenium+java iframe定位
查看>>
P2P综述
查看>>
第五章 如何使用Burp Target
查看>>
Sprint阶段测试评分总结
查看>>
sqlite3经常使用命令&amp;语法
查看>>
linux下编译openjdk8
查看>>
【python】--迭代器生成器装饰器
查看>>