Package: dhcp3-client Version: 3.1.1-6+lenny3 Severity: wishlist
'man dhclient-script' invites a bug report of this nature: In general, customizations specific to a particular computer should be done in the /etc/dhcp3/dhclient.conf file. If you find that you can't make such a customization without customizing /etc/dhcp3/dhclient.conf or using the enter and exit hooks, please submit a bug report. dhclient should support a way of specifying the routing table it should use. For instance, I have two ISPs both configured with dhcp. I want the one on eth1 to use a different routing table so I can have most traffic go through eth0, except replies to inbound connections on eth1. The work around I use requires an exit hook, and hence this bug report: /etc/dhcp3/dhclient-exit-hooks.d/local-routing-table: ---cut--- # File: local-routing-table # Purpose: modify dhclient-script to allow a routing table to be specified # for each interface # Author: Brett Wuth # Created: 2009-08-30 # # Initials: # BCW - Brett Wuth # @#[ContactWuth: # Phone: +1 403 235-2972 # E-mail: supp...@castrov.cuug.ab.ca, w...@acm.org] # # HISTORY: # $Log:$ # @#[BasedOnTemplate: sh version 18] # Debugging: # exec 2>/tmp/"$(basename $0).$(date "+%F_%T")_$$.log" # set -x -v # Implementation: # # Allow dhclient-script to set up routing table for $interface using # "ifconfig" and "route" commands. Once it's set up, move the routes # for $interface from the default routing table to our $routing_table. # # Alternatively we could change dhclient-script to use "ip" commands # because "ifconfig" and "route" don't have an option to specify the # routing table. Then add an to dhclient.conf to specify the table. # # Or we could do the above but define an "ip" function in # dhclient-enter-hooks.d which added the table to the command. # # Or we could leave dhclient-script unedited and define "ifconfig" # and "route" in dhclient-enter-hooks.d to reimplement the commands # via "ip". # # This approach was approach was chosen because it's the smallest # change. function routing_table_of_interface { # Name the routing table that should be used for $interface. # Empty string if default routing table. case "${interface:-}" in ( "eth1" ) echo TELUS ;; esac } routing_table="$(routing_table_of_interface)" function routing_table_move { # If we have a routing table, move any routes created in the default # routing table into ours. if [ -n "$routing_table" ]; then # copy the routing to our table ip route show | grep "$interface" \ | sed -e "s/.*/ip route add & table ${routing_table}/" | sh # delete it from the default table ip route show | grep "$interface" \ | sed -e 's/.*/ip route del &/' | sh fi } routing_table_move ---cut--- This approach cannot be use as "post-up" in /etc/network/interfaces because those scripts are not called when dhclient does a renewal. To complete the solution, I do use the interfaces to enable the routing table: ---cut--- # The secondary network interface -- telus ADSL allow-hotplug eth1 iface eth1 inet dhcp # /etc/dhcp3/dhclient-exit-hooks.d/local-routing-table # will cause configuration to be in routing table TELUS. # # Use routing table TELUS for replies from eth1 while that interface # is up. post-up ip rule add from $(ifconfig eth1 | grep "inet addr:" | sed -e 's/.*inet addr://' -e 's/ .*//') table TELUS pre-down ip rule del from $(ifconfig eth1 | grep "inet addr:" | sed -e 's/.*inet addr://' -e 's/ .*//') table TELUS ---cut--- -- System Information: Debian Release: 5.0.2 APT prefers stable APT policy: (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.22-14-generic (SMP w/2 CPU cores) Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages dhcp3-client depends on: ii debconf [debconf-2.0] 1.5.24 Debian configuration management sy ii debianutils 2.30 Miscellaneous utilities specific t ii dhcp3-common 3.1.1-6+lenny3 common files used by all the dhcp3 ii libc6 2.7-18 GNU C Library: Shared libraries dhcp3-client recommends no packages. Versions of packages dhcp3-client suggests: pn avahi-autoipd <none> (no description available) ii resolvconf 1.42 name server information handler -- debconf information: dhcp3-client/dhclient-needs-restarting: dhcp3-client/dhclient-script_moved: -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org