Re: [blug-prog] Adding multiple IPv4 addresses for a port
- On Wednesday 08 December 2004 12:06, Nagarahalli, Honnappa wrote:
> I have a requirement in which I need to add multiple IPv4Well, sounds like what you're looking for is slightly different, but -
> addresses to the same interface such as "eth0". Right now I am using
> the "devinet_ioctl (SIOCSIFADDR, &ir) call in the linux kernel, where
> "ir" is declared as "struct ifreq ir;". With this, everytime I add a
> new IP address, the IP address of the "eth0" gets changed to the new
> one and does not add the new one to the old list. So what I want is
> when I execute the command "ifconfig eth0" it should show a list of
> all the IPv4 addresses that I added.
will something like this do?
for c in `seq 1 254`; do ifconfig eth0:$c 192.168.0.$c; done
These IP addresses can be actually present on what is placed "on the
wire." Please don't ask me how on earth multiple IPs on single NIC
works, I am also looking for literature on this ;-) If you happen to
know of any, or have an explanation, please let me know.
Also see http://handsonhowto.com/virt.html