Hello all,
I'm testing a home LAN server inside Virtualbox - figured it'd be easier to build (and fix) things inside a virtual sandbox first, and then migrate over to a physical install once I have most of the kinks worked out. The host OS is Windows Vista; the guest OS will be various Linux distributions for education/entertainment purposes.
First, a little explanation on the 'lay of the land':
The first virtual machine is a gateway/router box running CentOS 5.4. The 'outward' facing NIC is eth0, and it picks up an IP through the NAT interface provided by Virtualbox. That part seems to be working fine at the moment. The VM has CentOS 5.4 installed, downloaded and installed updates, and can browse the web, etc. The 'internal' network adapter (eth1) is connected to a virtual LAN 'intnet' that is otherwise not accessible from the 'outside' world at this point. It has a static IP assigned (10.0.0.1/255.255.255.0), and dnsmasq is running.
Here is the contents of /etc/dnsmasq.conf:
domain-needed bogus-priv filterwin2k except-interface=eth0 dhcp-range=10.0.0.50,10.0.0.100,1h dhcp-host=asmodean dhcp-host=demandred dhcp-host=lanfear dhcp-authoritative conf-dir=/etc/dnsmasq.d
and here is the contents of /etc/hosts:
127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6
10.0.0.1 rahvin.local rahvin 10.0.0.2 asmodean.local asmodean 10.0.0.3 demandred.local demandred 10.0.0.4 lanfear.local lanfear
What I *want* to happen is to be able to give a fixed dhcp lease to a client that sends a particular name from /etc/hosts - that way I just have to maintain /etc/hosts on the gateway/router box for local DNS, and I don't have to fiddle around finding and recording and entering the MAC addresses for each network card on each machine (actually easier on a 'virtual' lan than in real life, but still a minor PITA). I got the idea from this clause in the original dnsmasq.conf file:
# Enable the address given for "judge" in /etc/hosts # to be given to a machine presenting the name "judge" when # it asks for a DHCP lease. #dhcp-host=judge
The specific problem I'm having is that of the virtual 'clients', only one of them is getting assigned an IP address from the list in /etc/hosts. 'asmodean', running Ubuntu 9.10 gets its IP address of 10.0.0.2 as planned. The other two, demandred (running F12+LXDE) and lanfear (running Debian 5.03 Lenny), get randomly assinged IP addresses from the pool defined in dnsmasq.conf (10.0.0.50-10.0.0.100) like one would normally expect for a *dynamically* assigned lease. Except I wanted them to get fixed leases based on /etc/hosts.
I've looked at most everything I can think of on both hosts... it doesn't seem to much matter if I set the hostname to 'demandred.local' or just 'demandred'. I'm not sure how to tell if the clients are sending that information in their requests?
Any other ideas or suggestions? I realize the problem may not be strictly with the CentOS box, but any help would be greatly appreciated.
TIA,
Monte
The specific problem I'm having is that of the virtual 'clients', only one of them is getting assigned an IP address from the list in /etc/hosts. 'asmodean', running Ubuntu 9.10 gets its IP address of 10.0.0.2 as planned. The other two, demandred (running F12+LXDE) and lanfear (running Debian 5.03 Lenny), get randomly assinged IP addresses from the pool defined in dnsmasq.conf (10.0.0.50-10.0.0.100) like one would normally expect for a *dynamically* assigned lease. Except I wanted them to get fixed leases based on /etc/hosts.
Monte,
You need to ensure that the clients are sending the hostname in the dhcp request. Your dnsmasq logs will show it, usually in /var/log/messages, and if you want you can enable extra logging for dnsmasq to show u exactly what options are being sent by the clients.
If i remember correctly Debian doesn't but i would have thought Fedora would have by default.
You can do it by adding "send host-name <insert hostname here>" to the dhclient.conf.
Alternatively, you can just assign the static IP using the client MAC in the dnsmasq.conf. You will have the MAC from the dnsmasq logs so you can just copy and paste.
Ben
On 12/13/2009 2:51 PM, Ben wrote:
You need to ensure that the clients are sending the hostname in the dhcp request. Your dnsmasq logs will show it, usually in /var/log/messages, and if you want you can enable extra logging for dnsmasq to show u exactly what options are being sent by the clients.
Excellent idea. I've been looking @ /var/log/messages which has been very helpful, but perhaps some more detail would help.
If i remember correctly Debian doesn't but i would have thought Fedora would have by default.
You can do it by adding "send host-name<insert hostname here>" to the dhclient.conf.
I'll dig around a bit on the clients and see if I can figure it out; if not I can always ask on the respective lists for specifics on each.
Alternatively, you can just assign the static IP using the client MAC in the dnsmasq.conf. You will have the MAC from the dnsmasq logs so you can just copy and paste.
Yep, thats how I have normally in the past implemented fixed leases on things like a wifi router, etc. I got kind of excited at the notion of *not* having to find the MAC addresses for everything, and then a little disappointed when it didn't quite work out. Being as its for a virtual LAN there isn't a whole lot of urgency if I don't get it working today or tomorrow (or else I'd have already entered the MAC addresses ;) ) so I'm going to try ironing out this way first.
Thanks,
Monte
A minor update for anyone still watching ;)
You can do it by adding "send host-name<insert hostname here>" to the dhclient.conf.
I'll dig around a bit on the clients and see if I can figure it out; if not I can always ask on the respective lists for specifics on each.
That worked fairly painlessly on the Debian client... but F12 is still a thorn in my side.
Alternatively, you can just assign the static IP using the client MAC in the dnsmasq.conf. You will have the MAC from the dnsmasq logs so you can just copy and paste.
For now thats what I'm having to do. Apparently everyone on Fedora is busy using Network Manager (gui tool that invades/usurps the traditional networking config files), and no one knows where the dang config file went to. In Ubuntu 9.10 Network Manager worked fine (there is a spot to enter the host name when requesting a dhcp lease), but in F12 its not. But nobody wants to hear *that*...