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..


Got computer/technical problems? Get FREE help from Technize Forums

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

  1. Niraj kapadia.biz says:

    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 !!!

    Cheers,
    Niraj

  2. gdahl none says:

    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:

    IPADDR_START=”192.168.1.2″
    IPADDR_END=”192.168.1.254
    CLONENUM_START=0

    So, this will tell linux to bind all Ip addresses starting at 192.168.1.2 to 192.168.1.254.. it’s a much easier way.

  3. Sanix technodigits.wordpress.com says:

    thank you so much gdahl .. I will try out your way too.. it looks so interesting..

  4. Ratheesh says:

    We have used this for our official use. Thanks to all

  5. William adexus.com says:

    Is it posible to assign two IP addresses to one bonded interface?

  6. reza beigi hrezab.blugspot.com says:

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

Leave a Reply

Got computer/technical problems? Get FREE help from Technize Forums

Incoming search terms for the article:

linux two ip addresses on one nic, assigning multiple IPs in linux, how to assign multiple ip adress to ethernet adapter linux, linux second ip address on the same interface, two ip addresses on one computer linux, 2 ip addresses on one computer linux, how to save after assigning ip address on linux, linux two ip on one card, linux one nic two ips, linux two ip addresses, assigning multiple IPs in linux modifying a file, two ip on single lan card on linux, linux two ip address, fedora 2 ip on 1 eth, two ips one nic linux, linux eth 2 ip, two ip addresses on one nic linux, two ip address on one nic linux, two ip address on one nic in LInux, 2 ips on one nic fedora, linux secondary address, linux one nic two networks, how to assign to two ip to nic in linux, assigning more than one ip to linux, linux two ip address on one nic, assign 2 address 1 nic same subnet, assign 2 ips to eth0, second IP on linux machine, linux 1 nic 2 networks, Assign two ip in linux, multiple address on one nic on fedora, multiple ip on bond, linux one ethernet card two ip address, how to add two ip address in one nic card, linux 2 network adpater on single nic card, Assign more than one IP address to one ethernet card, linux two networks on one interface, linux multiple ip addresses on one interface, linux 2 ethernet cards, ifconfig eth0:1 192 168 1 2, linux maximum number of ip addresses per interface, linux secondary ip address same interface, linux two different networks single NIC, linux network multiple IPs on the one NIC, linux one computer two ips, linux seconday ipaddress in one ethernet adaptor, linux secondary ip subnet, linux one ethernet card two ip, linux other ipadress same ethernet, linux secondary ip address in same subnet, linux one ip address on two network cards, linux pass data from one nic to another, linux second address to interface, linux one system two ip, linux one nic two ips and macs, linux one nic two ip addresses, linux one nic two ip address, linux second network on single network card, linux secondary addresses, linux one network card two eth interfaces, linux secondary ip, linux one lan card 2 ip, linux secondary ip address bond, linux secondary IP address on same subnet, linux server 2 ip addresses same machine, more IP on one eth linux, linux two network card more networks, linux two ips same network card, linux two ips on the same interface, linux two ips on same ethernet card, linux two ips on same card, linux two ips on one interface, linux two IPs on one ethernet card, linux two ipaddresses on one interface, linux two networks on one card, linux two networks on same interface, linux using two ip address same machine, more ip ethernet, more ip address on same ethernet, more ethernet card same subnet