• Ubuntu 16.04 Bridge配置


    Ubuntu 16.04 Bridge配置

    一、安装网桥拓展包 bridge-utils

    root@ubuntu:~# apt-get install bridge-utils
    

    二、创建网桥设备

      //安装网桥拓展包会安装 brctl 命令,使用该命令创建网桥设备
    root@ubuntu:~# brctl addbr br1       # br1是网桥设备名,类似网卡名称;也可以创建多个网桥设备
    
    
      //可以在 /proc/sys/net/ipv4/conf/ 目录下查看创建的和已经存在的网卡设备文件
    root@ubuntu:~# ls /proc/sys/net/ipv4/conf/
    all  br0  default  eth0  eth1  eth2  eth3  eth4  lo        # br0 就是刚刚创建的网桥名称
    

    三、配置 bridge-utils

    root@ubuntu:~# vim /etc/network/interfaces
    # network interface settings; autogenerated
    # Please do NOT modify this file directly, unless you know what
    # you're doing.
    #
    # If you want to manage parts of the network configuration manually,
    # please utilize the 'source' or 'source-directory' directives to do
    # so.
    # PVE will preserve these directives, but will NOT read its network
    # configuration from sourced files, so do not attempt to move any of
    # the PVE managed interfaces into external files!
    
    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet manual
    
    auto eth1
    iface eth1 inet manual
    
    auto eth2
    iface wth2 inet manual
    
    auto eth3
    iface eth3 inet manual
    
    auto br0
    iface br0 inet static
    	address 192.168.121.24
            netmask 255.255.255.0
    	gateway 211.91.165.129
    	bridge_ports eth0
    	bridge_stp off
    	bridge_fd 0    
    
    auto br1
    iface br1 inet manual
    	bridge_ports eth1
    	bridge_stp off
    	bridge_fd 0
    
    auto br2
    iface br2 inet manual
    	bridge_ports eth2
    	bridge_stp off
    	bridge_fd 0
    
    auto br3
    iface br3 inet manual
    	bridge_ports eth3
    	bridge_stp off
    	bridge_fd 0
    
    • 也可以配置动态(dhcp)
    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet manual
    
    auto eth1
    iface eth1 inet manual
    
    auto eth2
    iface wth2 inet manual
    
    auto eth3
    iface eth3 inet manual
    
    auto br0
    iface br0 inet dhcp
            bridge_ports eth0
            bridge_ports eth1
            bridge_ports eth2
            bridge_ports eth3
            bridge_stp off
            bridge_fd  0
    

    四、开启路由转发

      //网桥设置好后,需要设置路由转发功能
    root@ubuntu:~#  /etc/sysctl.conf
    ......
    net.ipv4.ip_forward=1        # 添加或者去掉注释这一行
    ......
    
       //让转发路由生效
    root@ubuntu:~# sysctl -p
    

    五、重启网络服务

    root@ubuntu:~#  systemctl restart networking.service
    
  • 相关阅读:
    更好一点的:Vue 利用指令实现禁止反复发送请求
    实现一个深度比较
    Zrender:实现波浪纹效果
    Echarts:实现拖拽效果
    找到树中指定id的所有父节点
    Vue 利用指令实现禁止反复发送请求
    我对组件化的一点细琐的想法
    转盘式旋转抽奖
    信息系统与信息化
    跳出牢笼,逃出生天
  • 原文地址:https://www.cnblogs.com/itwangqiang/p/14620854.html
Copyright © 2020-2023  润新知