|
|
|
|
|
|
|
|
|
|
xen-users
Re: [Xen-users] Help me to set up network (routes)
On Fri, May 8, 2009 at 7:44 PM, AlannY <m@xxxxxxxxx> wrote:
> AlannY wrote:
>>
>
> Ok. I found more better solution. It's called Bridging+NAT.
That's pretty much what libvirt does. The part that concerns NAT anyway :)
>
> So, a small tutorial.
>
> 1) With methods of your OS create a dummy (empty) bridge: br0 (setup its
> options).
In libvirt, by default it's virbr0
> 2) Set up IP for bridge. (For example, 10.0.2.1)
192.168.122.1/24 on virbr0
> 2) Edit /etc/xen/xend-config.sxp:
> (network-script /bin/true)
> (vif-script vif-bridge)
> 3) Edit your VM configuration file:
> vif = [ 'bridge=br0' ] # it's the bridge, which we created in step 1
> 4) Load DomU. Change DomU network configuration:
> IP: Any IP in network specied in step 2 (for example, 10.0.2.2)
> Mask: Mask from step 2 (for example, 255.255.255.0)
> Gateway: Bridge from step 1 IP (for example, 10.0.2.1)
You have two "step 2" :D
> 5) In Dom0 apply 2 iptables rules (kernel must be compiled with NAT
> support):
> iptables -t nat -A POSTROUTING -s <IP FROM STEP 4> -j MASQUERADE
> iptables -t nat -A POSTROUTING -d <IP FROM STEP 4> -o <BRIDGE FROM STEP
Libvirt uses dnsmasq to add dhcp and DNS for NAT-ed domUs
/usr/sbin/dnsmasq --keep-in-foreground --strict-order
--bind-interfaces --pid-file --conf-file --listen-address
192.168.122.1 --except-interface lo
--dhcp-leasefile=/var/lib/libvirt/dhcp-default.leases --dhcp-range
192.168.122.2,192.168.122.254
> 1>
> 6) Start DomU
>
> That's all. Dom0 accessed from DomU via Bridge IP (step 2). DomU accessed
> from Dom0 via DomU IP (STEP 4).
>
> Everything must work at this point ;-)
>
Glad to hear it!
Regards,
Fajar
_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
|
|
|
|
|