DHCP

From Bashlinux
Jump to: navigation, search

How to send client-ID to DHCP Server

The Client ID could be type MAC address or ASCII, to setup a custom Client-ID to be sent to DHCP Server, create or edit the /etc/dhclient.conf file and add the client ID as follows.

  • If the client ID is type MAC addres, the place a 1 before the MAC addres likes:
send dhcp-client-identifier 1:xx:xx:xx:xx:xx:xx;
  • If you want an ASCII string, all you have to set is:
send dhcp-client-identifier "\0MYCLIENT-xxxxxxxx";
RFC 2131
The convention is 0 for ASCII and 1 for MAC address, but some times it doesn't work, so you might want to try without the leading zero if the example above doesn't work.

How to push a route from the DHCP server

Assuming the network that needs to be pushed is 11.22.33.00/24 and the traffic to that network needs to be routed via 10.20.30.100, then setup the following options on /etc/dhcp/dhcpd.conf

# RFC3442 routes
option rfc3442-classless-static-routes code 121 = array of integer 8;

# MS routes
option ms-classless-static-routes code 249 = array of integer 8;

# Bashlinux route
option rfc3442-classless-static-routes 24, 11,22,33, 10,20,30,100;

option ms-classless-static-routes 24, 11,22,33, 10,20,30,100;
RFC 3442
Definition of the DHCP option to configure the list of static routes on the client

For multiple routes, append a new line of "comma-separated" octects, and finish the line with semi-colon until all the routes and gateways are defined, ie:

# Bashlinux routes
option rfc3442-classless-static-routes 24, 11,22,33, 10,20,30,100
                                       ...
                                       22, 51,52,53 10,20,30,100;

option ms-classless-static-routes 24, 11,22,33, 10,20,30,100
                                      ...
                                  22, 51,52,53, 10,20,30,100;