[ILUG] assiging 2 IP addresses.

Philip Reynolds phil at redbrick.dcu.ie
Sat Sep 16 09:34:08 IST 2000


G.Sagar's [sagarg at bol.net.in] 12 lines of dribble included:
:>Hiyall,
:>
:>How do i assign 2 IP addresses to a single eth interface ??
:>

You might want to take a look at the Linux Networking HOWTO (should be on
linuxdoc.org or any of the other mirrors around). There should be stuff on IP
aliasing in that, but simply..
you must have IP Aliasing support compiled into your kernel by default (don't
ask me if it is, I rarely use generic kernels ;P)

Considering your local network is 192.168.1.*

ifconfig eth0 192.168.1.1 netmask 
route add -net 192.168.1.0 netmask 255.255.255.0 eth0

That's pretty standard. Basically after that, your physical interface and
virtual interface are denoted as
<phys interface>:<virtual interface>
e.g.
eth0:0
eth0:1 
..

There's more information in the Linux Networking HOWTO, documented better than
I could ever do it here, but the syntax for adding the alias is the exact same
as above except you reference it as something like
eth0:0 as your interface, instead of eth0 with a different address of course.
Phil.




More information about the ILUG mailing list