1、brctl命令安装
yum -y install bridge-utils
2、临时配置步骤
临时配置机器重启后配置失效。多网口配置网桥需开启转发。
临时转发生效:
echo “1” > /proc/sys/net/ipv4/ip_forward
永久配置:
将文件/etc/sysctl.conf里面的net.ipv4.ip_forward=1的注释去除
sysctl -p (重新加载)
(1)查看系统是否存在网桥配置
brctl show
(2)添加一个新的逻辑网桥接口br0
brctl addbr br0
(3)将eth1加入逻辑网桥br0
brctl addif br0 eth1/eth2
(4)网口配置混杂模式
ifconfig eth1/eth2 down
ifconfig eth1/eth2 0.0.0.0 up
或者ifconfig eth0 promisc / -promisc
(5)配置网桥地址并启动
ifconfig br0 172.168.0.1 up
注:
网卡工作模式:
A、广播方式:该模式下,网卡能够接收网络中的广播信息。
B、组播方式:该模式下,网卡能够接收组播数据。
C、直接方式:该模式下,只有目的网卡才能接收该数据。
D、混杂模式:该模式下,网卡能够接收一切通过它的数据。
3、永久配置
(1)修改eth1/et2网卡配置
vim /etc/sysconfig/network-scripts/ifcfg-eth1/eth2<