Variable NFS mounts / firewall rules.

Dan Pelleg daniel+bsd at pelleg.org
Tue Jul 1 05:46:21 PDT 2003


lewiz <purple at lewiz.info> writes:

> Hi,
> 
>   I have recently gotten around to setting up my laptop to play nicely
> with dhclient (not as easy as it sounds).  I have a number of questions
> I should like to ask.  I am going to provide a brief rundown of what I
> would like to know, and more detail, for those interested.
> 
> 1. Why does dhclient.conf ``ignore'' the media directive?
> 2. Can I have /different/ NFS mounts, depending on the IP address
>    dhclient assigns to me?
> 3. Can I have /different/ firewall rules, depending on the IP address
>    dhclient assigns to me?
> 
[ .... ]

No complete solution, just a few ideas to look into:

1. http://www.freebsd-support.de/misc/setnetparm/
I've never had the chance to use it myself, but it might help.

2. Use the automounter to mount NFS volumes on-demand. This way you will
not have to worry about mounting until you actually need to access the
volume. See amd(8).

3. ipfw supports the "me" keyword, to flexibly refer to your currently
assigned IP address.

4. Just in case it might help you, here is my /etc/dhclient-exit-hooks:

# nothing to do unless we're bound
case ${reason} in
    BOUND | RENEW | REBIND | REBOOT )
        if [ -n "${new_domain_name_servers}" ]; then
            if [ -z "${old_domain_name_servers}" ] || [ x${old_ip_address} != x{$new_ip_address} ]; then
                [ -x /etc/refresh-named ] && /etc/refresh-named ${new_domain_name_servers}
                [ -x /etc/set-time ] && /etc/set-time
            fi
        fi
        ;;
esac

 You should be able to restart your firewall and pass it an argument for
the ruleset in this way.

5. For more variables that are passed to dhclient-exit-hooks, see
dhclient-script(8).

5. You can further run ifconfig commands in /etc/start_if.<INTERFACE NAME>
(for example /etc/start_if.fxp0 ).

-- 

  Dan Pelleg


More information about the freebsd-questions mailing list