CentOS 7网卡网桥设置

前端之家收集整理的这篇文章主要介绍了CentOS 7网卡网桥设置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


centos下设置网桥

1、设置网卡

vi/etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=10.0.0.10
NETMASK=255.255.255.0
GATEWAY=10.0.0.254
DNS1=8.8.8.8
IPV6INIT=no
USERCTL=no
vi/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=BC:30:5B:CB:30:3F
TYPE=Ethernet
UUID=e513c376-2c85-45a7-92ba-d14ca2225e69
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=no
#IPADDR=10.0.0.10
#NETMASK=255.255.255.0
#GATEWAY=10.0.0.254
#DNS1=192.168.1.250
#DNS2=192.168.1.251
#IPV6INIT=no
USERCTL=no
BRIDGE=br0

此步也可以这样设置网桥br0:

  1. #brctladdbrbr0

  2. #ipaddradd10.0.0.10/24devbr0

  3. #iplinksetdevbr0up

2、关闭 NetworkManager

chkconfigNetworkManageroff
serviceNetworkManagerstop


3、重启网络

servicenetworkrestart


4、查看网桥

[root@localhost~]#brctlshow
bridgenamebridgeidSTPenabledinterfaces
br08000.0050562539b9noens33




命令:brctlbrctl --helpUsage: brctl [commands]commands:addbradd bridgedelbrdelete bridgeaddifadd interface to bridgedelifdelete interface from bridgesetageingset ageing timesetbridgeprioset bridge prioritysetfdset bridge forward delaysethelloset hello timesetmaxageset max message agesethashelset hash elasticitysethashmaxset hash maxsetmclmcset multicast last member countsetmcrouterset multicast routersetmcsnoopset multicast snoopingsetmcsqcset multicast startup query countsetmclmiset multicast last member intervalsetmcmiset multicast membership intervalsetmcqpiset multicast querier intervalsetmcqiset multicast query intervalsetmcqriset multicast query response intervalsetmcqriset multicast startup query intervalsetpathcostset path costsetportprioset port prioritysetportmcrouterset port multicast routershow[ ]show a list of bridgesshowmacsshow a list of mac addRSShowstpshow bridge stp infostp{on|off}turn stp on/off常用:1.创建网桥设备:brctl addbr ,eg:brctl addbrbr02.向网桥设备添加物理网卡:brctl addif ,eg:brctladdifbr0 eth03.从网桥中删除网卡:brctl delif ,eg:brctldelifbr0 eth04.删除网桥:brctl delbr ,eg:brctl delbr br05.查看网桥配置情况:brctl show

猜你在找的CentOS相关文章