dhclient
Configures network settings based on onformation provided by a DHCP server.
Slackware settings for classless static routes
Adapted from http://forums.opensuse.org/english/get-technical-help-here/network-internet/449539-classless-static-routes.html.
Create file /etc/dhclient.conf:
1 option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
2 option ms-classless-static-routes code 249 = array of unsigned integer 8;
3 also request rfc3442-classless-static-routes;
4 also request ms-classless-static-routes;
5
6 send host-name "hostx";
7 request subnet-mask, broadcast-address, time-offset, routers,
8 domain-name, host-name,
9 netbios-name-servers, netbios-scope, interface-mtu,
10 rfc3442-classless-static-routes, ntp-servers,domain-name-servers;
Create file /etc/dhclient-exit-hooks:
1 if [ "$new_rfc3442_classless_static_routes" != "" ]; then
2 if [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
3 rfc_routes=($new_rfc3442_classless_static_routes)
4
5 for(( i=0; i < ${#rfc_routes[@]}; )); do
6 net_length=${rfc_routes[$i]}
7
8 ((i++))
9
10 net_address=(0 0 0 0)
11 for(( j=0; j < $[$net_length / 8 + \
12 ($net_length % 8 ? 1 : 0)]; j++, i++)); do
13
14 net_address[$j]=${rfc_routes[$i]}
15 done
16
17 gateway=(0 0 0 0)
18 for (( j=0; j < 4; j++, i++ )); do
19 gateway[$j]=${rfc_routes[$i]}
20 done
21
22 old_IFS="$IFS"
23 IFS='.'
24 if [ "$net_length" == "32" ]; then
25 /sbin/route add -host "${net_address[*]}" gw "${gateway[*]}"
26 else
27 /sbin/route add -net "${net_address[*]}/$net_length" gw "${gateway[*]}"
28 fi
29 IFS="$old_IFS"
30
31 done
32 fi
33 fi
To get and apply settings run dhclient eth0 -v for eth0 interface.
Add to /etc/rc.d/rc.local
/sbin/dhclient -v eth0