CentOS 7网卡网桥绑定设置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7网卡网桥绑定设置相关的知识,希望对你有一定的参考价值。

一、网卡桥接设置:


1、网卡配置文件:

[[email protected] /]# vim /etc/sysconfig/network-scripts/ifcfg-enp8s0 
TYPE=Ethernet
DEVICE=enp8s0
NAME=enp8s0
BOOTPROTO=none
ONBOOT=yes
BRIDGE=br0


 2、网桥配置文件:

[[email protected] /]# vim /etc/sysconfig/network-scripts/ifcfg-br0
TYPE=Bridge
DEVICE=br0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.200
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=114.114.114.114

 


二、网卡绑定设置:


1、网卡配置文件01:

[[email protected] /]# vim /etc/sysconfig/network-scripts/ifcfg-enp6s0f0
TYPE=Ethernet
DEVICE=enp6s0f0
NAME=enp6s0f0
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes


2、网卡配置文件02:

[[email protected] /]# vim /etc/sysconfig/network-scripts/ifcfg-enp6s0f1
TYPE=Ethernet
DEVICE=enp6s0f1
NAME=enp6s0f1
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes


3、网桥配置文件:

[[email protected] /]# vim /etc/sysconfig/network-scripts/ifcfg-bond0
TYPE=Ethernet
DEVICE=bond0
BOOTPROTO=static
ONBOOT=yes
USERCTL=no
IPADDR=172.16.1.216
NETMASK=255.255.255.0
GATEWAY=172.16.1.1
DNS1=114.114.114.114

 


-----------------------------------------

1、设置网卡
vi /etc/sysconfig/network-scripts/ifcfg-br0
 DEVICE=br0
 TYPE=Bridge
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.1.2
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
IPV6INIT=no
USERCTL=no

vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=BC:30:5B:CB:25:5F
TYPE=Ethernet
UUID=e513c376-2c85-45a7-92ba-d14ca2225e69
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=no
#IPADDR=192.168.1.115
#NETMASK=255.255.255.0
#GATEWAY=192.168.1.1
#DNS1=192.168.1.250
#DNS2=192.168.1.251
#IPV6INIT=no
USERCTL=no
BRIDGE=br0
2、关闭 NetworkManager
chkconfig NetworkManager off
service NetworkManager stop
3、重启网络
service network restart

命令:brctl
brctl --help
Usage: brctl [commands]
commands:
    addbr                 add bridge
    delbr                 delete bridge
    addif             add interface to bridge
    delif             delete interface from bridge
    setageing             set ageing time
    setbridgeprio            set bridge priority
    setfd                 set bridge forward delay
    sethello              set hello time
    setmaxage             set max message age
    sethashel             set hash elasticity
    sethashmax            set hash max
    setmclmc              set multicast last member count
    setmcrouter            set multicast router
    setmcsnoop            set multicast snooping
    setmcsqc              set multicast startup query count
    setmclmi              set multicast last member interval
    setmcmi               set multicast membership interval
    setmcqpi              set multicast querier interval
    setmcqi               set multicast query interval
    setmcqri              set multicast query response interval
    setmcqri              set multicast startup query interval
    setpathcost        set path cost
    setportprio        set port priority
    setportmcrouter        set port multicast router
    show          [ ]        show a list of bridges
    showmacs              show a list of mac addrs
    showstp               show bridge stp info
    stp           {on|off}    turn stp on/off
常用:
1.创建网桥设备:brctl addbr ,eg:brctl addbr  br0
2.向网桥设备添加物理网卡:brctl addif ,eg:brctl  addif  br0 eth0
3.从网桥中删除网卡:brctl delif ,eg:brctl  delif  br0 eth0
4.删除网桥:brctl delbr ,eg:brctl delbr br0
5.查看网桥配置情况:brctl show






以上是关于CentOS 7网卡网桥绑定设置的主要内容,如果未能解决你的问题,请参考以下文章

centos7 网桥桥接网卡绑定终极实战

Centos网络管理-Bonding网络组和网桥

43多网卡bonding及网桥

Centos7 / RHEL 7 双网卡绑定

CentOS 7.6网卡绑定mode1

bond网卡绑定(centos6.5 + centos 7)