KVM Guest: Network dies not work

Tom H tomh0665 at gmail.com
Sat Oct 18 05:44:29 UTC 2014


On Thu, Oct 16, 2014 at 6:23 AM, robert <robert at redcor.ch> wrote:


> I would like to set up an ubuntu KMV guest in an ubuntu host.
>
> Unfortunately within the guest the network is not accesible. I can only ping
> localhost successfully.
> The ip of the host is:176.9.142.21
> The ip of the guest is: 176.9.163.129
>
> One funy thing is: When I try to log int the guest from the host using the
> ip 176.9.163.129, I in fact log into the host.
>
> This is what I have done:
>
> in the host I defined
>
> <network>
>     <name>Hetzner</name>
>     <forward dev='eth0' mode='route'/>
>     <bridge name='virbr2' stp='off' forwardDelay='0' />
>     <ip address='176.9.163.129' netmask='255.255.255.224'/>
> </network>
>
> and activated it in virsh.

A netmask of '255.255.255.224'? Do you mean this or do you mean '/24'
and therefore '255.255.255.0'?


> in the host: the setting in network/interfaces
> -----------------------------------------------------------
>
> ### Hetzner Online AG - installimage
> # Loopback device:
> auto lo
> iface lo inet loopback
>
> # device: eth0
> auto  eth0
> iface eth0 inet static
>   address   176.9.142.21
>   broadcast 176.9.142.31
>   netmask   255.255.255.255
>   gateway   176.9.142.1
>   pointopoint 176.9.142.1
>   # default route to access subnet
>   up route add -net 176.9.142.0 netmask 255.255.255.224 gw 176.9.142.1 eth0

For 'broadcast', did you type '.31' and mean '.21'? If you're using
'pointopoint', you shouldn't specify a broadcast address or you should
specify '0.0.0.0' or '176.9.142.21' (the address of the host).

You don't need 'up route ...'.


> auto virbr2
> iface virbr2 inet static
>   address 176.9.142.21
>   netmask 255.255.255.255
>   bridge_ports none
>   bridge_stp off
>   bridge_fd 0
>   pre-up brctl addbr virbr2
>   up ip route add 176.9.163.129/32 dev virbr2
>   down ip route del 176.9.163.129/32 dev virbr2

The same address as eth0?!

Since you're using "mode='route'", you have to have a different
address for virbr2 and libvirt will take care of the routing.

Since you're using 'bridge_...' commands, you don't need 'pre-up brctl ...'.

You don't need the 'up|down ip route ...' commands.

I've never been able to use a "mode='route'" without an iptables
masquerade rule, even though the libvirt tools don't set one up. Do
you have one?


> in the quest
> ----------------
> # The loopback network interface
> auto lo
> iface lo inet loopback
> auto eth0
> iface eth0 inet static
>   address 176.9.163.129
>   broadcast 176.9.163.135
>   netmask 255.255.255.255
>   pointopoint 176.9.142.21
>   gateway 176.9.142.21
>   dns-nameservers 213.133.98.98 213.133.99.99

I've never used a VM with ppp so I'm just guessing but I wouldn't
think that you need to use ppp in the guest.

But if you do, for 'broadcast', see above.




More information about the ubuntu-users mailing list