Multihomed NICs under Linux
From https://www.redhat.com/archives/redhat-install-list/2002-April/msg00578.html
* From: Rick Stevens <rstevens vitalstream com> * To: redhat-install-list redhat com * Subject: Re: Problems with having multiple IPs on Single NIC * Date: Tue, 23 Apr 2002 10:00:46 -0700
Kevin Bramblett wrote:
I appreciate the pointer, but it looks like I wasn't clear enough with my request. My apologies. I need Linux to multihome IPs, to have multiple IPs on a single IP, like IP Aliasing does. My problem is my Linux box is replacing a W2K box that multihomed several IPs on a single NIC. I've been able to duplicate all of the functions it did except this multihome deal. IP Masquerading for use on the Internet isn't quite what I need either. Supposedly IP Aliasing was replaced by a firewall item, but I cannot figure out what it is in order to research it.
Again, I appreciate all pointers, no matter how insignificant they may seem!
Aliases for ethernet ports on Linux use a nomenclature like "eth0:x".
The "eth0" is the primary interface, the ":x" part is the alias with
0 being the first alias, 1 the second, etc. You treat these aliases
just like the primary.
One way to set them up is to add lines similar to:
ifconfig eth0:0 first-alias-ip netmask netmask-you-want ifconfig eth0:1 second-alias-ip netmask netmask-you-want
in the "/etc/rc.d/rc.local" file. For example:
ifconfig eth0:0 192.168.3.4 netmask 255.255.255.0 ifconfig eth0:1 10.24.19.45 netmask 255.0.0.0
would add two aliases to the first ethernet card. The first
alias would be 192.168.3.4 with a /24 netmask (class C), the second
would be 10.24.19.45 with a /8 netmask (class A).
You can add aliases to each physical port you have such as "eth1:0"
and so on. I'm not certain, but looking briefly at the startup
scripts, you _should_ be able to create appropriately named files
in "/etc/sysconfig/network-scripts", thereby thereby putting in the
config stuff where Linux normally expects it to be and without adding
the stuff to /etc/rc.d/rc.local. I haven't tried that, but it should
work.
- Rick Stevens, SSE, VitalStream, Inc. rstevens vitalstream com - - 949-743-2010 (Voice) http://www.vitalstream.com - - - - BASIC is the Computer Science version of `Scientific Creationism' -