LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Using dnsmasq to pxeboot diskless nodes in a heterogeneous cluster (https://www.linuxquestions.org/questions/linux-networking-3/using-dnsmasq-to-pxeboot-diskless-nodes-in-a-heterogeneous-cluster-917419/)

Feynman 12-06-2011 11:39 AM

Using dnsmasq to pxeboot diskless nodes in a heterogeneous cluster
 
I have been trying to switch from dhcp + tftp-hpa to dnsmasq because I was under the impression that the configuration was more consolidated (less files to keep track of.)

This is becoming unexpectedly frustrating as I cannot even get my server to dish out an address to a client!

I was going to work my way up to the configuration I wanted by tweaking settings one at a time, but seeing as I cannot even get a dhcp server working, I might as well just describe what I am trying to accomplish and fish for some tips on how to configure it.

I would like to give my server/router/head node/master an address of:
192.168.1.1
I would like to map lists of mac addresses (are those case sensitive?) to lists of subnets like this:

i686 adresses ==> the i686 net
{
mac1,
mac2,
mac3
}

mad64 adresses ==> the amd64 net
{
mac4,
mac5,
mac6
}

Each subnet gets its own kernel and nfs root file system. The usual pxelinux.0 and pxelinux.cfg stuff is in a directory called /node and each architecture's root file system is in a directory in /node (e.g. /node/i686, /node/amd64, etc.)

eth0 is for the cluster (I will get an ethernet switch as soon as I get one node working using this method), eth1 is for my internet access on the head node.

That should take care of everything needed to set up the network.
So how would I set up dnsmasq to work with this? I have tried following 3 or 4 guides on diskless booting with gentoo, but without any response from the pxe client, I do not know how I am supposed to debug them.

Any help/advise of would be appreciated.

Doc CPU 12-06-2011 12:49 PM

Hi there,

Quote:

Originally Posted by Feynman (Post 4543587)
I have been trying to switch from dhcp + tftp-hpa to dnsmasq because I was under the impression that the configuration was more consolidated (less files to keep track of.)

I've never tried to use PXE boot, but I'm also using dnsmasq as a DHCP server and relaying DNS server (DNS server for local host names, relay for remote host names), and I also like it for the ease of configuration.

Quote:

Originally Posted by Feynman (Post 4543587)
This is becoming unexpectedly frustrating as I cannot even get my server to dish out an address to a client!

Huh? It shouldn't be that difficult. Let's look at a sample taken from my dnsmasq.conf ...
Code:

#visitors (hosts with an unknown MAC address) will get an IP in the following range
dhcp-range=192.168.123.32,192.168.123.63,12h

#residents (hosts with known and non-changing MAC addresses) are assigned individually:
dhcp-host=00:E0:4D:8A:C1:83, andy,192.168.123.1,24h
dhcp-host=00:11:09:70:35:3D, boris,192.168.123.2,24h
dhcp-host=00:21:97:78:D3:6B, chuck,192.168.123.3,24h

Basically, that's it. This ensures that the known resident hosts will always be assigned the same IP (and it doesn't even have to be in the dynamic range), and the host names (andy, boris, chuck) are automatically entered in the DNS part of dnsmasq.

Quote:

Originally Posted by Feynman (Post 4543587)
I would like to give my server/router/head node/master an address of:
192.168.1.1

What keeps you from doing just that?

Quote:

Originally Posted by Feynman (Post 4543587)
I would like to map lists of mac addresses (are those case sensitive?) to lists of subnets like this:

As to my understanding, dnsmasq doesn't care about subnets, it simply assigns IPs. At least I couldn't find anything in my config that defines a subnet mask, though I agree it would be reasonable to have it there in some way.

By the way, the question whether MAC addresses are case sensitive doesn't make sense. A MAC address is simply six bytes. There is no such thing as case-ness about it.

[X] Doc CPU

Feynman 12-06-2011 03:11 PM

Thanks for the reply. I will try deleting all my configuration files except the dnsmasq.conf file and using your sample file (modifying the mac addresses of course) later.
In the mean time....
Quote:

