#!/bin/sh case $reason in PREINIT) # Bring the interface up, if necessary ifconfig $interface 0.0.0.0 up ;; BOUND|RENEW|REBIND|REBOOT) if [ "$old_host_name" != "$new_host_name" ] || \ [ "$old_ip_address" != "$new_ip_address" ] || \ [ "$old_subnet_mask" != "$new_subnet_mask" ] || \ [ "$old_broadcast_address" != "$new_broadcast_address" ] || \ [ "$old_routers" != "$new_routers" ] || \ [ "$old_domain_name_servers" != "$new_domain_name_servers" ]; then # Configure the interface ifconfig $interface inet $new_ip_address netmask $new_subnet_mask broadcast $new_broadcast_address up # Set default gateway if [ -n "$new_routers" ]; then route flush route add default $new_routers fi # Set hostname if [ -n "$new_host_name" ]; then hostname $new_host_name fi # Create a new /etc/resolv.conf if [ -n "$new_domain_name_servers" ]; then echo "# Generated automatically by dhclient" >/etc/resolv.conf for dns in $new_domain_name_servers; do echo "nameserver $dns" >>/etc/resolv.conf done fi fi ;; EXPIRE|FAIL|RELEASE) if [ $old_expiry -gt 946713600 ]; then ifconfig $interface down fi ;; esac