Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm currently setting up a KVM with several VM guests. I created the first one but I ran into the first problem already:

root@vm1:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 88.140.40.50: icmp_seq=2 Redirect Host(New nexthop: 88.140.40.1)
From 88.140.40.50: icmp_seq=3 Redirect Host(New nexthop: 88.140.40.1)

So apparently the host machine is not configured correctly?

HOST - /etc/network/interfaces:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual

auto br0
iface br0 inet static
  address 88.140.40.50
  netmask 255.255.0.0
  gateway 88.140.40.1
  pointopoint 88.140.40.1
  bridge_ports eth0
  bridge_stp off
  bridge_fd 0
  bridge_hello 2
  bridge_maxage 12
  bridge_maxwait 0
  up route add -host 192.168.0.1 dev br0

192.168.0.1 is the ip from the guest vm.

HOST - iptables -L

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere            udp dpt:domain 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:domain 
ACCEPT     udp  --  anywhere             anywhere            udp dpt:bootps 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:bootps 

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  192.168.0.1          anywhere            
ACCEPT     all  --  anywhere             192.168.0.1         
ACCEPT     all  --  anywhere             anywhere            
REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable 
REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

GUEST - /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
  address 192.168.0.1
  netmask 255.255.255.255
  gateway 88.140.40.50
  pointopoint 88.140.40.50

GUEST - /etc/resolv.conf

nameserver 88.140.40.50
nameserver 88.140.40.1
share|improve this question

3 Answers 3

up vote 1 down vote accepted

You are missing some key points about networking, not strictly virtualization related.

You need to configure masquerading (NAT) on the host machine (depending on the distro, search for a general gateway howto), otherwise it won't work.

share|improve this answer
    
I thought it IP masquerading was configured already but it wasn't so thanks a lot for the hint! A simple sudo "iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -o br0 -j MASQUERADE" did the trick! –  Cojones Dec 28 '11 at 14:44

It is strange that you have a private IP (192.168.0.1) and a public IP (88.140.40.50). Do you add a NAT on your firewall ? Could you ping 88.140.40.50 to check if your pointopoint is working ?

share|improve this answer
    
88.140.40.50 is the actual public IP of the server and I can't give my VM another public address since I only got one... Pinging 88.140.40.50 works, 88.140.40.1 doesn't. I added the iptables output to my question. –  Cojones Dec 28 '11 at 13:36

I believe with a bridge you still need to enable forwarding with echo 1 > /proc/sys/net/ipv4/ip_forward (edit /etc/sysctl.conf to make this persist across reboots).

Also, in order for replies from the Internet to make back to your VM, you need set up NAT. NAT will make the Internet see your VMs' IP addresses as the public IP so packets can find their way back.

share|improve this answer
    
Also, we can probably help you better if you post the output of route -n –  Kyle Brandt Dec 28 '11 at 14:16
    
Yeah, like I commented on the other answer I just had to execute "iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -o br0 -j MASQUERADE" again after removing the old one for some reason and it worked. –  Cojones Dec 28 '11 at 17:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.