Re: Support for adding /etc/hosts entries

On Sat, 2008-08-02 at 00:01 +0000, Brett Johnson wrote:
> On Fri, 2008-08-01 at 10:13 +0200, Michal Sawicz wrote:
> > It would be great if it would be possible to add hosts entries
> > to /etc/hosts based on the network we're connected to.
> I currently do this with a script in /etc/dhcp3/dhclient-exit-hooks.d/
> It just checks for the appropriate domain name in "$new_domain_name",
> and copies/links an appropriate /etc/hosts file based on that.
> Not saying that a GUI to do it via NM wouldn't be nice, just that it's
> possible now w/out it.

You should be aware that current NM svn sources will send both dhclient
and dhcpcd a different script to run than the default, so your
enter/exit hooks won't get called.

Also, that looks like a Debian/Ubuntu derived script as the stock
dhclient script only allows one exit hook and one enter hook ;)

dhcpcd ships with a NM hook script which just calls the script NM would
have run, but NM needs to be patched NOT to override the script. Maybe
we should make this into a compile option? It could be something like
this in practice:

dhcpcd -BKL -C mtu -C resolv.conf -C ntp.conf eth0

That tells dhcpcd not to run the hook scripts to configure MTU, DNS or
NTP as NM likes to do so itself, but allow any other and user defined
hook scripts to run.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]