Discussion:
Multiple IP addresses (or hosts) on one LAN interface
(too old to reply)
Patrick Lam
2003-07-21 10:42:56 UTC
Permalink
Dear all:

I need to setup multiple hosts (or servers) on the same machine which has
only one LAN interface. That is, I would have IP addresses like:

207.10.2.5
207.10.2.10
207.10.2.67

on the same LAN interface (on one machine) and bind 3 different processes
onto these 3 addresses so that:

process1 would be identified to have IP address 207.10.2.5
process2 would be identified to have IP address 207.10.2.10
process3 would be identified to have IP address 207.10.2.67


I know this is possible in Solaris (but I already forgot how I did it). Is
this also possible in Linux (I actually think so)? How is it done?

Thanks so very much in advance,

Patrick
James Knott
2003-07-21 10:53:16 UTC
Permalink
Post by Patrick Lam
I need to setup multiple hosts (or servers) on the same machine which has
207.10.2.5
207.10.2.10
207.10.2.67
on the same LAN interface (on one machine) and bind 3 different processes
process1 would be identified to have IP address 207.10.2.5
process2 would be identified to have IP address 207.10.2.10
process3 would be identified to have IP address 207.10.2.67
I know this is possible in Solaris (but I already forgot how I did it).
Is
this also possible in Linux (I actually think so)? How is it done?
Thanks so very much in advance,
Patrick
man ifconfig
--
Fundamentalism is fundamentally wrong.

To reply to this message, replace everything to the left of "@" with
james.knott.
Patrick Lam
2003-07-21 11:29:23 UTC
Permalink
I can't find much information from it. Can you give me a little more
details?

Thanks again.

Patrick
Post by James Knott
Post by Patrick Lam
I need to setup multiple hosts (or servers) on the same machine which has
207.10.2.5
207.10.2.10
207.10.2.67
on the same LAN interface (on one machine) and bind 3 different processes
process1 would be identified to have IP address 207.10.2.5
process2 would be identified to have IP address 207.10.2.10
process3 would be identified to have IP address 207.10.2.67
I know this is possible in Solaris (but I already forgot how I did it).
Is
this also possible in Linux (I actually think so)? How is it done?
Thanks so very much in advance,
Patrick
man ifconfig
--
Fundamentalism is fundamentally wrong.
james.knott.
Kasper Dupont
2003-07-21 11:03:10 UTC
Permalink
Post by Patrick Lam
I need to setup multiple hosts (or servers) on the same machine which has
207.10.2.5
207.10.2.10
207.10.2.67
on the same LAN interface (on one machine) and bind 3 different processes
process1 would be identified to have IP address 207.10.2.5
process2 would be identified to have IP address 207.10.2.10
process3 would be identified to have IP address 207.10.2.67
I know this is possible in Solaris (but I already forgot how I did it). Is
this also possible in Linux (I actually think so)? How is it done?
First you choose three different interface names like eth0, eth0:id1,
and eth0:id2. The id after the : can be anything you like. You should
use the primary IP address for eth0 and additional IP addresses for
the other interfaces. To use only one of the three IP addresses, a
process must first bind a socket to that IP address using the bind
system call.
--
Kasper Dupont -- der bruger for meget tid paa usenet.
For sending spam use mailto:***@daimi.au.dk
This reply intentionally does not answer the question completely.
Kasper Dupont
2003-07-22 11:24:42 UTC
Permalink
Actually, this is not neccessarily true. If you install the iproute2
/sbin/ip addr add ....
and add multiple IP addresses to eth0 (without the ":idx" suffix).
I wonder what it actually does, after adding one, I cannot see it with
ifconfig.
"ip addr add" just add an ARP entry to the interface, i.e. an IP for which
the interface will answer.
ifconfig does a bit more, such as setting according routes.
But still there is a difference between
1) Adding the IP using "ifconfig interface:id"
2) Adding the IP using "ip addr add" and the
route using "route add"
--
Kasper Dupont -- der bruger for meget tid paa usenet.
For sending spam use mailto:***@daimi.au.dk
Their business was zero and it was shrinking.
Cedric Blancher
2003-07-22 12:11:30 UTC
Permalink
But still there is a difference between 1) Adding the IP using "ifconfig
interface:id" 2) Adding the IP using "ip addr add" and the
route using "route add"
Except the fact you do not create an aliased interface, I don't think
there's any difference. I personaly prefer use ifconfig for I can see
aliases as eth0:idx.
--
Sur francom.amitie il y a aussi des fois des massages court
-+- K in GNU - La main du masseur dans la culotte du zouave -+-
/dev/rob0
2003-07-22 15:35:45 UTC
Permalink
Post by Cedric Blancher
But still there is a difference between 1) Adding the IP using "ifconfig
interface:id" 2) Adding the IP using "ip addr add" and the
route using "route add"
Except the fact you do not create an aliased interface, I don't think
there's any difference. I personaly prefer use ifconfig for I can see
aliases as eth0:idx.
I use /sbin/ip to add my aliases, but I use the ethX:alias syntax. :) A
compromise, as it were. It's also necessary if you want to use the alias
interface with iptables. Well, I think you can only use the whole ethX
interface, which includes any :alias.

I use aliases for different services, so they're portable if I need to
move them to another machine (set up the service on B, stop the service
on A, cancel the alias on A, set up the alias on B, start the service on
B ... and everyone goes on as if nothing had happened.) If the alias is
in the same subnet no special routing is needed.
--
/dev/rob0 - preferred_email=i$((28*28+28))@softhome.net
or put "not-spam" or "/dev/rob0" in Subject header to reply
Continue reading on narkive:
Loading...