Add an IP alias to ethernet interface

Andrew Beverley andy at andybev.com
Wed Jun 6 14:24:55 PDT 2007


On Mon, 2007-06-04 at 19:22 -0400, Bryan Kadzban wrote:
> Andrew Beverley wrote:
> > I've created an ipv4-alias script, please see attached. However, it
> > is almost exactly the same as the ipv4-static script (it still needs
> > all the same parameters as a normal static address), which makes me
> > think that the ipv4-static script should just be updated so that it
> > can deal with an ALIAS variable (similar to the script Rabenkind
> > did).
> 
> Would there be any problem with doing an:
> 
> ip addr add <addr>/<prefix> dev eth0
> 
> (or equivalent) and dispensing with the aliased interface name?  If so,
> it may be simpler to just add a second config file (with the same
> ipv4-static SERVICE) to the ifconfig.eth0 directory; then you wouldn't
> need a new service script.  :-)

Interesting, I never knew you could do that! Having spent a lot of time
reading about multiple IP addresses per interface, I never came across
an example like that.

Personally though, I think it would be useful to still include the ALIAS
directive (it's only a few extra line of code). Firstly it gives the
script the ability to deal with more of the functionality of ip (I
assume there is a reason to use the alias option), and secondly, using
the above does not seem to be compatible with ifconfig (which I think
most people probably still use) - the second IP address doesn't show in
the output of ifconfig.

Regards,

Andy Beverley





More information about the lfs-dev mailing list