diff options
Diffstat (limited to 'modules.d/40network/dhclient-script')
-rwxr-xr-x | modules.d/40network/dhclient-script | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/modules.d/40network/dhclient-script b/modules.d/40network/dhclient-script new file mode 100755 index 00000000..dc2d9e1e --- /dev/null +++ b/modules.d/40network/dhclient-script @@ -0,0 +1,27 @@ +#!/bin/sh +# very simple dhclient-script. All it cares about is bringing the interface +# up, and it does not even try to do anything else. + +case $reason in + PREINIT) ip link set "$interface" up ;; + BOUND) ipopts="$new_ip_address" + [ "$new_interface_mtu" ] && ip link set $interface mtu $new_interface_mtu + [ "$new_subnet_mask" ] && ipopts="$ipopts/$new_subnet_mask" + [ "$new_broadcast_address" ] && ipopts="$ipopts broadcast $new_broadcast_address" + ip addr add $ipopts dev $interface + [ "$new_routers" ] && ip route add default via ${new_routers%%,*} dev $interface + [ "$new_domain_name" ] && echo "domain $new_domain_name" > /etc/resolv.conf + if [ "$new_domain_search" ]; then + echo "search $new_domain_search" |sed 's/,//g' >> /etc/resolv.conf + elif [ "$new_domain_name" ]; then + echo "search $new_domain_name" >> /etc/resolv.conf + fi + for s in $new_domain_name_servers; do + echo "nameserver $s" >> /etc/resolv.conf + done + set |grep -e '^new_[a-z_]=' |while read line; do + echo "${line%%=*}=\'${line#*=}\'">>/net.$interface.dhcpopts + done + >/net.$interface.up ;; + *) ;; +esac |