Networking Forums

Networking Forums > Computer Networking > Linux Networking > Multiple IP addresses (or hosts) on one LAN interface

Reply
Thread Tools Display Modes

Multiple IP addresses (or hosts) on one LAN interface

 
 
Patrick Lam
Guest
Posts: n/a

 
      07-21-2003, 10:42 AM
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


 
Reply With Quote
 
 
 
 
James Knott
Guest
Posts: n/a

 
      07-21-2003, 10:53 AM
Patrick Lam wrote:

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


man ifconfig

--

Fundamentalism is fundamentally wrong.

To reply to this message, replace everything to the left of "@" with
james.knott.
 
Reply With Quote
 
Kasper Dupont
Guest
Posts: n/a

 
      07-21-2003, 11:03 AM
Patrick Lam wrote:
>
> 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?


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 private.php?do=newpm&u=
This reply intentionally does not answer the question completely.
 
Reply With Quote
 
Kasper Dupont
Guest
Posts: n/a

 
      07-22-2003, 11:24 AM
Cedric Blancher wrote:
>
> Dans sa prose, Kasper Dupont nous ecrivait :
> > Whoever wrote:
> >> Actually, this is not neccessarily true. If you install the iproute2
> >> tools, you can use:
> >> /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 private.php?do=newpm&u=
Their business was zero and it was shrinking.
 
Reply With Quote
 
Cedric Blancher
Guest
Posts: n/a

 
      07-22-2003, 12:11 PM
Dans sa prose, Kasper Dupont nous ecrivait :
> 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 -+-

 
Reply With Quote
 
/dev/rob0
Guest
Posts: n/a

 
      07-22-2003, 03:35 PM
In article <(E-Mail Removed)>,
Cedric Blancher wrote:
>> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hosts file : multiple host names for ip address John A Grandy Windows Networking 1 09-04-2008 01:40 PM
Server 2003 obtaining multiple multiple IP addresses via DHCP pbrommer@gmail.com Windows Networking 1 03-29-2007 02:24 AM
Single IP Address - Multiple hosts each with different domain name. willirl@gmail.com Linux Networking 3 08-28-2005 04:31 PM
Manipulating interface IPv6 addresses Massimiliano Marcon Linux Networking 1 06-14-2005 03:39 PM
Windows 2003 Firewall Problems with Multiple Addresses on One Interface msnews.microsoft.com Windows Networking 0 02-01-2005 07:33 PM



1 2 3 4 5 6 7 8 9 10 11