Huh? It shouldn't be that difficult.
Yes, that is about what I said on the third or fourth attempt on pxe booting.

Quote:

By the way, the question whether MAC addresses are case sensitive doesn't make sense.
I mean is there a difference between:
dhcp-host=00:E0:4D:8A:C1:83, andy,192.168.123.1,24h
and
dhcp-host=00:e0:4d:8a:c1:83, andy,192.168.123.1,24h
I am guessing by your reaction there is no difference (and that it is probably obvious enough to most that the question never even crossed their minds.)

Quote:

As to my understanding, dnsmasq doesn't care about subnets, it simply assigns IPs. At least I couldn't find anything in my config that defines a subnet mask, though I agree it would be reasonable to have it there in some way.
Interesting. That is good to keep in mind. The first thing that comes to mind is to use those "tag" things to assign subnets, but perhaps the best way is to ditch the use of subnets altogether and grouping machines by ethernet slots/switches. Then I would never have to worry about mac addresses!

I will have to look into how dnsmasq handles switches. For instance, if I put a switch on eth0 with 2 slots, and I put another switch on one of those slots:
eth0==>eth0:0,eth0:1
eth0:0==>eth0:0:0, eth0:0:1 (if you can follow my notation)

I might say:
everything coming through eth0:0 gets assigned an address on 192.168.2.0
everything everything coming from eth0:1 gets assigned an address on 192.168.3.0
Then I stick an amd64 computer on eth0:1 and two i686 computers on eth0:0:0, and eth0:0:1.

I admit I have not looked into this, so I will research that before I complain it does not work. But if you have any thoughts, please share.

I will update you on how that basic dnsmasq.conf works later. I am just hoping to see it get an address at this point.

Doc CPU 12-06-2011 03:55 PM

Hi there,

Quote:

Originally Posted by Feynman (Post 4543725)
Thanks for the reply. I will try deleting all my configuration files except the dnsmasq.conf file ...

you mean, you have other services with their config files that might interfere with dnsmasq? - 'cause dnsmasq has only this one config file, AFAIK.

Quote:

Originally Posted by Feynman (Post 4543725)
I mean is there a difference between:
dhcp-host=00:E0:4D:8A:C1:83, andy,192.168.123.1,24h
and
dhcp-host=00:e0:4d:8a:c1:83, andy,192.168.123.1,24h

Oh, you mean that. No,there isn't. I don't know any software at all that distinguishes upper- and lowercase letters in hexadecimal notation.


Quote:

Originally Posted by Feynman (Post 4543725)
Quote:

Originally Posted by Doc CPU (Post 4543623)
As to my understanding, dnsmasq doesn't care about subnets, it simply assigns IPs. At least I couldn't find anything in my config that defines a subnet mask, though I agree it would be reasonable to have it there in some way.

Interesting. That is good to keep in mind. The first thing that comes to mind is to use those "tag" things to assign subnets, but perhaps the best way is to ditch the use of subnets altogether and grouping machines by ethernet slots/switches. Then I would never have to worry about mac addresses!

Not exactly: Switches don't separate subnets, they don't even care about subnets. They transfer packets only according to the MAC address.

Quote:

Originally Posted by Feynman (Post 4543725)
I will have to look into how dnsmasq handles switches.

It doesn't. From the IP layer, switches are absolutely transparent, just as if they weren't there.

Quote:

Originally Posted by Feynman (Post 4543725)
For instance, if I put a switch on eth0 with 2 slots, and I put another switch on one of those slots:
eth0==>eth0:0,eth0:1
eth0:0==>eth0:0:0, eth0:0:1 (if you can follow my notation)

I think i can, but you're probably on a completely wrong track. Switches should be considered as passive, invisible devices. From IP, it's impossible to even notice if there is a switch or a direct connection.

Quote:

Originally Posted by Feynman (Post 4543725)
I might say:
everything coming through eth0:0 gets assigned an address on 192.168.2.0
everything everything coming from eth0:1 gets assigned an address on 192.168.3.0
Then I stick an amd64 computer on eth0:1 and two i686 computers on eth0:0:0, and eth0:0:1.

