Friday, November 11, 2011

Redhat: interface bonding

[root@server4 network-scripts]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:25:B3:24:ED:FA
          inet addr:10.2.16.21  Bcast:10.2.16.255  Mask:255.255.255.0
          inet6 addr: fe80::225:b3ff:fe24:edfa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:165251 errors:0 dropped:0 overruns:0 frame:0
          TX packets:193 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:24513496 (23.3 MiB)  TX bytes:20693 (20.2 KiB)
          Interrupt:169 Memory:f4000000-f4012100

eth1      Link encap:Ethernet  HWaddr 00:25:B3:24:ED:FC
          inet addr:153.88.118.21  Bcast:153.88.118.255  Mask:255.255.255.0
          inet6 addr: fe80::225:b3ff:fe24:edfc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13882 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9844 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2492055 (2.3 MiB)  TX bytes:4312653 (4.1 MiB)
          Interrupt:154 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:377514 errors:0 dropped:0 overruns:0 frame:0
          TX packets:377514 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:38182383 (36.4 MiB)  TX bytes:38182383 (36.4 MiB)

[root@server4 network-scripts]#
root@server4 network-scripts]# more ifcfg-eth2
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
DEVICE=eth2
HWADDR=00:25:B3:24:ED:FE
ONBOOT=no
BOOTPROTO=dhcp
TYPE=Ethernet
[root@server4 network-scripts]# more ifcfg-eth1
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
HWADDR=00:25:B3:24:ED:FC
DEVICE=eth1
BOOTPROTO=none
BROADCAST=153.88.118.255
IPADDR=153.88.118.21
NETMASK=255.255.255.0
NETWORK=153.88.118.0
ONBOOT=yes
TYPE=Ethernet
GATEWAY=153.88.118.1
[root@server4 network-scripts]# more ifcfg-eth2
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
DEVICE=eth2
HWADDR=00:25:B3:24:ED:FE
ONBOOT=no
BOOTPROTO=dhcp
TYPE=Ethernet
[root@server4 network-scripts]#


[root@server8 network-scripts]# more ifcfg-eth1
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
HWADDR=00:24:81:E2:82:DC
DEVICE=eth1
BOOTPROTO=none
BROADCAST=153.88.118.255
IPADDR=153.88.118.22
NETMASK=255.255.255.0
NETWORK=153.88.118.0
ONBOOT=yes
TYPE=Ethernet
GATEWAY=153.88.118.1
[root@server8 network-scripts]# more ifcfg-eth2
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
DEVICE=eth2
HWADDR=00:24:81:E2:82:DE
ONBOOT=no
BOOTPROTO=dhcp
TYPE=Ethernet
[root@server8 network-scripts]#
-----------------------------------------------------------------

Please refer below


[root@server4 network-scripts]# cat ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=153.88.118.21
GATEWAY=153.88.118.1
USERCTL=no
BONDING_OPTS="mode=1 miimon=100"
[root@server4 network-scripts]# cat ifcfg-eth1
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
DEVICE=eth1
HWADDR=00:25:B3:24:ED:FC
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
[root@server4 network-scripts]# cat ifcfg-eth2
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
DEVICE=eth2
HWADDR=00:25:B3:24:ED:FE
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
[root@server4 network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@server4 network-scripts]#


[root@server4 network-scripts]# vi /etc/modprobe.conf
[root@server4 network-scripts]# more /etc/modprobe.conf
alias eth0 bnx2
alias eth1 bnx2
alias eth2 bnx2
alias eth3 bnx2
alias scsi_hostadapter cciss
alias scsi_hostadapter1 ata_piix
alias scsi_hostadapter2 qla2xxx
alias bond0 bonding
options bonding max_bonds=2
[root@server4 network-scripts]# modprobe bonding

.... network will be temporarily unavailable, try login via backup ipaddress or via other session **

[root@server4 network-scripts]#

[root@server4 ~]# service network restart                            //This can be done online
Shutting down interface bond0:                             [  OK  ]
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface bond0:                               [  OK  ]
Bringing up interface eth0:                                [  OK  ]
[root@server4 ~]#

[root@server4 ~]# ifconfig
bond0     Link encap:Ethernet  HWaddr 00:25:B3:24:ED:FC
          inet addr:153.88.118.21  Bcast:153.88.118.255  Mask:255.255.255.0
          inet6 addr: fe80::225:b3ff:fe24:edfc/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4167 (4.0 KiB)  TX bytes:6747 (6.5 KiB)

eth0      Link encap:Ethernet  HWaddr 00:25:B3:24:ED:FA
          inet addr:10.2.16.21  Bcast:10.2.16.255  Mask:255.255.255.0
          inet6 addr: fe80::225:b3ff:fe24:edfa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:27 errors:0 dropped:0 overruns:0 frame:0
          TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2431 (2.3 KiB)  TX bytes:12330 (12.0 KiB)
          Interrupt:169 Memory:f4000000-f4012100

eth1      Link encap:Ethernet  HWaddr 00:25:B3:24:ED:FC
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3316 (3.2 KiB)  TX bytes:6747 (6.5 KiB)
          Interrupt:154 Memory:f2000000-f2012100

eth2      Link encap:Ethernet  HWaddr 00:25:B3:24:ED:FC
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:5 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:851 (851.0 b)  TX bytes:0 (0.0 b)
          Interrupt:178 Memory:f8000000-f8012100

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:379765 errors:0 dropped:0 overruns:0 frame:0
          TX packets:379765 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:38407728 (36.6 MiB)  TX bytes:38407728 (36.6 MiB)

[root@server4 ~]#
[root@server4 ~]# less /proc/net/bonding/bond0




Ethernet Channel Bonding Driver: v3.2.4 (January 28, 2008)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:25:b3:24:ed:fc

Slave Interface: eth2
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:25:b3:24:ed:fe