2011年(15)
分类: LINUX
2011-06-07 08:47:29
1、cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-bond0
vi /etc/sysconfig/network-scripts/ifcfg-bond0
cat /etc/sysconfig/network-scripts/ifcfg-bond0
2、vi /etc/sysconfig/network-scripts/ifcfg-eth0
cat /etc/sysconfig/network-scripts/ifcfg-eth0
3、vi /etc/sysconfig/network-scripts/ifcfg-eth1
cat /etc/sysconfig/network-scripts/ifcfg-eth1
4、vi /etc/modprobe.conf
cat /etc/modprobe.conf
5、Service network Start
Ifconfig
[root@CS-1 etc]# cat modprobe.conf
alias eth0 bnx2
alias eth1 bnx2
alias eth2 bnx2
alias eth3 bnx2
alias scsi_hostadapter cciss
alias scsi_hostadapter1 ata_piix
alias usb-controller uhci-hcd
alias usb-controller1 ehci-hcd
alias bond0 bonding
options bond0 miimon=100 mode=1
options bfa host_name="CS-1" os_name="Red Hat Enterprise Linux AS release 4 (Nahant Update 8)"
###BEGINPP
include /etc/modprobe.conf.pp
###ENDPP
[root@CS-1 etc]#
[root@CS-1 etc]# cd /etc/sysconfig/network-scripts/
[root@CS-1 network-scripts]# ls
ifcfg-bond0 ifcfg-eth3 ifdown-ippp ifdown-post ifup ifup-ipsec ifup-plip ifup-routes init.ipv6-global
ifcfg-eth0 ifcfg-lo ifdown-ipsec ifdown-ppp ifup-aliases ifup-ipv6 ifup-plusb ifup-sit network-functions
ifcfg-eth1 ifdown ifdown-ipv6 ifdown-sit ifup-ib ifup-ipx ifup-post ifup-sl network-functions-ipv6
ifcfg-eth2 ifdown-aliases ifdown-isdn ifdown-sl ifup-ippp ifup-isdn ifup-ppp ifup-wireless
[root@CS-1 network-scripts]# cat ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
[root@CS-1 network-scripts]# cat ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
[root@CS-1 network-scripts]# cat ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.10.33
NETMASK=255.255.255.0
GATEWAY=192.168.10.254
TYPE=Ethernet
[root@CS-1 network-scripts]# ifconfig
bond0 Link encap:Ethernet HWaddr D8:D3:85:A4:BD:74
inet addr:192.168.10.33 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:468 errors:0 dropped:0 overruns:0 frame:0
TX packets:321 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:40914 (39.9 KiB) TX bytes:35090 (34.2 KiB)
eth0 Link encap:Ethernet HWaddr D8:D3:85:A4:BD:74
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:467 errors:0 dropped:0 overruns:0 frame:0
TX packets:321 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:40850 (39.8 KiB) TX bytes:35090 (34.2 KiB)
Interrupt:169 Memory:f4000000-f4012100
eth1 Link encap:Ethernet HWaddr D8:D3:85:A4:BD:74
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:1 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:64 (64.0 b) TX bytes:0 (0.0 b)
Interrupt:201 Memory:f2000000-f2012100
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:16436 Metric:1
RX packets:2370 errors:0 dropped:0 overruns:0 frame:0
TX packets:2370 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3113044 (2.9 MiB) TX bytes:3113044 (2.9 MiB)
[root@CS-1 network-scripts]# ping 192.168.10.254
PING 192.168.10.254 (192.168.10.254) 56(84) bytes of data.
64 bytes from 192.168.10.254: icmp_seq=0 ttl=255 time=0.396 ms
64 bytes from 192.168.10.254: icmp_seq=1 ttl=255 time=0.220 ms
64 bytes from 192.168.10.254: icmp_seq=2 ttl=255 time=0.383 ms
--- 192.168.10.254 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.220/0.333/0.396/0.080 ms, pipe 2
[root@CS-1 network-scripts]# ping
PING (203.208.37.104) 56(84) bytes of data.
64 bytes from bg-in-f104.1e100.net (203.208.37.104): icmp_seq=0 ttl=247 time=39.2 ms
64 bytes from bg-in-f104.1e100.net (203.208.37.104): icmp_seq=1 ttl=247 time=39.2 ms
64 bytes from bg-in-f104.1e100.net (203.208.37.104): icmp_seq=2 ttl=247 time=39.2 ms
64 bytes from bg-in-f104.1e100.net (203.208.37.104): icmp_seq=3 ttl=247 time=39.1 ms
64 bytes from bg-in-f104.1e100.net (203.208.37.104): icmp_seq=4 ttl=247 time=39.2 ms
--- ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4004ms
rtt min/avg/max/mdev = 39.169/39.220/39.295/0.220 ms, pipe 2
[root@CS-1 network-scripts]# cd /etc/rc.d/rc.local
-bash: cd: /etc/rc.d/rc.local: Not a directory
[root@CS-1 network-scripts]# cat /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
ifenslave bind0 eth0 eth1
route add -net 192.168.10.254 netmask 255.255.255.0 bond0