Опции rfc3442-classless-static-routes 121 и ms-classless-static-routes 249
Устанавливаем права на выполнение
chmod a+x /etc/dhclient-exit-hooks
--- etc --- dhclient-exit-hooks --- dhclient.conf
#!/bin/sh if [ x"$new_rfc3442_classless_static_routes" != x"" ]; then if [ x"$reason" == x"BOUND" -o x"$reason" == x"REBOOT" ]; then rfc_routes=($new_rfc3442_classless_static_routes) for(( i=0; i < ${#rfc_routes[@]}; )); do net_length=${rfc_routes[$i]} ((i++)) net_address=(0 0 0 0) for(( j=0; j < $[$net_length / 8 + ($net_length % 8 ? 1 : 0)]; j++, i++)); do net_address[$j]=${rfc_routes[$i]} done gateway=(0 0 0 0) for (( j=0; j < 4; j++, i++ )); do gateway[$j]=${rfc_routes[$i]} done old_IFS="$IFS" IFS='.' if [[ -n "$(which ip 2>/dev/null)" ]]; then ip route replace "${net_address[*]}/$net_length" via "${gateway[*]}" else if [[ -n "$(which route 2>/dev/null)" ]]; then if [ x"$net_length" == x"32" ]; then route add -host "${net_address[*]}" gw "${gateway[*]}" else route add -net "${net_address[*]}/$net_length" gw "${gateway[*]}" fi fi fi IFS="$old_IFS" done fi fi if [ x"$new_ms_classless_static_routes" != x"" ]; then if [ x"$reason" == x"BOUND" -o x"$reason" == x"REBOOT" ]; then ms_routes=($new_ms_classless_static_routes) for(( i=0; i < ${#ms_routes[@]}; )); do net_length=${ms_routes[$i]} ((i++)) net_address=(0 0 0 0) for(( j=0; j < $[$net_length / 8 + ($net_length % 8 ? 1 : 0)]; j++, i++)); do net_address[$j]=${ms_routes[$i]} done gateway=(0 0 0 0) for (( j=0; j < 4; j++, i++ )); do gateway[$j]=${ms_routes[$i]} done old_IFS="$IFS" IFS='.' if [[ -n "$(which ip 2>/dev/null)" ]]; then ip route replace "${net_address[*]}/$net_length" via "${gateway[*]}" else if [[ -n "$(which route 2>/dev/null)" ]]; then if [ x"$net_length" == x"32" ]; then route add -host "${net_address[*]}" gw "${gateway[*]}" else route add -net "${net_address[*]}/$net_length" gw "${gateway[*]}" fi fi fi IFS="$old_IFS" done fi fi
timeout 60; retry 60; reboot 10; select-timeout 5; initial-interval 2; send host-name "my.pc"; option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; option ms-classless-static-routes code 249 = array of unsigned integer 8; request subnet-mask, broadcast-address, time-offset, routers, static-routes, domain-name-servers, interface-mtu, rfc3442-classless-static-routes, ms-classless-static-routes;