Add two ips to one NIC in ubuntu

edit file: /etc/network/interfaces

the original content should be something like:

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.5
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.0.1 

add the following settings in the file:

auto eth0:1
iface eth0:1 inet static
address 192.168.0.6
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

# dns-* options are implemented by the resolvconf package, if installed dns-nameservers 192.168.0.1

 

run command in root mode:

/etc/init.d/networking restart

that's all. you can run ifconfig to check if it works.

I tested it in ubuntu 6.10.

posted on 2007-09-25 14:37  Wade  阅读(487)  评论(0编辑  收藏  举报

导航