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

Re: KVM networking.



Thank You for Your time and answer, Arno:

>I think this setup might need additional configuration on the outside,
>because you need to add the same subnet route on your Internet
>modem/router. I don't think qemu gives you NAT for free...

I've got such a problem w/ NATing:

/sbin/iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -d !
192.168.1.0/24 -j SNAT --to-source 192.168.0.2

Bad argument `192.168.1.0/24'

Do You have any idea why iptables does not accept the ip nor the ip net?

Then I went this way for NAT-ing but w/ no luck:

iptables -t nat -A PREROUTING -i eth0 -s 192.168.0.2 -j DNAT
--to-destination 192.168.1.10

iptables -t nat -A POSTROUTING -i eth0 -s 192.168.1.10 -j SNAT
--to-source 192.168.0.2

iptables -A FORWARD -i eth0 -o tap0 -d 192.168.1.10 -j ACCEPT


Also, on host I do:

sysctl -w net.ipv4.ip_forward=1
route add -host 192.168.1.10 dev tap0

and on guest:

route add -host 192.168.1.2 dev eth0
route add default gw 192.168.0.2


Reply to: