Operating System - Linux
1823062 Members
3146 Online
109645 Solutions
New Discussion юеВ

multi homing a single nic

 
Mark Fenton
Esteemed Contributor

multi homing a single nic

Am I missing something, or does Linux truly lack a normal feature such as is available in HP-UX to assign multiple IP addresses to one physical NIC? I've been around the bush on this umpteen times and haven't been able to resolve it to my satisfaction. I've been using RedHat 6.2 and Mandrake 7.0 . I can make multiple NICs work just fine, but I really need to be able to address one with more than one address. Any help would be appreciated.

Mark
6 REPLIES 6
Adrian Snyman
New Member

Re: multi homing a single nic

Well, It is relativly Easy
in the directory: /etc/sysconfig/network-scripts

You have a file:
ifcfg-eth0 (depends on which card you want to alias)

copy this to the file:
ifcfg-eth0:0

Now edit this file with your other network settings, and you should then be able to bring the pseudo interface up with:

ifconfig eth0:0 up (or restart the network service)

voila ..
If it's been up and running that long, it's probably obsolete . . . impressive, but still obsolete.
Mark Fenton
Esteemed Contributor

Re: multi homing a single nic

I tried your approach, but it yields an error about how it can't assign the IP address. I expect I've yet got something in the configuration file hosed up? Here's the contents of the eth0:0 file:

#: cat ifcfg-eth0:0
DEVICE="eth0"
BOOTPROTO="none"
IPADDR="192.168.1.8"
NETMASK="255.255.255.0"
ONBOOT="yes"
IPXNETNUM_802_2=""
IPXPRIMARY_802_2="no"
IPXACTIVE_802_2="no"
IPXNETNUM_802_3=""
IPXPRIMARY_802_3="no"
IPXACTIVE_802_3="no"
IPXNETNUM_ETHERII=""
IPXPRIMARY_ETHERII="no"
IPXACTIVE_ETHERII="no"
IPXNETNUM_SNAP=""
IPXPRIMARY_SNAP="no"
IPXACTIVE_SNAP="no"
#:

The error was received even after stopping and restarting networking.
Jack Baruth
New Member

Re: multi homing a single nic

It is possible that you do not have 'IP aliasing' enabled in the kernel, although I believe it to be standard in RH and Mandrake.

Try doing it from the command line and report your error:

ifconfig eth0:0 192.168.5.5 netmask x.x.x.x up

Si vis pacem, para bellum.
Mark Fenton
Esteemed Contributor

Re: multi homing a single nic

Jack, we're getting closer. Thanks for your post. Issued the command and got no error messages:
# ifconfig eth0:0 192.168.1.8 netmask 255.255.255.0 up
#
Then to check:
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:A0:B9:35:79:01
inet addr:206.42.138.8 Bcast:206.42.138.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3499620 errors:0 dropped:0 overruns:0 frame:0
TX packets:453836 errors:0 dropped:0 overruns:0 carrier:0
collisions:56 txqueuelen:100
Interrupt:11 Base address:0x6000

eth0:0 Link encap:Ethernet HWaddr 00:A0:B9:35:79:01
inet addr:192.168.1.8 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:11 Base address:0x6000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:69 errors:0 dropped:0 overruns:0 frame:0
TX packets:69 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
And then testing from another workstation:
# ping 192.168.1.8 PING 192.168.1.8: 64 byte packets
64 bytes from 192.168.1.8: icmp_seq=0. time=1. ms
64 bytes from 192.168.1.8: icmp_seq=1. time=0. ms
64 bytes from 192.168.1.8: icmp_seq=2. time=0. ms
But the computer itself is REALLLLLY slow to ping itself:

# ping 192.168.1.8 PING 192.168.1.8 (192.168.1.8) from 192.168.1.8 : 56(84) bytes of data.
64 bytes from 192.168.1.8: icmp_seq=0 ttl=255 time=0.1 ms
64 bytes from 192.168.1.8: icmp_seq=1 ttl=255 time=3526.6 ms

so I expect I've still gotten something wrong in the configuration somewhere. I checked the routing tables:
[root@linux2 markf]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
206.42.138.8 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
206.42.138.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 206.42.138.1 0.0.0.0 UG 0 0 0 eth0
Which looks OK to me.... Further ideas?
Dan Am
Frequent Advisor

Re: multi homing a single nic

if not resolved yet:
try assigning your second IP in the routing table:
route add netmask 255.255.255.255 up
that should speed thigs up
do what you can. don't if you can't.
Mark Fenton
Esteemed Contributor

Re: multi homing a single nic

Thank you all for your assistance. The issue was resolved by assigning the eth0:0 alias, and then adding the new aliased address to the machine's host file. Alll now seems normal. Again, thank you all for your assistance.