Multiple IPs

Thomas Kaiser thomas at kaiser.linux-site.net
Wed Jan 19 22:34:39 UTC 2005


I do it like this in /etc/network/interfaces :

auto eth0:0	# to start at boot
iface eth0:0 inet static
     address 192.168.0.1
     netmask 255.255.255.0

auto eth0:1	# to start at boot
iface eth0:0 inet static
     address 192.168.1.1
     netmask 255.255.255.0

auto eth0:3	# to start at boot
iface eth0:0 inet static
     address 192.168.3.1
     netmask 255.255.255.0

Mybe the next example does also work, but I never tried:

auto eth0:3	# to start at boot
iface eth0:4 inet dhcp

Regards, Thomas

Pierfrancesco Caci wrote:
> :-> "Ben" == Ben Hodgson <ubuntu-list at blahpro.com> writes:
> 
>     > Hi,
>     > How can I add multiple IPs to one physical ethernet card? I tried using the
>     > built-in tool in webmin (i.e to create a virtual interface) but it just
>     > wrecked
>     > all the network settings and rendered the machine network-blind.
> 
> ip addr add x.x.x.x dev eth0
> 
> (needs the iproute package that I don't remember if it's installed by
> default in ubuntu)
> 
> or you can use aliases
> 
> ifconfig eth0:1 ....
> 
> 
> 
>     > Is there a config file I can edit? (or, what config file can I edit, lol)
> 
> 
> I usually add an "up" line in /etc/network/interfaces doing the above
> command:
> 
> 
> iface eth0 inet static
>         address x.y.z.114
>         netmask 255.255.255.248
>         gateway x.y.z.113
>         up ip addr add 192.168.1.2/24 dev eth0
>         down ip addr del 192.168.1.2 dev eth0
> 
> 
> 
> the iproute tools are explained in the "Linux Advanced Routing and
> Traffic Control HOWTO" (http://lartc.org/) 
> 
> Pf
> 




More information about the ubuntu-users mailing list