安装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
  2.  
  3. # 将br0绑定到ens33
  4. # brctl addif br0 ens33

通过网络配置创建创建Bridge

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

Ubuntu Bridge配置示例

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

参数

  1. IFACE 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.

Linux 创建Bridge的更多相关文章

  1. linux useradd(adduser)命令参数及用法详解(linux创建新用户命令)

    linux useradd(adduser)命令参数及用法详解(linux创建新用户命令) useradd可用来建立用户帐号.帐号建好之后,再用passwd设定帐号的密码.而可用userdel删除帐号 ...

  2. linux创建用户和用户组

    Linux创建用户.用户组 及 删除 在创建用户时,需要为新建用户指定一用户组,如果不指定其用户所属的工作组,自动会生成一个与用户名同名的工作组.创建用户user1的时候指定其所属工作组users,例 ...

  3. Linux创建修改删除用户和组

    Linux 创建修改删除用户和组 介绍 在日常的维护过程中创建用户操作用的相对会多一些,但是在这个过程中涉及到的知识点就不单单就是useradd了,接下来就来详细了解账号管理的相关信息. 用户信息 先 ...

  4. 一起来学习linux创建用户useradd命令

    linux创建用户useradd命令 原文地址:linux创建用户useradd命令 http://www.xfcodes.com/linuxcmd/user/24308.htm 一,adduser与 ...

  5. Linux 创建自定义命令

    Linux 创建自定义命令 Linux 可以创建自定义使用命令 这里我们采取使用“alias”命令.这里我们首先了解两个文件,通过这两个文件我们可以根据环境配置相应的自定义命令. 该文件内创建的自定义 ...

  6. linux创建定时任务,定时执行sql

    终于弄清楚一个问题了.linux创建定时任务,定时执行sql,其中分为两个case. case-1 sql语句较少,因此直接在 shell脚本中 写sql语句.如下: [oracle@Oracle11 ...

  7. Windows和Linux创建软链接和硬链接

    1.Wondows创建软链接和硬链接 mklink [/d] [/h] link target /d--创建目录软链接:默认为文件软链接:创建目录链接时必须使用该选项不然创出的软链接无效 /h--创建 ...

  8. linux 创建守护进程的相关知识

    linux 创建守护进程的相关知识 http://www.114390.com/article/46410.htm linux 创建守护进程的相关知识,这篇文章主要介绍了linux 创建守护进程的相关 ...

  9. [转帖] Linux 创建一个简单的私有CA、发证、吊销证书

    原创帖子地址:   https://blog.csdn.net/mr_rsq/article/details/71001810 Linux 创建一个简单的私有CA.发证.吊销证书 2017年04月30 ...

随机推荐

  1. Python Windows文件操作

    获得目录和文件名 os.getenv()获取环境变量 os.putenv()设置环境变量 os.getcwd() 获得当前目录 os.chdir(‘要设置的当前目录’) os.listdir() 返回 ...

  2. destroy其他所有activity

    Intent intent = new Intent(ActivityA.this, ActivityB.class);intent.setFlags(Intent.FLAG_ACTIVITY_NEW ...

  3. MFC错误集锦

    MFC中相关报错及其解决的方法: (1)0x00000005: 解决的方法:看是哪里的 数组越界: (2)0xCCCCCCCC:在类中声明指针,但没有赋初值之类的错误. 解决的方法:在类的构造函数中给 ...

  4. Linux Suse 查看wwn号码的方法

     查看wwn号码 cat /sys/class/fc_host/host*/port_name *代表全部host目录

  5. 大师养成计划之一:搭建springmvc框架

    搭建spring-mvc框架 搭建spring-mvc框架步骤: 1.搭建web项目spring-mvc1 2.引入jar包 3.配置web.xml 3.1拷贝头文件: <web-app xml ...

  6. File类的源码学习

    File类是Java中IO部分的一个类,用于表示文件或者目录的.关于File类有很多的常规操作这里就不介绍了,来看一下不常规的东西. File英文意思是文件,但是它也可以用来表示目录,文件的概念还是比 ...

  7. nginx 常见参数以及重定向参数配置

    nginx 各参数翻译,作用 $arg_PARAMETER #这个变量包含GET请求中,如果有变量PARAMETER时的值. $args #这个变量等于请求行中(GET请求)的参数,例如foo=123 ...

  8. Wireshark 与 Tcpdump

    [1]Wireshark 与 Tcpdump Wireshark是Windows下非常容易上手的抓包工具.但在Linux下很难找到一个好用的图形界面抓包工具.还好有Tcpdump.我们可以用Tcpdu ...

  9. HDOJ 4923 Room and Moor

    用一个栈维护b的值,每次把一个数放到栈顶. 看栈首的值是不是大于这个数,假设大于的话将栈顶2个元素合并.b的值就是这两个栈顶元素的平均值. .. Room and Moor Time Limit: 1 ...

  10. java 对象占用内存查看 以及JVM级别 方法修改等

    public interface Instrumentation 此类提供检测 Java 编程语言代码所需的服务.检测是向方法中添加字节码,以搜集各种工具所使用的数据.由于更改完全是进行添加,所以这些 ...