Assign secondary IP to bonded interface on CentOS

eggster34
eggster34 used Ask the Experts™
on
Hi,

I had previously created a bonded interface out of 2 identical NICs on my server and assigned it an IP address, and this setup is working flawlessly right now.

I need to add a 2nd IP address from the same subnet to this bonded interface, how can I achieve this?

my config files are as follows:

[root@eggster34 network-scripts]# cat ifcfg-eth0
# Broadcom Corporation NetXtreme BCM5714 Gigabit Ethernet
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
[root@eggster34 network-scripts]# cat ifcfg-eth1
# Broadcom Corporation NetXtreme BCM5714 Gigabit Ethernet
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

[root@eggster34 network-scripts]# cat ifcfg-bond0
DEVICE=bond0
IPADDR=10.2.0.2
NETWORK=10.2.0.0
NETMASK=255.255.255.0
GATEWAY=10.2.0.1
USERCTL=no
BOOTPROTO=none
ONBOOT=yes

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Kerem ERSOYPresident

Commented:
Hi,

It is easy just copy a file called ifcfg-bond0:0 in /etc/sysconfig/networking/devices/

edit the file and replace the IP with the new one.
save and exit

sissue:

Servic network restart

this is it.

Cheers,
K.
 

Commented:
Copy ifcfg-bond0 to ifcfg-bond0:0

In ifcfg-bond0:0 change:

DEVICE=bond0:0
IPADDR=second address

Restart network.
Kerem ERSOYPresident

Commented:
Sorry add these lines too before saving:
HWADDR=<MAC IDDR OF YOUR BONDED DRIVER>
ONPARENT=yes
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

Kerem ERSOYPresident

Commented:
As medvedd pointed out modify DEVICE=bond0 to DEVICE=bond0:0  too

Author

Commented:
when I copy the file as it is and rename it bond0:0 and add the 2nd address and restart the network services, the server becomes unreachable for 10 whole minutes then only that 2nd Ip I added is useful, so we're doing something wrong here KeremE?
President
Commented:
Nope.
- You need to copy the file to a file named ifcfg-bond0:1
- Then edit it and modify:
DEVICE=bond0:1
IPADDRESS=<NEW_IP>
- Remove
GATEWAY=
- Add
IPV6INIT=no
ONPARENT=yes
PEERDNS=yes

There were some mistakes on my initial posts sorry for them . The crucial one is I'd set the new interface bond0:0 it should have beend bond0:1. The correct form is above. Please use them and let me know.

Cheers,
K

Author

Commented:
KeremE, it worked just as you said, thanks man!

Author

Commented:
Bravo!
Kerem ERSOYPresident

Commented:
Yr welcome. I'm happy to hear that:)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial