PDA

View Full Version : Config Ubuntu 6.10 NIC with multi-IP addresses


domino
5th November 2006, 14:26
Does anyone know how to give multiple IP address to a single network card. I'm using Ubuntu 6.10. This is my current interfaces file.


# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.0.20
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.10

falko
6th November 2006, 15:28
Have a look at the Debian Sarge tutorial: http://www.howtoforge.com/perfect_setup_debian_sarge_p3 :)

domino
6th November 2006, 20:47
Ahh, I forgot to add the IP's to the hosts file :)

Thanks!

domino
6th November 2006, 22:55
Shoold I be conserned about this waring? this message on showed after adding all 5 IP's in /etc/hosts
user@linux:~# /etc/init.d/networking restart
* Reconfiguring network interfaces...
SIOCDELRT: No such process
SIOCDELRT: No such process
SIOCDELRT: No such process
SIOCDELRT: No such process
SIOCDELRT: No such process
...done.


/etc/hosts

127.0.0.1 localhost linux
#127.0.1.1 linux.WorkGroup linux
192.168.20.20 linux.mydomain.com linux
192.168.20.21 virtual-ip1.mydomain.com virtual-ip1
192.168.20.22 virtual-ip2.mydomain.com virtual-ip2
192.168.20.23 virtual-ip3.mydomain.com virtual-ip3
192.168.20.24 virtual-ip4.mydomain.com virtual-ip4
192.168.20.25 virtual-ip5.mydomain.com virtual-ip5

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts


/etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.20.20
netmask 255.255.255.0
network 192.168.20.0
broadcast 192.168.20.255
gateway 192.168.20.10

auto eth0:0
iface eth0:0 inet static
address 192.168.20.21
netmask 255.255.255.0
network 192.168.20.0
broadcast 192.168.20.255
gateway 192.168.20.10

auto eth0:1
iface eth0:1 inet static
address 192.168.20.22
netmask 255.255.255.0
network 192.168.20.0
broadcast 192.168.20.255
gateway 192.168.20.10

auto eth0:2
iface eth0:2 inet static
address 192.168.20.23
netmask 255.255.255.0
network 192.168.20.0
broadcast 192.168.20.255
gateway 192.168.20.10

auto eth0:3
iface eth0:3 inet static
address 192.168.20.24
netmask 255.255.255.0
network 192.168.20.0
broadcast 192.168.20.255
gateway 192.168.20.10

auto eth0:4
iface eth0:4 inet static
address 192.168.20.25
netmask 255.255.255.0
network 192.168.20.0
broadcast 192.168.20.255
gateway 192.168.20.10


ifconfig

eth0 Link encap:Ethernet HWaddr 00:0C:29:35:BF:A4
inet addr:192.168.20.20 Bcast:192.168.20.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe35:bfa4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:284 errors:0 dropped:0 overruns:0 frame:0
TX packets:325 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:252091 (246.1 KiB) TX bytes:25954 (25.3 KiB)
Interrupt:185 Base address:0x1400

eth0:0 Link encap:Ethernet HWaddr 00:0C:29:35:BF:A4
inet addr:192.168.20.21 Bcast:192.168.20.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1400

eth0:1 Link encap:Ethernet HWaddr 00:0C:29:35:BF:A4
inet addr:192.168.20.22 Bcast:192.168.20.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1400

eth0:2 Link encap:Ethernet HWaddr 00:0C:29:35:BF:A4
inet addr:192.168.20.23 Bcast:192.168.20.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1400

eth0:3 Link encap:Ethernet HWaddr 00:0C:29:35:BF:A4
inet addr:192.168.20.24 Bcast:192.168.20.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1400

eth0:4 Link encap:Ethernet HWaddr 00:0C:29:35:BF:A4
inet addr:192.168.20.25 Bcast:192.168.20.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1400

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1309 (1.2 KiB) TX bytes:1309 (1.2 KiB)

falko
7th November 2006, 17:49
What's the output of ifconfig?

domino
7th November 2006, 18:57
I edited my post. It doesn't seem to have any effect. All IP addesses work fine.

falko
8th November 2006, 18:53
Then everything's ok, I guess. :)