2 IPs on one nic

Mike Burger mburger at bubbanfriends.org
Sat Apr 19 12:19:21 UTC 2008


> Hi list

Hi, Patrick

> Can someone tell me how to add a 2nd IP adress to a nic and ensure that
> 2nd
> IP is kept after a reboot
>
> Tried ifconfig eth0 add aaa.bbb.ccc.ddd, but the IP is dropped after
> reboot

As good as the suggestions to create a sub-interface are, there's an even
easier way to do so, now, using the "ip" command.

To alias an IP onto your NIC, just run:

ip addr add aaa.bbb.ccc.ddd/YY dev ethX (in this case, /YY is the CIDR
notation for netmask bits)

To list the ip addresses running on your NICs, run:

ip addr

To remove an IP address, just run:

ip addr del aaa.bbb.ccc.ddd/YY dev ethX

I used to use the sub-interface methodology, as well, until I discovered
the "ip" command round about RHL9 or one of the Fedora Core
products...I've been using it, now, for about 7-8 years, on my Fedora
server and on my IPCop firewall.  Works like a charm, and keeps my
ifconfig output fairly clean (don't have to weed through 25 sub-interfaces
if I don't want to).
-- 
Mike Burger
http://www.bubbanfriends.org

Visit the Dog Pound II BBS
telnet://dogpound2.citadel.org or http://dogpound2.citadel.org

To be notified of updates to the web site, visit:

https://www.bubbanfriends.org/mailman/listinfo/site-update

or send a blank email message to:

site-update-subscribe at bubbanfriends.org




More information about the users mailing list