1. Disable Network Manager
# chkconfig NetworkManager off # service NetworkManager stop
2. Create a virtual network card for bridging
# cd /etc/sysconfig/network-scripts # cp ifcfg-eth0 ifcfg-br0
3. Edit ifcfg-br0
# vi ifcfg-br0 DEVICE="br0" TYPE="Bridge" ONBOOT="yes" BOOTPROTO=static IPADDR=192.168.1.17 PREFIX=24 GATEWAY=192.168.1.1 DNS1=202.106.46.151
DNS2=202.106.0.20 DELAY=0
Note: It is best to switch to the root account to operate, otherwise you may be prompted when saving: E45: 'readonly' option is set (add ! to override)
4. Edit ifcfg-eth0
# vi ifcfg-eth0 DEVICE="eth0" NM_CONTROLLED="yes" ONBOOT=yes TYPE=Ethernet BRIDGE="br0" BOOTPROTO=none IPADDR=192.168.1.17 PREFIX=24 GATEWAY=192.168.1.1 DEFROUTE = yes IPV4_FAILURE_FATAL=yes IPV6INIT=no NAME="System eth0" UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 DNS1=202.106.46.151
DNS2=202.106.0.20
HWADDR=00:1E:67:07:EC:30
IPADDR: The IP address of the same network segment as your
computer GATEWAY: The same as the default gateway of your computer
5. Restart the network
# service network restart
6. The following errors may be prompted :
Bringing up interface eth0: Device eth0 does not seem to be present,delaying initialization. [FAILED]
Solution:
First, open /etc/udev/rules.d/70-persistent-net.rules content as shown in the following example:
# vi /etc/udev/rules.d/70-persistent-net.rules # This file was automatically generated by the /lib/udev/write_net_rules # program, run by the persistent-net-generator.rules rules file. # # You can modify it, as long as you keep each rule on a single # line, and change only the value of the NAME= key. # PCI device 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:8f:89:9 7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" # PCI device 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:50:bd:1 7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
Record, the mac address of the eth1 network card 00:0c:29:50:bd:17
Next, open /etc/sysconfig/network-scripts/ifcfg-eth0
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Change DEVICE="eth0" to DEVICE="eth1" and
change HWADDR="00:0c:29:8f:89:97" to the above mac address HWADDR="00:0c:29:50:bd:17 "
Finally, restart the network
# service network restart
or
# /etc/init.d/network restart
Normal.