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

Re: [Xen-users] domU NAT network cannot connect



My host OS is Gentoo x64. I will give a try to libvirtd. Thanks.


On Thursday, April 12, 2012, Keeler, Matthew J. wrote:

What is the host OS?

Â

In my experience it is easier to either use libvirtd to control the virtual networking or run dnsmasq and configure iptables manually. I wouldnât rely on the network-nat script as it seems to only set the IP address of the vif endpoint in dom0.

Â

Assuming you have libvirtd there are few ways of creating the virtual networking setup.

1 â Create a virtual network xml file. (The specification for the structure can be found at http://libvirt.org/formatnetwork.html). Then use the virsh command from the command line to create the virtual network. The xml file will tell libvirt to use a particular bridge and nat everything on that bridge. Additionally when vms connect to the bridge it will set up some iptables rules for you to do the forwarding from the bridge to your main network. This will require reverting your changes to the /etc/xen/xend-config.sxp

2 â Use virt-manager to configure the virtual network. This is a gui will allow you to setup the virtual networks without needed a predefined xml file. Where to go and what to click are highly dependent on the version being used as the interface has changed a lot over the fast couple years.

3 â Configure dnsmasq and iptables manually. Under the hood libvirt natâing really just sets up dnsmasq to provide dhcp, dns forwarding etc.. on the bridge interface as well as configures a few iptables rules to do the masquerading. You can configure this manually, although there is generally no need.

Â

~Matt

Â

From: xen-users-bounces@xxxxxxxxxxxxx [mailto:xen-users-bounces@xxxxxxxxxxxxx] On Behalf Of Xi Shen
Sent: Thursday, April 12, 2012 9:55 AM
To: xen-users@xxxxxxxxxxxxx
Subject: [Xen-users] domU NAT network cannot connect

Â

Hi,

Â

I followed this guide, and started myÂxend service with nat-network support:

(network-script network-nat)

(vif-script   vif-nat)

Then I started my domU with the following vif configure:

vif = ['ip=10.0.0.1' ]

Â

my domU is a win7 system, and I configured the network as:

ip: 10.0.0.1

netmask: 255.255.255.0

default gateway: 10.0.0.254

Â

dns: 8.8.8.8

Â

I added the iptables NAT rule:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

But my domU still cannot connect to the network.

Â

On my dom0, "ifconfig -a" returns as follow: (note: I started the vif8.0 IF by manual)

Â

eth0: flags=4098<BROADCAST,MULTICAST> Âmtu 1500

    ether 00:1e:37:d2:2b:da Âtxqueuelen 1000 Â(Ethernet)

    RX packets 0 Âbytes 0 (0.0 B)

    RX errors 0 Âdropped 0 Âoverruns 0 Âframe 0

    TX packets 0 Âbytes 0 (0.0 B)

    TX errors 0 Âdropped 0 overruns 0 Âcarrier 0 Âcollisions 0

    device interrupt 20 Âmemory 0xfe200000-fe220000 Â

Â

lo: flags=73<UP,LOOPBACK,RUNNING> Âmtu 16436

    inet 127.0.0.1 Ânetmask 255.0.0.0

    inet6 ::1 Âprefixlen 128 Âscopeid 0x10<host>

    loop Âtxqueuelen 0 Â(Local Loopback)

    RX packets 76637 Âbytes 513836706 (490.0 MiB)

    RX errors 0 Âdropped 0 Âoverruns 0 Âframe 0

    TX packets 76637 Âbytes 513836706 (490.0 MiB)

    TX errors 0 Âdropped 0 overruns 0 Âcarrier 0 Âcollisions 0

Â

tap8.0: flags=4098<BROADCAST,MULTICAST> Âmtu 1500

    ether 3e:9b:52:95:03:d3 Âtxqueuelen 500 Â(Ethernet)

    RX packets 2722 Âbytes 239183 (233.5 KiB)

    RX errors 0 Âdropped 0 Âoverruns 0 Âframe 0

    TX packets 0 Âbytes 0 (0.0 B)

    TX errors 0 Âdropped 0 overruns 0 Âcarrier 0 Âcollisions 0

Â

vif8.0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> Âmtu 1500

    inet 10.0.0.128 Ânetmask 255.255.255.255 Âbroadcast 0.0.0.0

    ether fe:ff:ff:ff:ff:ff Âtxqueuelen 32 Â(Ethernet)

    RX packets 0 Âbytes 0 (0.0 B)

    RX errors 0 Âdropped 0 Âoverruns 0 Âframe 0

    TX packets 0 Âbytes 0 (0.0 B)

    TX errors 0 Âdropped 0 overruns 0 Âcarrier 0 Âcollisions 0

Â

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> Âmtu 576

    inet 192.168.10.100 Ânetmask 255.255.255.0 Âbroadcast 255.255.255.255

    ether 00:1f:3c:27:e6:0c Âtxqueuelen 1000 Â(Ethernet)

    RX packets 11301 Âbytes 4467424 (4.2 MiB)

    RX errors 0 Âdropped 0 Âoverruns 0 Âframe 0

    TX packets 9829 Âbytes 1330447 (1.2 MiB)

    TX errors 0 Âdropped 0 overruns 0 Âcarrier 0 Âcollisions 0

Â

I am new to xen, so I might have missed some settings. Please be kind to point out.

Â

Thank you.



--
Regardsï
David Shen

http://about.me/davidshen
https://twitter.com/#!/davidshen84



--
Regardsï
David Shen

http://about.me/davidshen
https://twitter.com/#!/davidshen84
_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxx
http://lists.xen.org/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.