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

[Xen-devel] [PATCH] get dhcp working for network-nat



Has anybody successfully used the network-nat script, with or without
dhcp?  The existing documentation around this is fairly poor, so if
youâve seen it âjust workâ (or with only some minor tweaks),
please reply.  Iâm not much of a networking expert so I hope my
time on this wasnât wasted.

Assuming not (and supported by google search), perhaps network-nat has
been broken for a long time?  It certainly has not received much love
recently and many mailing list queries about it have gone unanswered.

That said, here's my situation:

Due to limited IP availability in my office, I wanted to configure a
setup where dom0 works like an inexpensive home router (e.g. Linksys,
Dlink,Belkin), which does NAT and DHCP for multiple attached (or
wireless) machines.  So I need dom0 to both provide network address
translation and to serve dhcp addresses to any VM's launched on it.

It appears that this should work.  Or maybe once upon a time it did
work.  But I had to muck around with it quite a bit and spin a patch
to get it work with 3.1 bits.  And since the key files haven't been
changed in over a year, though untested as of yet, I think the same
patch and process is necessary on xen-unstable.

Also, this is tested on a RHEL5-based dom0.  I don't know much about
dhcp implementations on other distros and haven't tried this recipe
on other distros, so your mileage may vary but please do provide
feedback if this patch will fail on your favorite distro.

Here's the process I used:
1) Install the dhcp package using your distro's tools
2) Modify /etc/dhcpd.conf to look like this:
        ddns-update-style interim;
        deny client-updates;
        authoratitive;
        option domain-name-servers dnsip1 dnsip2;
        option ntp-servers ntpip1 ntpip2 ntpip3;
        default-lease-time 14400;
        max-lease-time 172800;
        subnet 10.0.0.0 netmask 255.0.0.0 {}
   where dnsip1 etc are of course all real IPv4 addresses.
   The ntp-servers line can be removed if desired.
3) Apply the attached patch.  The patch applies to
   xen-3.1-testing.hg and you will need to apply
   it to the same files in /etc/xen/scripts.
4) Modify /etc/xen/xend-config.sxp
   - comment the line (network-script network-bridge)
   - comment the line (vif-script vif-bridge)
   - uncomment (network-script network-nat)
   - uncomment (vif-script vif-nat)
5) Modify /etc/xen/scripts/network-nat
   - change dhcp=${dhcp:-no} from no to yes
6) Modify /etc/xen/scripts/vif-nat
   - change dhcp=${dhcp:-no} from no to yes
7) Restart xend (probably "service xend restart")
8) Launch a domain for which the primary interface
   is configured for dhcp (pv and pvhvm tested so
   far; don't know if hvm works yet)
   - change name= in your config file to something
     useful first as this will be the machine name
     given to it by dhcp
9) Try out networking in your VM!

This patch could use some tweaking... the code to add
and remove vifâs from /etc/sysconfig/dhcpd needs some
work.  But I thought it would be good to get others
trying this version out.  If the patch doesnât work
on your distro, this is a good place to tweak.

Finally, Iâm not sure if nat without dhcp is used much.
Iâd like to propose that the default for dhcp (see steps
5 and 6) be changed from no to yes.

Thanks for any feedback!
Dan

Attachment: dhcp.patch
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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