zoukankan      html  css  js  c++  java
  • 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
    
  • 相关阅读:
    Neo4j图形数据库备份
    Linux中Tomcat 自动设置CATALINA_HOME方法
    VNC viewer 无法打开oracle 11g图形界面方案
    CYPHER 语句(Neo4j)
    Tomcat部署时war和war exploded区别
    java中不能使用小数点(.)来作为分隔符
    做一个完整的Java Web项目需要掌握的技能
    从零讲Java,给你一条清晰地学习道路!该学什么就学什么!
    MYSQL数据库表排序规则不一致导致联表查询,索引不起作用问题
    chrome浏览器的跨域设置——包括版本49前后两种设置
  • 原文地址:https://www.cnblogs.com/itwangqiang/p/14620854.html
Copyright © 2011-2022 走看看