Subject: Re: [vserver] strange loopback / route issue
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Thu, 27 Nov 2008 09:31:22 +0100

On Wed, Nov 26, 2008 at 10:18:57PM +0100, Konrad Korzeniowski wrote:
> Hi,
> 
> I'm lost...
> 
> HOST
> --------------------------------------------------------------------
> 
> cat /proc/virtnet/40003/info
> ID:     40003
> Info:   f7d4c240
> Bcast:  255.255.255.255
> Lback:  127.156.67.1
> 0:      [10.10.43.31-0.0.0.0/0.0.0.0:0010]
> 
> route -n
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use
> Iface
> 10.10.10.0      0.0.0.0         255.255.255.0   U     0      0        0 eth1
> 10.10.43.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
> 0.0.0.0         10.10.43.1      0.0.0.0         UG    0      0        0 eth0
> 
> ifconfig
> eth0      Link encap:Ethernet  HWaddr 00:30:05:CF:75:4B
>           inet addr:10.10.43.31  Bcast:10.10.43.255  Mask:255.255.255.0
>           inet6 addr: fe80::230:5ff:fecf:754b/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:1243495 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:778041 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:1196385313 (1.1 GiB)  TX bytes:112573993 (107.3 MiB)
>           Memory:d0400000-d0420000
> 
> eth1      Link encap:Ethernet  HWaddr 00:1B:21:1A:9D:33
>           inet addr:10.10.10.90  Bcast:10.10.10.255  Mask:255.255.255.0
>           inet6 addr: fe80::21b:21ff:fe1a:9d33/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:8215890 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:16630944 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:598653130 (570.9 MiB)  TX bytes:2368811256 (2.2 GiB)
> 
> 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:2761 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:2761 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0
>           RX bytes:205129 (200.3 KiB)  TX bytes:205129 (200.3 KiB)
> 
> 
> /etc/vservers/mx1# ls -la interfaces/
> total 12
> drwxr-xr-x 3 root root 4096 2008-11-26 15:46 .
> drwxr-xr-x 6 root root 4096 2008-11-10 05:45 ..
> drwxr-xr-x 2 root root 4096 2008-11-10 05:51 1
> 
> /etc/vservers/mx1# ls -la interfaces/1/
> total 12
> drwxr-xr-x 2 root root 4096 2008-11-10 05:51 .
> drwxr-xr-x 3 root root 4096 2008-11-26 15:46 ..
> -rw-r--r-- 1 root root   12 2008-11-10 05:51 ip
> -rw-r--r-- 1 root root    0 2008-11-10 05:51 nodev
> 
> /etc/vservers/mx1# cat interfaces/1/ip
> 10.10.43.31
> 
> cat /proc/virtual/info
> VCIVersion:     0002:0303
> VCISyscall:     273
> VCIKernel:      13000ff1
> 
> vserver-info
> Versions:
>                    Kernel: 2.6.26-bpo.1-vserver-686
>                    VS-API: 0x00020303
>              util-vserver: 0.30.216-pre2772; Nov  8 2008, 21:20:22
> 
> Features:
>                        CC: gcc, gcc (GCC) 4.1.2 20061115 (prerelease)
> (Debian 4.1.1-21)
>                       CXX: g++, g++ (GCC) 4.1.2 20061115 (prerelease)
> (Debian 4.1.1-21)
>                  CPPFLAGS: ''
>                    CFLAGS: '-Wall -g  -O2 -std=c99 -Wall -pedantic -W
> -funit-at-a-time'
>                  CXXFLAGS: '-g -O2 -ansi -Wall -pedantic -W
> -fmessage-length=0 -funit-at-a-time'
>                build/host: i486-pc-linux-gnu/i486-pc-linux-gnu
>              Use dietlibc: yes
>        Build C++ programs: yes
>        Build C99 programs: yes
>            Available APIs: v13,net,v21,v22,v23,netv2
>             ext2fs Source: e2fsprogs
>     syscall(2) invocation: alternative
>       vserver(2) syscall#: 273/glibc
>                crypto api: beecrypt
> 
> Paths:
>                    prefix: /usr
>         sysconf-Directory: /etc
>             cfg-Directory: /etc/vservers
>          initrd-Directory: $(sysconfdir)/init.d
>        pkgstate-Directory: /var/run/vservers
>           vserver-Rootdir: /var/lib/vservers
> 
> 
> GUEST
> --------------------------------------------------------------------
> 
> route -n
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use
> Iface
> 10.10.10.0      0.0.0.0         255.255.255.0   U     0      0        0 *
> 10.10.43.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
> 0.0.0.0         10.10.43.1      0.0.0.0         UG    0      0        0 eth0
> 
> ifconfig
> eth0      Link encap:Ethernet  HWaddr 00:30:05:CF:75:4B
>           inet addr:10.10.43.31  Bcast:10.10.43.255  Mask:255.255.255.0
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:1243471 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:778019 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:1196383233 (1.1 GiB)  TX bytes:112570633 (107.3 MiB)
>           Memory:d0400000-d0420000
> 
> lo        Link encap:Local Loopback
>           inet addr:127.0.0.1  Mask:255.0.0.0
>           UP LOOPBACK RUNNING  MTU:16436  Metric:1
>           RX packets:2761 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:2761 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0
>           RX bytes:205129 (200.3 KiB)  TX bytes:205129 (200.3 KiB)
> 
> cat /etc/hosts
> # /etc/hosts
> 
> 127.0.0.1       localhost
> 10.10.43.31     mx1.xxx.pl mx1
> 
> # The following lines are desirable for IPv6 capable hosts
> # (added automatically by netbase upgrade)
> 
> ::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
> 
> NOW (on client)
> 
> telnet localhost 25
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> 220 mx1.xxx.pl ESMTP Postfix (Debian/GNU)
> quit
> 221 2.0.0 Bye
> 
> and:
> Nov 26 19:16:39 mx1 postfix/smtpd[30797]: connect from
> mx1.xxx.pl[10.10.43.31]
> Nov 26 19:16:42 mx1 postfix/smtpd[30797]: disconnect from
> mx1.xxx.pl[10.10.43.31]
> 
> Why is it connecting using source address 10.10.43.31 and not 127.0.0.1 ?

that could actually be a bug ... please get the
latest version
(http://vserver.13thfloor.at/Experimental/patch-2.6.27.6-vs2.3.0.36.2.diff)
and run the telnet through 'strace -fF ...'

TIA,
Herbert

> rgrds.,
> Konrad Korzeniowski