Subject: Re: [vserver] multiple IP addresses on one interface
From: "Daniel Hokka Zakrisson" <daniel@hozac.com>
Date: Sat, 23 Feb 2008 16:59:51 +0100 (CET)

erik pepermans wrote:
> My configuration via kernel  2.6.22.18-vs2.3.0.32.1 on a Centos 5 machine
> :
>
> # ip address show
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>     inet 127.0.0.1/8 scope host lo
>     inet6 ::1/128 scope host
>        valid_lft forever preferred_lft forever
> 2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast
> qlen
> 1000
>     link/ether 00:15:17:48:fe:ca brd ff:ff:ff:ff:ff:ff
> 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen
> 100
>     link/ether 00:15:17:48:fe:cb brd ff:ff:ff:ff:ff:ff
>     inet 77.73.96.155/27 brd 77.73.96.159 scope global eth1
>     inet 77.73.96.154/27 brd 77.73.96.159 scope global secondary eth1:1
>     inet 77.73.96.156/27 brd 77.73.96.159 scope global secondary eth1:2
>     inet6 fe80::215:17ff:fe48:fecb/64 scope link
>        valid_lft forever preferred_lft forever
> 4: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue
>     link/ether 5e:0b:75:b9:2e:71 brd ff:ff:ff:ff:ff:ff
>     inet6 fe80::5c0b:75ff:feb9:2e71/64 scope link
>        valid_lft forever preferred_lft forever
> 5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
>     link/ether 00:15:17:48:fe:ca brd ff:ff:ff:ff:ff:ff
>     inet 192.168.5.1/24 brd 192.168.5.255 scope global br0
>     inet 192.168.5.101/24 brd 192.168.5.255 scope global secondary br0:1
>     inet6 fe80::215:17ff:fe48:feca/64 scope link
>        valid_lft forever preferred_lft forever
>
> When I ping to the internet from the host, the source IP used is the
> default
> : 77.73.96.155
>
> # tcpdump -i eth1 -n icmp
> tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
> listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes
> 22:26:36.341010 IP 77.73.96.155 > 217.66.0.59: ICMP echo request, id 3339,
> seq 1, length 64
> 22:26:36.356377 IP 217.66.0.59 > 77.73.96.155: ICMP echo reply, id 3339,
> seq
> 1, length 64
> 22:26:37.341338 IP 77.73.96.155 > 217.66.0.59: ICMP echo request, id 3339,
> seq 2, length 64
> 22:26:37.352330 IP 217.66.0.59 > 77.73.96.155: ICMP echo reply, id 3339,
> seq
> 2, length 64
>
> When I ping to the internet from within the guest, the source IP used is
> NOT
> the default : 77.73.96.154
>
> ]# tcpdump -i eth1 -n icmp
> tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
> listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes
> 22:29:44.800981 IP 77.73.96.154 > 217.66.0.59: ICMP echo request, id
> 18955,
> seq 1, length 64
> 22:29:44.813302 IP 217.66.0.59 > 77.73.96.154: ICMP echo reply, id 18955,
> seq 1, length 64
> 22:29:45.801681 IP 77.73.96.154 > 217.66.0.59: ICMP echo request, id
> 18955,
> seq 2, length 64
> 22:29:45.812003 IP 217.66.0.59 > 77.73.96.154: ICMP echo reply, id 18955,
> seq 2, length 64
>
> Question : Why is this and secondly, how can I force a guest to either use
> 77.73.96.154, 77.73.96.155 or 77.73.96.156 ?

The guest will use whichever address it has been assigned, with a bias
towards the first one (i.e. the one in
/etc/vservers/<guest>/interfaces/0). What IP addresses have you assigned
to that guest, and in what order?

> Thanks in advance !

-- 
Daniel Hokka Zakrisson