How to bind secondary IP addresses in Debian Server.
There is slight difference in binding secondary IP addresses in Debian server to that of a Redhat Linux server.
Open file /etc/network/interfaces
Contents of the file looks like
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.2
netmask 255.255.255.xyx
gateway 192.168.0.1
Suppose we wants to add an IP 192.168.0.3 add the following to /etc/network/interfaces.
iface eth0:1 inet static
address 192.168.0.3
netmask 255.255.255.xyx
gateway 192.168.0.1
Now run the command
This will add Ip 192.168.0.3 in ifconfig output.
To add next secondary IP the next set of entry should be
iface eth0:2 inet static
address 192.168.0.4
netmask 255.255.255.xyx
gateway 192.168.0.1
Then Run
These IP addresses are bounded to eth0 that is to the first NIC.
If you wants to bind the IP to the second network card the entry should be eth1:1 instead of eth0:1
Finally check whether the IP addresses are listed in the ifconfig output.
Leave a Reply
You must be logged in to post a comment.