pbda
Posts: 2
Joined: Tue Apr 26, 2016 11:56 am

[solved] Getting NFS root server by DHCP

Tue Apr 26, 2016 12:22 pm

Hello,

I have Raspberries that use Raspbian Jessie with an NFS root. I can give root server address with a parameter in /boot/cmdline.txt file. But I would like to get root server address by DHCP. It seems to be possible because I get at boot something like:

Code: Select all

IP-Config: Got DHCP answer from 10.10.20.1 , my address is 172.16.100.150
IP-Config: Complete:
     device=eth0, hwaddr=b8:27:eb:61:b2:ffb, ipaddr=172.16.100.150, mask=255.255.255.0, gw=172.16.100.254
     host=10.10.20.1, domain=, nis-domain=(none)
     bootserver=172.16.100.2, rootserver=0.0.0.0, rootpath=/RPI
     nameserver0=172.16.100.2
I can specify rootpath with root-path parameter in my ISC DHCP Server but I don't know what option to use to specify rootserver.

Is it possible to get root server adress by DHCP ?
Last edited by pbda on Wed Apr 27, 2016 6:52 am, edited 1 time in total.

mfa298
Posts: 1386
Joined: Tue Apr 22, 2014 11:18 am

Re: Getting NFS root server by DHCP

Tue Apr 26, 2016 11:27 pm

It's been a long time since I tried doing nfs root with linux, however I'm sure you can specify the server to use via DHCP.

The options that come to mind are either next-server (normally used for the tftp server for the initial loader) or you might be able to specify "host:/RPI" in the root-path option. You may want to put the options inside a suitable if statement (particularly if you need next-server).

The dhcpd.conf and dhcp-options man pages can be very informative, and whilst it's fairly old now "The DHCP Handbook" by Droms and Lemon is a useful reference.

User avatar
CarlRJ
Posts: 598
Joined: Thu Feb 20, 2014 4:00 am
Location: San Diego, California

Re: Getting NFS root server by DHCP

Tue Apr 26, 2016 11:52 pm

Sorry, I'm a little rusty with ISC DHCP... poking at the source, you may be able to just add in the root server address to the root-path like this:

Code: Select all

option root‐path "172.16.100.2:/RPI";
If not, I think you can add something like this to declare the format of the necessary options (if these aren't already set up by the server - I don't recall):

Code: Select all

option space SUNW;
option SUNW.root-server-ip-address code 2 = ip-address;
option SUNW.root-server-hostname code 3 = text;
option SUNW.root-path code 4 = text;
And then use something like this in the declaration for each of your clients:

Code: Select all

option SUNW.root-server-ip-address 172.16.100.2;
option SUNW.root-path "/RPI";

pbda
Posts: 2
Joined: Tue Apr 26, 2016 11:56 am

Re: Getting NFS root server by DHCP

Wed Apr 27, 2016 6:52 am

Thank you for your advice. Using

Code: Select all

option root‐path "172.16.100.2:/RPI";
is working fine.

Return to “Advanced users”