Routing question virtual machines

Discussion in 'Server Operation' started by geek.de.nz, Jul 1, 2006.

  1. geek.de.nz

    geek.de.nz New Member

    Hi, I've searched this forum extensively but didn't find an answer to my question(s):

    My setup:
    router/adsl modem is on ip 10.0.0.11/8 (has dns server)
    My main linux box (ubuntu 5.10 with 2.6.16-suspend2 kernel) is on ip 10.0.0.4 called lexo
    My vmware vm (under main box):
    debian etch on ip 192.168.0.2

    I've added a virtual ip for 10.0.0.4 of 192.168.0.1 by doing the follwing:
    Code:
    ifconfig eth0:0 192.168.0.1 netmask 255.255.255.0 up
    
    Output of:
    Code:
    etch:~# ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:0C:29:6F:B6:A3
              inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
              inet6 addr: fe80::20c:29ff:fe6f:b6a3/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:37996 errors:0 dropped:0 overruns:0 frame:0
              TX packets:295 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:7476327 (7.1 MiB)  TX bytes:24318 (23.7 KiB)
              Interrupt:177 Base address:0x1400
     ...
    etch:~# route -nee
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface    MSS   Window irtt
    192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0     0     0      0
    0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0     0     0      0
    
    root@lexo:~# cat /etc/sysctl.conf
    #
    # /etc/sysctl.conf - Configuration file for setting system variables
    # See sysctl.conf (5) for information.
    #
    # Be warned that /etc/init.d/procps is executed to set the following
    # variables.  However, after that, /etc/init.d/networking sets some
    # network options with builtin values.  These values may be overridden
    # using /etc/network/options.
    
    #kernel.domainname = example.com
    #net/ipv4/icmp_echo_ignore_broadcasts=1
    dev.cdrom.lock=0
    # Enables packet forwarding
    net.ipv4.ip_forward=1
    
    root@lexo:~# sysctl -p
    
    root@lexo:~# ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:05:1C:01:7C:85
              inet addr:10.0.0.4  Bcast:10.255.255.255  Mask:255.0.0.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:8624 errors:0 dropped:0 overruns:0 frame:0
              TX packets:7796 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:3390769 (3.2 MiB)  TX bytes:1260345 (1.2 MiB)
              Interrupt:11 Base address:0xb800
    
    eth0:0    Link encap:Ethernet  HWaddr 00:05:1C:01:7C:85
              inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              Interrupt:11 Base address:0xb800
      ...
    root@lexo:~# route -nee
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface    MSS   Window irtt
    172.16.231.0    0.0.0.0         255.255.255.0   U     0      0        0 vmnet1   0     0      0
    192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0     0     0      0
    172.16.120.0    0.0.0.0         255.255.255.0   U     0      0        0 vmnet8   0     0      0
    10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 eth0     0     0      0
    0.0.0.0         10.0.0.11       0.0.0.0         UG    0      0        0 eth0     0     0      0
    
    
    OK. But routing seems to not work properly:
    Code:
    etch:~# ping -c 3 10.0.0.11
    PING 10.0.0.11 (10.0.0.11) 56(84) bytes of data.
    From 192.168.0.1: icmp_seq=1 Redirect Host(New nexthop: 10.0.0.11)
    From 192.168.0.1: icmp_seq=4 Redirect Host(New nexthop: 10.0.0.11)
    From 192.168.0.1: icmp_seq=10 Redirect Host(New nexthop: 10.0.0.11)
    
    --- 10.0.0.11 ping statistics ---
    28 packets transmitted, 0 received, 100% packet loss, time 27004ms
    
    and when I do:
    Code:
    etch:~# ping -c 1 google.com
    ping: unknown host google.com
    
    But dns is working on the (real) router/adsl modem and I can ping google.com from lexo.

    I just want to understand how routing works in unix. Am I on the right track? Is this problem maybe because I'm using everything virtually (virtual ip vmware vms etc.)? It should still work shouldn't it? What is wrong? I thought this would be the simplest setup, but it turns out to be not working. If you need any more outputs, please tell me so. Thanks in advance :).

    Or is it not working because eth0 on lexo is shared and has the same MAC address??

    Does anyone know what the vmnet settings (routing table) are for and why they are in a different subnet? Is that maybe the problem? Can I just delete them or are they important? How is it in Xen?
     
  2. falko

    falko Super Moderator Howtoforge Staff

Share This Page