On 22 Sie, 19:54, Stefan Monnier <monn...@iro.umontreal.ca> wrote:
> >> My laptop is configured in the usual way to get his IP and DNS servers
> >> by DHCP. But there's a cybercafé to which I like to go who's wireless
> >> router is configured to return as DNS server some overloaded servers, even
> >> though the AP is actually running a caching DNS proxy, so I sometimes
> >> manually override the DHCP info by adding 192.168.0.1 in /etc/resolv.conf
> >> just to speed up my connections.
>
> >> Now, doing it manually is a pain, so I was wondering if anybody has anidea
> >> how I could make this change automatically.
>
> >> I'm currently using wpa_supplicant + dhclient3 + resolvconf under Debian
> >> testing if that matters.
>
> >> I'm currently using an ugly hack:
>
> >> #!/bin/sh
>
> >> resolvconf=/etc/resolvconf/run/resolv.conf
> >> trigger_re="nameserver 4\\.2\\.2\\.2"
> >> extraline="nameserver 192.168.0.1"
>
> >> (rm "$resolvconf";
> >> sed "/$trigger_re/i# Next line added by $0\\n$extraline" \
> >> >"$resolvconf" ) <"$resolvconf"
>
> >> in /etc/resolconf/update-libc.d and was wondering if there's
> >> a cleaner solution.
>
> >> Stefan
> > In file /etc/dhclient.conf put
> > lease
> > {
> > interface "wlan0";
> > option domain-name-servers 153.19.250.100;
> > }
> > where 'wlan0' is your wireless interface name.
>
> But that will be used everywhere, right? I only want to change the
> resolv.conf when I use the machine at that one cybercafé. The 192.168.0.1
> address I need to use there doesn't even work in most other places (at
> home and at work, at least).
>
> Stefan
yes, you are right
as far as I know there is no possibility to do conditional changes
via dhclient.conf file, but on every dhcp update there can be some
script started, so check this way
MR
|