Re: KVM Bridged Networking Issue in Ubuntu Lucid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for your help, it seems enabling ip forwarding on the host and
setting a default gateway on the vm pointing to the host fixed it!

On Wed, Aug 25, 2010 at 3:08 AM, haishan <haishan.bai@xxxxxxxxx> wrote:
> Rus Hughes wrote:
>>
>> Hi guys,
>>
>> I'm trying to sort out networking for a VM I've created on my Ubuntu
>> Lucid box but the VM cannot access the Internet.
>> I can connect to the VM (crisps) from the host (holly) and to the host
>> from the VM.
>> But the VM cannot connect to the Internet and the Internet cannot
>> connect to the VM.
>>
>> I followed the guide here: https://help.ubuntu.com/community/KVM
>>
>> I created it using ubuntu-vm-builder using :
>>
>> ubuntu-vm-builder kvm lucid \
>>                  --domain crisps \
>>                  --dest crisps \
>>                  --arch amd64 \
>>                  --hostname crisps \
>>                  --mem 2048 \
>>                  --rootsize 4096 \
>>                  --swapsize 1024 \
>>                  --user magicalusernameofdoom \
>>                  --pass somesecretawesomepassword \
>>                  --ip 178.63.60.159 \
>>                  --mask 255.255.255.192 \
>>                  --bcast 178.63.60.191 \
>>                  --gw 178.63.60.129 \
>>                  --dns 213.133.99.99 \
>>                  --mirror http://de.archive.ubuntu.com/ubuntu \
>>                  --components main,universe,restricted,multiverse \
>>                  --addpkg openssh-server \
>>                  --libvirt qemu:///system \
>>                --bridge br0;
>>
>> "virsh start crisps" starts the vm up :
>>
>> root     29297  0.5  3.3 2280396 271220 ?      Sl   14:12   0:13
>> /usr/bin/kvm -S -M pc-0.12 -enable-kvm -m 2048 -smp 1 -name crisps
>> -uuid e2cda480-29e7-3740-d6c6-816e2f78223e -chardev
>> socket,id=monitor,path=/var/lib/libvirt/qemu/crisps.monitor,server,nowait
>> -monitor chardev:monitor -boot c -drive
>> file=/home/idimmu/vms/crisps/tmplXQBtt.qcow2,if=ide,index=0,boot=on
>> -net nic,macaddr=52:54:00:a6:28:b9,vlan=0,model=virtio,name=virtio.0
>> -net tap,fd=41,vlan=0,name=tap.0 -serial none -parallel none -usb -vnc
>> 127.0.0.1:0 -vga cirrus
>>
>> Networking on the host is like so:
>>
>> br0       Link encap:Ethernet  HWaddr 26:5d:c9:d2:75:2e
>>          inet addr:178.63.60.138  Bcast:178.63.60.191
>>  Mask:255.255.255.192
>>          inet6 addr: fe80::4261:86ff:fee9:d69a/64 Scope:Link
>>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>          RX packets:49080900 errors:0 dropped:0 overruns:0 frame:0
>>          TX packets:54086580 errors:0 dropped:0 overruns:0 carrier:0
>>          collisions:0 txqueuelen:0
>>          RX bytes:35266886777 (35.2 GB)  TX bytes:60292047383 (60.2 GB)
>>
>> eth0      Link encap:Ethernet  HWaddr 40:61:86:e9:d6:9a
>>          inet6 addr: fe80::4261:86ff:fee9:d69a/64 Scope:Link
>>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>          RX packets:49418744 errors:0 dropped:0 overruns:0 frame:0
>>          TX packets:54348661 errors:0 dropped:0 overruns:0 carrier:0
>>          collisions:0 txqueuelen:1000
>>          RX bytes:36337218359 (36.3 GB)  TX bytes:60378047518 (60.3 GB)
>>          Interrupt:29 Base address:0x4000
>>
>> eth0:0    Link encap:Ethernet  HWaddr 40:61:86:e9:d6:9a
>>          inet addr:178.63.60.178  Bcast:178.63.60.191
>>  Mask:255.255.255.192
>>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>          Interrupt:29 Base address:0x4000
>>
>> 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:1063249 errors:0 dropped:0 overruns:0 frame:0
>>          TX packets:1063249 errors:0 dropped:0 overruns:0 carrier:0
>>          collisions:0 txqueuelen:0
>>          RX bytes:325111540 (325.1 MB)  TX bytes:325111540 (325.1 MB)
>>
>> vnet0     Link encap:Ethernet  HWaddr 26:5d:c9:d2:75:2e
>>          inet6 addr: fe80::245d:c9ff:fed2:752e/64 Scope:Link
>>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>          RX packets:72 errors:0 dropped:0 overruns:0 frame:0
>>          TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
>>          collisions:0 txqueuelen:500
>>          RX bytes:3412 (3.4 KB)  TX bytes:2698 (2.6 KB)
>>
>> the hosts /etc/network/interfaces is like so :
>>
>> auto lo
>> iface lo inet loopback
>>
>> # device: eth0
>> auto  eth0
>> iface eth0 inet manual
>>
>> auto br0
>> iface br0 inet static
>>  address   178.63.60.138
>>  broadcast 178.63.60.191
>>  netmask   255.255.255.192
>>  gateway   178.63.60.129
>>  network 178.63.60.128
>>  bridge_ports eth0
>>  bridge_stp off
>>  bridge_fd 0
>>  bridge_maxwait 0
>>
>> # subli.me.uk
>> auto eth0:0
>> iface eth0:0 inet static
>>  address 178.63.60.178
>>  netmask 255.255.255.192
>>
>>
>> If I ping the VM I see the packets on the host br0 but not vnet0, this
>> is the output of brctl show on the host :
>>
>> bridge name     bridge id               STP enabled     interfaces
>> br0             8000.265dc9d2752e       no              eth0
>>
>>     vnet0
>> this is the routing table on the host
>>
>> Kernel IP routing table
>> Destination     Gateway         Genmask         Flags Metric Ref    Use
>> Iface
>> 178.63.60.128   0.0.0.0         255.255.255.192 U     0      0        0
>> br0
>> 0.0.0.0         178.63.60.129   0.0.0.0         UG    100    0        0
>> br0
>>
>> this is the routing table on the VM
>>
>> Kernel IP routing table
>> Destination     Gateway         Genmask         Flags Metric Ref    Use
>> Iface
>> 178.63.60.128   0.0.0.0         255.255.255.192 U     0      0        0
>> eth0
>> 0.0.0.0         178.63.60.129   0.0.0.0         UG    100    0        0
>> eth0
>>
>> and the VM's network configuration
>>
>> eth0      Link encap:Ethernet  HWaddr 52:54:00:a6:28:b9
>>          inet addr:178.63.60.159  Bcast:178.63.60.191
>>  Mask:255.255.255.192
>>          inet6 addr: fe80::5054:ff:fea6:28b9/64 Scope:Link
>>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>          RX packets:777 errors:0 dropped:0 overruns:0 frame:0
>>          TX packets:319 errors:0 dropped:0 overruns:0 carrier:0
>>          collisions:0 txqueuelen:1000
>>          RX bytes:968410 (968.4 KB)  TX bytes:29662 (29.6 KB)
>>
>> 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:37 errors:0 dropped:0 overruns:0 frame:0
>>          TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
>>          collisions:0 txqueuelen:0
>>          RX bytes:3412 (3.4 KB)  TX bytes:3412 (3.4 KB)
>>
>> and this is crisps.xml
>>
>> <domain type='kvm'>
>>  <name>crisps</name>
>>  <uuid>e2cda480-29e7-3740-d6c6-816e2f78223e</uuid>
>>  <memory>2097152</memory>
>>  <currentMemory>2097152</currentMemory>
>>  <vcpu>1</vcpu>
>>  <os>
>>    <type arch='x86_64' machine='pc-0.12'>hvm</type>
>>    <boot dev='hd'/>
>>  </os>
>>  <features>
>>    <acpi/>
>>  </features>
>>  <clock offset='utc'/>
>>  <on_poweroff>destroy</on_poweroff>
>>  <on_reboot>restart</on_reboot>
>>  <on_crash>destroy</on_crash>
>>  <devices>
>>    <emulator>/usr/bin/kvm</emulator>
>>    <disk type='file' device='disk'>
>>      <source file='/home/idimmu/vms/crisps/tmplXQBtt.qcow2'/>
>>      <target dev='hda' bus='ide'/>
>>    </disk>
>>    <interface type='bridge'>
>>      <mac address='52:54:00:a6:28:b9'/>
>>      <source bridge='br0'/>
>>      <model type='virtio'/>
>>    </interface>
>>    <input type='mouse' bus='ps2'/>
>>    <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/>
>>    <video>
>>      <model type='cirrus' vram='9216' heads='1'/>
>>    </video>
>>  </devices>
>> </domain>
>>
>> im completely out of ideas and any help would be appreciated!
>>
>> Cheers,
>>
>> Rus
>> --
>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
>
> 1, create a bridge (br0)
> 2, create a tap (tap0)
> 3, add eth0 to br0
> 4, add tap0 to br0
> 5, ifconfig eth0 0.0.0.0
> 6, dhclient br0
> 7, set default gateway to br0
> 8, qemu-systam-x86_64 .... -net tap,ifname=tap0,script=no
>
> If the auto configuration of network failed to work that was maybe your DHCP
> server's problem, set the network manually.
>
>
> Regards
> Shan Hai
>
>
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux