Configuration of multi-IP network segment of NAT network under Xen

  
        

The Xen virtual machine was recently played, and the bridge network was built with xen. Because my virtual machine was virtualized through the virtual box, I feel that something is wrong. Yesterday and today, I have been tossing for two days. I probably understand how to build a network of xen's NAT multi-IP network segment.
The situation is this: the laptop wireless network card network segment is 172.16.0.0/24, which can be routed through the Internet; VirtualBox virtualizes a Debian6 Xen virtual machine, which is connected to the wireless network segment through the VB bridge. Purpose: To set up a subnet segment A 10.1.1.0/24 and a subnet segment B 10.20.40.0/24 network segment inside the Xen virtual machine, the VPS inside xen is allocated in these two network segments. The host in subnet segment A virtualizes two network cards, one of which is connected to the 10.1.1.1 network card connected to Dom0, and the VPS host of subnet segment B has only one network card, which can only be connected to the GATEWAY of the subnet segment A host. On, you can't go online directly. In order, we first set the Dom0 settings /etc/xen/xend-config.sxp file

#(vif-script vif-bridge) #笔记从桥网络(vif-script vif-nat) #cancel Note, messy configuration does not need to write

Set Debian network /etc/network/interfaces

#Wireless network card auto eth1allow-hotplug eth1iface eth1 inet dhcpgateway 172.16.0.254dns-nameservers 8.8.4.4# Subnet Aauto dummy0iface dummy0 inet staticaddress 10.1.1.1netmask 255.255.255.0# Subnet Bauto dummy0:0iface dummy0:0 inet staticaddress 10.20.40.254netmask 255.255.255.0

Someone might think, subnet segment B Can it be set to dummy1? This was done before the barren, but unfortunately after restarting the network, the network card dummy1 could not get up. This way you can set Dom0 to make it a NAT server iptables -A POSTROUTING -s 10.1.1.0/24 -o eth1 -j MASQUERADE
Do not understand the principle of NAT, you can set the subnet A with a little reference to the article before the barren Host settings /etc/xen/xen-test0.cfg

vif = [ 'ip=10.1.1.11', 'ip=10.20.40.2' ]

Change the network configuration after setting this host, set IP. (The IP here is not the final IP of this host, the final IP needs to be set in the /etc/network/interfaces of the VPS.) Set the host setting of subnet B /etc/xen/xen-test1.cfg vif = [ 'ip =10.20.40.10' ]

Set up a specific network. You're done! Pay attention to the firewall configuration. One problem encountered before is that the subnet B host pings the subnet A host, the host of A replies B, but the host in B does not receive the reply packet. I thought it was a firewall problem. Later I found out that the vif in the /etc/xen/xen-test1.cfg file was set incorrectly. The network segment is 10.1.1.0/24. Errors like this can be solved by carefully looking at vifX.Y in ifconfig in Dom0. Note that the vif settings must be consistent with the actual network configuration of the virtual machine.

Copyright © Windows knowledge All Rights Reserved