zoukankan      html  css  js  c++  java
  • Linux网桥配置

    CentOS:
    1、配置临时网桥,重启后风格配置丢失
    [root@CentOS ~]# yum -y install bridge-utils
    [root@CentOS ~]# brctl addbr br0   #创建网桥逻辑接口
    [root@CentOS ~]# brctl addif br0 eth0   #将eth0网卡添加到网桥中
    [root@CentOS ~]# brctl addif br0 eth1   #将eth1网卡添加到网桥中
    [root@CentOS ~]# brctl show    #查看网桥状态
    [root@CentOS ~]# ifconfig eth0 0.0.0.0   #将eth0网卡设为为混杂模式
    [root@CentOS ~]# ifconfig eth1 0.0.0.0   #将eth1网卡设为为混杂模式
    [root@CentOS ~]# ifconfig br0   #查看桥网卡配置
    [root@CentOS ~]# ifconfig br0 10.10.10.82/24   #给桥网卡设置IP地址

    2、创建永久网桥
    [root@CentOS ~]# vi /etc/sysconfig/network-scripts/ifcfg-br0   #创建网桥配置文件
    DEVICE=br0
    TYPE=Bridge
    BOOTPROTO=static
    IPADDR=10.47.8.17
    NETMASK=255.255.255.0
    GATEWAY=10.47.8.1
    DNS1=223.5.5.5
    DNS2=10.0.0.9
    ONBOOT=yes
    [root@CentOS ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 #将网卡加入到网桥中
    DEVICE=eth0
    TYPE=Ethernet
    ONBOOT=yes
    BOOTPROTO=static
    IPADDR=0.0.0.0
    BRIDGE=br0
    [root@CentOS ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1   #将网卡加入到网桥中
    DEVICE=eth1
    TYPE=Ethernet
    ONBOOT=yes
    BOOTPROTO=static
    IPADDR=0.0.0.0
    BRIDGE=br0

    Debian:
    1、配置临时网桥
    root@debian:~# apt-get install bridge-utils   #安装依赖包
    root@debian:~# brctl addbr br0     #创建网桥
    root@debian:~# ifconfig br0 up     #启用网桥
    root@debian:~# ip addr show      #查看网桥
    root@debian:~# brctl addif br0 eth0 eth1     #将网卡加入到网桥
    root@debian:~# brctl delif br0 eth1    #从网桥中删除eth1网卡
    root@debian:~# ifconfig br0 down    #关闭网桥
    root@debian:~# brctl delbr br0        #删除网桥

    2、创建永久网桥
    root@debian:~# nano /etc/network/interfaces
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    source /etc/network/interfaces.d/*
    # The loopback network interface
    # auto lo br0 两行写成一行
    auto lo
    auto br0
    iface lo inet loopback
    iface br0 inet static
    iface eth0 inet manual
    iface eth1 inet manual
    address 10.1.1.122
    broadcast 10.1.1.255
    netmask 255.255.255.0
    gateway 10.1.1.1
    bridge_ports eth0 eth1    #把eth0,eth1加入到网桥
    bridge_stp off                 # disable Spanning Tree Protocol
    bridge_waitport 0          # no delay before a port becomes available
    bridge_fd 0                   # no forwarding delay

  • 相关阅读:
    【Python】版本自动控制/在上一次版本中自动生成本次的版本号
    【Python】获取当前国内时间(适用于服务器部署在国外的)
    【Python】url编码/解码/转义
    mysql 优化详解
    shiro-redis整合
    springboot 整合redis ,jedis
    maven的pom配置详解
    SpringMVC集成LogBack,相关配置
    客户端连接caching-sha2-password 报错问题
    (转)navicat premium 12 破解版,注册机激活
  • 原文地址:https://www.cnblogs.com/xwupiaomiao/p/8744860.html
Copyright © 2011-2022 走看看