You're wrong. IP addresses are assigned to network interfaces, okay. A switch has multiple network interfaces, okay.
But you can take the term "switch" literally: It behaves like a mechanical switch for packets to a certain destination. A switch does not show up in any IP related consideration.

[X] Doc CPU

Feynman 12-06-2011 05:37 PM

Ok, so scratch the switching idea. Thanks for clarifying by the way. I will have to distinguish stuff with tags. I will have to come up with a way to associate mac addresses with tags, and keep separate dnsmasq configurations for each tag (e.g. i686, i386, amd64, etc.) Again, I will have to do some research on that.
Quote:

you mean, you have other services with their config files that might interfere with dnsmasq? - 'cause dnsmasq has only this one config file, AFAIK.
Well that is really nice to know. I knew dnsmasq had less config files, but I did not know for sure it was indeed limited to dnsmasq.conf. I have dhcpcd running as well so I can use eth1 for internet (with the /etc/dhcpcd.conf config file.) I also have my /etc/conf.d/net file configured, and I read I had to configure my resolv.conf file to use my computer as a name server and have it not get overridden. Can all of that be taken care of with dnsmasq.conf?

Do I still need to have net.eth1 and net.eth0 in rc-update's "default" (I think it was default) boot stage?

This config file stuff was another thing I wanted to double check. With dhcpd, syslinux, and tftp-hpa there were at least 5 or 6 files to configure. Ex:
dhcpd.conf
dhcpcd.conf
exports
in.tftpd (something like that)
net
pxelunx.default

Those are the ones I remember immediately. Amazingly, the whole setup actually worked. There was of course enormous redundancy in the config files, so I figured if dnsmasq is even remotely easier to configure it will save me a lot of maintenance in the long run.

So which files should I have to worry about maintaining in my case? Is it really all done through dnsmasq.conf? Is there a way I can specify which kernel and nfs root file system to use for each tag/subnet/architecture?

Doc CPU 12-07-2011 12:24 PM

Hi there.

Quote:

Originally Posted by Feynman (Post 4543803)
I knew dnsmasq had less config files, but I did not know for sure it was indeed limited to dnsmasq.conf. I have dhcpcd running as well so I can use eth1 for internet (with the /etc/dhcpcd.conf config file.) I also have my /etc/conf.d/net file configured, and I read I had to configure my resolv.conf file to use my computer as a name server and have it not get overridden. Can all of that be taken care of with dnsmasq.conf?

we should be more careful here: If you run a second DHCP daemon (dhcpd, as it reads) that responds to a different network interface, this has nothing to do with dnsmasq and its config - at least I hope that you cared for them not to respond to the same interface. It would mess things up.
And now that you mention resolv.conf, I remember that it does play a minor role, too - but only for the machine itself in the role as a client. You should actually put 127.0.0.1 as the first line in your resolv.conf, so that the machine asks "itself" (that is, its own DNS server) first before going public with a DNS query.

Quote:

Originally Posted by Feynman (Post 4543803)
Do I still need to have net.eth1 and net.eth0 in rc-update's "default" (I think it was default) boot stage?

I have no idea. But since dnsmasq doesn't interfere with the basic network interface setup, I guess the answer is yes.

Quote:

Originally Posted by Feynman (Post 4543803)
So which files should I have to worry about maintaining in my case? Is it really all done through dnsmasq.conf?

Ask yourself: What can dnsmasq do? It's a DHCP server, a relaying DNS server, and it can serve PXE boot files through TFTP. If you need something that is not covered by this short list, you'll have to use an extra service.

Quote:

Originally Posted by Feynman (Post 4543803)
Is there a way I can specify which kernel and nfs root file system to use for each tag/subnet/architecture?

As I said: I've never dug into PXE booting yet. For what I needed, the dnsmasq manpage published on the net was a good starting point - along with the sample configuration file included in the package that contains ample comments and notes.

[X] Doc CPU


All times are GMT -5. The time now is 01:42 PM.