Dual-nic load balancing in Linux

Source: Internet
Author: User
Implement dual-nic load balancing in Linux-Linux Enterprise Application-Linux server application information. The following is a detailed description. System Environment: RHEL5
Hardware environment: IBM X3650

1. Create a virtual network interface ifcfg-bond0 File
[Root @ yangwenjun ~] # Cd/etc/sysconfig/network-scripts/
[Root @ yangwenjun network-scripts] # cp ifcfg-eth0 ifcfg-bond0
The content is:
[Root @ yangwenjun network-scripts] # ifcfg-bond0 more
# Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet
DEVICE = bond0
BROADCAST = 192.168.1.255
IPADDR = 192.168.1.3
NETMASK = 255.255.255.0
NETWORK = 192.168.1.0
Mtu= 1500
GATEWAY = 192.168.1.1
[Root @ yangwenjun network-scripts] #

Ii. Edit the eth0 and eth information files of the original Nic
Make the content as follows:
[Root @ yangwenjun network-scripts] # ifcfg-eth0 more
# Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet
DEVICE = eth0
BOOTPROTO = none
ONBOOT = yes
TYPE = Ethernet
MASTER = bond0
Slave = yes
[Root @ yangwenjun network-scripts] # ifcfg-eth1 more
# Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet
DEVICE = eth1
BOOTPROTO = none
ONBOOT = yes
TYPE = Ethernet
MASTER = bond0
Slave = yes
[Root @ yangwenjun network-scripts] #

3. edit/etc/modprobe. conf and add the following two lines.
[Root @ yangwenjun network-scripts] # vi/etc/modprobe. conf
Alias bond0 bonding
Options bond0 miimon = 100 mode = 1
My modprobe. conf content is as follows:
[Root @ yangwenjun network-scripts] # more/etc/modprobe. conf
Alias eth0 bnx2
Alias eth1 bnx2
Alias scsi_hostadapter aacraid
Alias scsi_hostadapter1 ata_piix
Alias peth0 bnx2
Alias bond0 bonding
Options bond0 miimon = 100 mode = 1

4. Edit the/etc/rc. d/rc. local file and add
Ifenslave bond0 eth0 eth1

After the Server Load balancer instance is restarted, it can work normally. You can use ifconfig to view the specific information.
[Root @ yangwenjun network-scripts] # ifconfig
Bond0 Link encap: Ethernet HWaddr 00: 1A: 64: 6A: 55: 98
Inet addr: 192.168.1.3 Bcast: 192.168.1.255 Mask: 255.255.255.0
Inet6 addr: fe80: 21a: 64ff: fe6a: 5598/64 Scope: Link
Up broadcast running master multicast mtu: 1500 Metric: 1
RX packets: 985369 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 804306 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 148943796 (142.0 MiB) TX bytes: 2097755332 (1.9 GiB)

Eth0 Link encap: Ethernet HWaddr 00: 1A: 64: 6A: 55: 98
Inet6 addr: fe80: 21a: 64ff: fe6a: 5598/64 Scope: Link
Up broadcast running slave multicast mtu: 1500 Metric: 1
RX packets: 984133 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 804292 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 148805154 (141.9 MiB) TX bytes: 2097751381 (1.9 GiB)

Eth1 Link encap: Ethernet HWaddr 00: 1A: 64: 6A: 55: 98
Inet6 addr: fe80: 21a: 64ff: fe6a: 5598/64 Scope: Link
Up broadcast running slave multicast mtu: 1500 Metric: 1
RX packets: 1236 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 16 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX bytes: 138642 (135.3 KiB) TX bytes: 4275 (4.1 KiB)
Interrupt: 16 Memory: ca000000-ca011100

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: 24 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 24 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 1680 (1.6 KiB) TX bytes: 1680 (1.6 KiB)

Peth0 Link encap: Ethernet HWaddr FE: FF
Inet6 addr: fe80: fcff: ffff: feff: ffff/64 Scope: Link
Up broadcast running noarp mtu: 1500 Metric: 1
RX packets: 984026 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 1657683 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX bytes: 152730203 (145.6 MiB) TX bytes: 2150908601 (2.0 GiB)
Interrupt: 21 Memory: ce000000-ce011100

Vif0.0 Link encap: Ethernet HWaddr FE: FF
Inet6 addr: fe80: fcff: ffff: feff: ffff/64 Scope: Link
Up broadcast running noarp mtu: 1500 Metric: 1
RX packets: 804296 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 984134 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 2097747314 (1.9 GiB) TX bytes: 148805214 (141.9 MiB)

Xenbr0 Link encap: Ethernet HWaddr FE: FF
Up broadcast running noarp mtu: 1500 Metric: 1
RX packets: 1532 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 0 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 132808 (129.6 KiB) TX bytes: 0 (0.0 B)

[Root @ yangwenjun network-scripts] #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.