Steps to set up bridge
Target: set up a bridge on the interface which connect to internet. Then we can attach other devices to the bridge to connect to internet.
1. Find out which interface connected to internet
ifconfig |grep 10.2
It will show the interface information, you can get the interface connected to internet, such as "enp6s0f0"
2. Add ifcfg-br0 file
cd /etc/sysconfig/network-scripts
vim ifcfg-br0
Edit the file as below
TYPE=Bridge
DEVICE=br0
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=dhcp
HOSTNAME="pengyuan.sh.intel.com"
Note: The hostname is your server's name. You can use the command 'hostname' to check it
3. Edit ifcfg-enp6s0f0 file
DEVICE=enp6s0f0
ONBOOT=yes
NM_CONTROLLED="no"
BRIDGE=br0
4. Update interface and bridge
ifup enp6s0f0
ifup br0
Then you may lost the ssh session, so go to lab to operate the machine.
./ifup-eth br0
Expected result: Determination of IP br0, then there is a dhclient process show that the hostname of br0
ps –aux|grep dhclient
5. Check brctl, see bridge connect to interface.
brctl show
Reboot the machine(but still find the issue that br0 not up, no IP connection)
6. Start the network
/etc/init.d/rc.d/init.d/ ./network start
chkconfig –list
chkconfig –level 2345 network on
chkconfig –list
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service
killall dhclient
service restart network
killall dhclient
service restart network