proper ip address aliasing

Ken Scott kens at geodax.com
Wed Feb 2 21:59:59 UTC 2005


On Wed, 2005-02-02 at 12:59, Rick Stevens wrote:
> jdyke wrote:
> > I need to add a group of virutal ips to a single interface on FC3. I've 
> > used
> > `ip addr add 192.168.2.XX dev eth0` to add the ips which worked fine, 
> > but what is the best/proper way to add them at boot up.  I'd assume i 
> > could add them in rc.local which should work?  but is that right?
> 
> The proper way is to create additional scripts in the
> "/etc/sysconfig/network-scripts" directory.  They should be named
> "ifcfg-eth0:x", with "x" being the alias number.  If you're adding 3
> aliases to eth0, for example, the files would be:
> 
> 	ifcfg-eth0	(primary, leave it alone)
> 	ifcfg-eth0:1	(first alias)
> 	ifcfg-eth0:2	(second alias)
> 	ifcfg-eth0:3	(third alias)
> 
> Inside those "ifcfg-eth0:x" scripts, you only need four lines:
> 
> 	DEVICE=eth0:x		(replace "x" with the alias number)
> 	IPADDR=xxx.xxx.xxx.xxx
> 	NETMASK=xxx.xxx.xxx.xxx
> 	ONBOOT=yes
> 
> The first one, "ifcfg-eth0" should be left alone, as it sets up the
> base device.
> 
> That's the "official" way to do it and the way "system-config-network"
> or "Fedora Icon->System Settings->Network" do it, which would allow you
> to manage them via the GUI system.

I have not had occasion to use this "virtual IP" technique but I
appreciate the procedure.  Does this mean that I can take my development
box (192.168.0.100) and assign it a virtual IP on a different subnet
(say 192.168.2.100)  so that it could talk to a another box I  have on
the local network temporarily (which I am working on for someone else)? 
My machine only has a single network card in it.  
That would be great if true, I could leave both my machine's IP alone
and the other device's IP as well and simply change the virtual IP so
that they could talk.  
Seems so elegant that it probably does work that way (since it is after
all Linux)!
I know that I can change my internal IP to match the target machine but
that solution doesn't allow concurrent web access.
Thanks in advance.
Ken




More information about the Redhat-install-list mailing list