[TriLUG] multiple IP from the same network card?

Jeremy Portzer jeremyp at pobox.com
Wed Jun 18 14:04:20 EDT 2003


On Wed, 2003-06-18 at 13:56, lfwelty wrote:
> How do the virtual interfaces work w/ different subnets if you are connected
> via the same physical interface?
> 
> ie. Do you have to be plugged into a switch that can handle different subnets
> on the same interface?
> 

Switches don't care about subnets.  Switches are layer two devices and
will move frames across the network regardless of what the IP headers
say.  (Well, that's not 100% true.  But mostly.)

But in general, you can have two subnets on the same physical interface,
and the same network, and they won't talk to each other at all.  Say you
have the networks 10.0.22.0/24 and 10.0.33.0/24 on the same subnet.  Any
host/NIC in the 10.0.22.* range can talk to any other IP in the
10.0.22.* range automatically.  The same goes for the 10.0.33* range. 
Even though they're on the same physical network, the subnets describe
which hosts "see" each other as local.

If you want the different networks to talk to each other, you need
routing.  A router can be configured with multiple IP addresses on one
interface quite easily.  This is sometimes called a "router on a stick,"
because there's only one cable plugged into it (the single Ethernet
cable to the single NIC).  This can be done with a standalone router, or
with the Linux virtual interface setup that Jason described, simply by
enabling IP routing. Everything will go in the NIC on one subnet, and
out the same NIC on the other.  

This isn't the most efficient way of doing things, but certainly
feasible, and often useful depending on your purposes.

--Jeremy

-- 
/=====================================================================\
| Jeremy Portzer       jeremyp at pobox.com       trilug.org/~jeremy     |
| GPG Fingerprint: 712D 77C7 AB2D 2130 989F  E135 6F9F F7BC CC1A 7B92 |
\=====================================================================/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.trilug.org/pipermail/trilug/attachments/20030618/c060fd07/attachment.pgp>


More information about the TriLUG mailing list