Assigning two IP addresses to one ethernet card in Linux

Hmm .. So we are running out of resources and can’t buy a new ethernet card for the system. No problems, whatever the reason, we can assign two or more IP addresses to our linux box using only one NIC.

I’ll do it in Fedora.
Go to /etc/sysconfig/network-scripts/ directory
Copy ifcfg-eth0 to the same directory and name the copy as ifcfg-eth0:0.
Edit ifcfg-eth0:0 and enter your new IP address settings
And you’re done. So simple na. You can add up to 255 different IP addresses to one linux machine using this technique. Having trouble doing it? ask us now and we’re here to help you..

6 thoughts on “Assigning two IP addresses to one ethernet card in Linux”

  1. Hi Sanix,
    Your trick worked in Fedora 7 – however, what I needed to do is one extra step.
    After modifying the file eth0:0 in directory “/etc/sysconfig/network-scripts” I found that I could not PING with both the interfaces from another XP computer on my LAN.
    What I did is went to NETWORK GUI under ADMINISTRATION and ACTIVATE each interface individually – even though it shows as ALREADY ACTIVATED.
    Then it works great !!!

  2. Actually, I know this topic is old but came across it in a search.. so I thought I would throw out my way of doing it:
    vi /etc/sysconfig/network-scripts/ifcfg-eth0-range0
    Add the following:
    So, this will tell linux to bind all Ip addresses starting at to it’s a much easier way.

  3. yes . it is possible by this command :
    ifconfig eth0:1 subnet up
    for first interface and
    ifconfig eth0:2 subnet up
    for the other

Comments are closed.