KVM Guest - Networking problem

Discussion in 'Server Operation' started by satimis, Dec 10, 2009.

  1. satimis

    satimis Member

    Hi folks,


    KVM
    Host - Debian 5.0
    VM (Guest) - Ubuntu 9.10
    One NIC


    I ran following command to create the guest (VM).

    $ sudo virt-install --connect qemu:///system -n vm30ubuntu910 -r 512 --vcpus=2 -f /home/satimis/VM/vm30ubuntu910.qcow2 -s 12 -c /home/satimis/Desktop/mini_ubuntu9.10.iso --vnc --noautoconsole --os-type linux --accelerate --network=bridge:br0 --hvm


    It went through without problem. Guest can contact Internet with following settings on /etc/network/interfaces
    Code:
    
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto eth0
    iface eth0 inet dhcp
    

    The above settings was created automatically during installation.


    I tried setting following static IP without success;
    Code:
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto eth0
    iface eth0 inet manual
    
    auto br0
    iface br0 inet static
            address         192.168.0.30
            netmask         255.255.255.0
            network         192.168.0.0
            broadcast       192.168.0.255
            gateway         192.168.0.1
            bridge_ports    eth0
            bridge_fd       9
            bridge_hello    2
            bridge_maxage   12
            bridge_stp      off
    

    Internet can't be connected.


    On guest;

    sudo ifconfig eth0 :-
    Code:
    eth0    Link encap: Ethernet  HWaddr 54:52:00:07:69:c8
        Broadcase multicast  MTU:1500  Metric:1
        RX packets:0 errors:0 dropped:0 ovrruns:0 frame:0
        TX packets:0 errors:0 dropped:0 ovrruns:0 carrier:0   
        collisions:0 txqueuelen:1000
        RX bytes:0 (0.0 B)  TX bytes:0 (0.0.B)
        Interrupt:10
    

    $ netstat -rn :-
    Code:
    Kernel IP routing table
    Destination  Gateway  Genmask  Flags  MSS Window  irtt  Iface
    

    complete ip route from host

    $ ip route
    Code:
    
    192.168.0.0/24 dev br0  proto kernel  scope link  src 192.168.0.10
    192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1
    default via 192.168.0.1 dev br0
    

    complete ip route from guest

    $ ip route
    Code:
    192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.49
    default via 192.168.0.1 dev eth0  metric 100
    

    complete ip link from host

    $ ip link
    Code:
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
        link/ether 00:0e:a6:f9:a3:5b brd ff:ff:ff:ff:ff:ff
    3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
        link/ether 00:0e:a6:f9:a3:5b brd ff:ff:ff:ff:ff:ff
    4: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
        link/ether fa:cc:db:5d:a5:63 brd ff:ff:ff:ff:ff:ff
    5: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500
        link/ether 00:ff:95:46:91:b5 brd ff:ff:ff:ff:ff:ff
    6: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500
        link/ether 00:ff:00:13:7d:6d brd ff:ff:ff:ff:ff:ff
    7: vnet2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500
        link/ether 00:ff:e9:57:bf:64 brd ff:ff:ff:ff:ff:ff
    

    complete ip link from guest

    $ ip link
    Code:
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 54:52:00:07:69:c8 brd ff:ff:ff:ff:ff:ff
    

    On host

    $ sudo brctl show
    Code:
    
    bridge name    bridge id        STP enabled    interfaces
    br0        8000.000ea6f9a35b    no        eth0
                                vnet0
                                vnet1
                                vnet2
    virbr0        8000.000000000000    yes
    

    Please help. TIA


    Edit:

    I found out the cause in running following command on VM (Guest)

    $ sudo /etc/init.d/networking restart
    Code:
     * Reconfiguring network interfaces...                                     
     * if-up.d/mountnfs[eth0]: waiting for interface br0 before doing NFS mounts
    SIOCSIFADDR: No such device
    br0: ERROR while getting interface flags: No such device
    SIOCSIFNETMASK: No such device
    SIOCSIFBRDADDR: No such device
    br0: ERROR while getting interface flags: No such device
    br0: ERROR while getting interface flags: No such device
    Failed to bring up br0.
                                                                       [ OK ]
    
    IIRC I met this problem sometimes ago. I had it fixed later unfortunate I have no recollection. Any advice? Thanks


    B.R.
    satimis
     
    Last edited: Dec 10, 2009
  2. torusturtle

    torusturtle Member

    Check if you have either the file
    /etc/iftab

    or
    /etc/udev/rules.d/70-persistent-net.rules (or similar)

    The mac address in the file should be the same as you have configured for the kvm vm.
     
  3. satimis

    satimis Member

    Hi torusturtle,

    Thanks for your advice.

    I fixed my problem already. IIRC it needs bridge-utils installed on the guest as well.


    B.R.
    satimis
     

Share This Page