目录
环境说明
操作系统:RHEL 6.4
虚拟机:VMware 12.5
网络:
eth0 仅主机模式 192.168.6.121/24
eth1 仅主机模式 192.168.6.122/24
eth2 NAT模式 192.168.7.121/24
目标说明
eth0 eth1 组成bond0 192.168.6.121/24 ,2个网卡随意拔掉网线,不影响访问
查看网卡
[root@enmoedu1 ~]# cd /etc/udev/rules.d/
[root@enmoedu1 rules.d]# vi 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 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:bc:15:79", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:bc:15:83", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:bc:15:8d", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
网卡配置
[root@enmoedu1 rules.d]# cd /etc/sysconfig/network-scripts/
[root@enmoedu1 network-scripts]# vi ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
[root@enmoedu1 rules.d]# cd /etc/sysconfig/network-scripts/
[root@enmoedu1 network-scripts]# vi ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
[root@enmoedu1 network-scripts]# vi ifcfg-bond0
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.6.121
PREFIX=24
GATEWAY=192.168.6.1
DNS1=202.101.172.35
NM_CONTROLLED=no
绑定驱动
[root@enmoedu1 network-scripts]# vi /etc/modprobe.d/bond.conf
alias bond0 bonding
options bond0 miimon=100 mode=6
重启网络
[root@enmoedu1 network-scripts]# service network restart
Shutting down interface bond0: [ OK ]
Shutting down interface eth2: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface bond0: Determining if ip address 192.168.6.121 is already in use for device bond0...
[ OK ]
Bringing up interface eth2: Determining if ip address 192.168.7.121 is already in use for device eth2...
[ OK ]
[root@enmoedu1 network-scripts]# ifconfig
bond0 Link encap:Ethernet HWaddr 00:0C:29:BC:15:79
inet addr:192.168.6.121 Bcast:192.168.6.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:febc:1579/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:1377 errors:0 dropped:0 overruns:0 frame:0
TX packets:1204 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:131256 (128.1 KiB) TX bytes:143264 (139.9 KiB)
eth0 Link encap:Ethernet HWaddr 00:0C:29:BC:15:79
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:127 errors:0 dropped:0 overruns:0 frame:0
TX packets:958 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10512 (10.2 KiB) TX bytes:125056 (122.1 KiB)
eth1 Link encap:Ethernet HWaddr 00:0C:29:BC:15:83
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:1251 errors:0 dropped:0 overruns:0 frame:0
TX packets:247 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:120818 (117.9 KiB) TX bytes:18274 (17.8 KiB)
eth2 Link encap:Ethernet HWaddr 00:0C:29:BC:15:8D
inet addr:192.168.7.121 Bcast:192.168.7.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:febc:158d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:716 errors:0 dropped:0 overruns:0 frame:0
TX packets:742 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:52382 (51.1 KiB) TX bytes:54258 (52.9 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:240 (240.0 b) TX bytes:240 (240.0 b)
[root@enmoedu1 network-scripts]#
1174

被折叠的 条评论
为什么被折叠?



