Friday, September 14, 2012

How To configure Multiple IP Addresses on single interface

In linux, you can bind multiple IP addresses on a single NIC. This is usually done in case you are using your linux machine as a web server and is hosting multiple domains and you want to bind each domain to a unique IP address. This is how it is done.

Let us assume that you already have a NIC which is bound with a static IP address. Then you will have a file called /etc/sysconfig/network-scripts/ifcfg-eth0 .My ifcfg-eth0 file has the following entries:

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="00:0C:29:A9:3C:AA"
MTU="1500"
NM_CONTROLLED="yes"
ONBOOT="yes"
[root@localhost ~]#

Now to bind another IP address to the same NIC, I create a copy of the above file ifcfg-eth0 and name it as ifcfg-eth0:1

# cd /etc/sysconfig/networking-scripts

# cp ifcfg-eth0 ifcfg-eth0:1

Now just change the values of the DEVICE and IPADDR in the file as follows:

# File: ifcfg-eth0:1
DEVICE=eth0:1
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.5
NETMASK=255.255.255.0
BROADCAST=192.168.0.255
NETWORK=192.168.0.0
HWADDR=00:80:48:34:C2:84

And lastly, restart the networking service. If you are using RedHat, then it is as simple as :

# service network restart

9 comments:

  1. The thing is each computer connected to the World Wide Web has an IP address which is given by the Internet Service Provider. Hide your IP

    ReplyDelete
  2. For the most part each and every trade recipient protest will have more than one proxy address with each outside address sort having one address. myip

    ReplyDelete
  3. An unexpected consequence of this coming flood of unused addresses will be a lengthening of the market's limited timespan.IP address

    ReplyDelete
  4. If you have a good concept of IP Addresses, then understanding the IP location database terminology will be quite easy. Windows USA

    ReplyDelete
  5. These are open systems and you have to keep your data secure. An Android VPN will keep your versatile broadband secure with only a couple of snaps. https://www.router-reset.com/how-flush-dns-cache/

    ReplyDelete
  6. Get an excellent Support Services for Tp link login, Tplink login, Tp-link router login, Tp link login username and password, Tp link login ip.

    Call Us- 18883990817

    ReplyDelete
  7. If you have any problem configuring the router, You can find it here router setting.

    ReplyDelete