RE: [vserver] multiple IP addresses on one interface

From: erik pepermans <peperjam_at_skynet.be>
Date: Sun 24 Feb 2008 - 11:29:14 GMT
Message-ID: <000101c876d8$7c39dec0$0a0a0a0a@MYSTUFF>

Hi,

This is my /etc/vservers/<guest>/interfaces/0 config :

dev : br0
ip: 192.168.5.101
Mask: 255.255.255.0
Name: 1

Following entries are in iptables :

# nat
iptables -t nat -A PREROUTING -i eth1 \
         -j DNAT --to-destination 192.168.5.1

iptables -t nat -A POSTROUTING -s 192.168.5.0/24 \
         -j SNAT -o eth1 --to-source 77.73.96.155

Brgds
Erik

-----Oorspronkelijk bericht-----
Van: Daniel Hokka Zakrisson [mailto:daniel@hozac.com]
Verzonden: zaterdag 23 februari 2008 17:00
Aan: vserver@list.linux-vserver.org
Onderwerp: Re: [vserver] multiple IP addresses on one interface

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
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Sun Feb 24 11:30:02 2008
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Sun 24 Feb 2008 - 11:30:05 GMT by hypermail 2.1.8