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..
Assigning two IP addresses to one ethernet card in Linux
by
Comments
6 responses to “Assigning two IP addresses to one ethernet card in Linux”
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
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.
thank you so much gdahl .. I will try out your way too.. it looks so interesting..
We have used this for our official use. Thanks to all
Is it posible to assign two IP addresses to one bonded interface?
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