View Single Post
Posts: 175 | Thanked: 210 times | Joined on Mar 2013
#6
After some trials and trying to make things work I realized why /etc/openvpn/maemo-update-resolvconf bypasses dnsmasq and puts the DNS server(s) in /etc/resolv.conf.

What I've tried is to create the file /var/run/resolv.conf.tap0 which contains the DNS server of the remote network. Upon creation (from script), dnsmasq sees it has been created and uses the nameserver[1]. Afterwards it seems to query only that server for every request[2].
When disconnecting from the vpn, /var/run/resolv.conf.tap0 is deleted and dnsmasq is aware of it, but still tries to contact the vpn DNS server[3], which is obviously not reachable anymore. So DNS is broken and I can't connect to anywhere by name (it works if I specify directly the ip).

The problem seems to be that when dnsmasq becomes aware of a new /var/run/resolv.con.$interface file, it doesn't care anymore about the other one(s). In my case when /var/run/resolv.conf.tap0 is taken into account, /var/run/resolv.conf.gprs becomes like non existent for dnsmasq. So the question is how to make dnsmasq aware of this file again.

From the file /var/maemo-dhcp.d/50_ipv4_network_setup I can see that the command kill -SIGHUP `pidof dnsmasq` is used to "reload" dnsmasq, so I used the same command in my script but it doesn't seem to force dnsmasq to check the resolv-files (it only reloads /etc/hosts).
I could force restart dnsmasq but I would rather not to if I just could make it aware of the /var/run/resolv.conf.gprs file once /var/run/resolv.conf.tap0 is deleted.

[1]
Code:
reading /var/run/resolv.conf.tap0
using nameserver 192.168.120.1#53
read /etc/hosts - 1 addresses
[2]
Code:
query[A] domain.com from 127.0.0.1
forwarded domain.com to 192.168.120.1
reply domain.com is x.x.x.x
[3]
Code:
failed to access /var/run/resolv.conf.tap0: No such file or directory
query[A] anotherdomain.com from 127.0.0.1
forwarded anotherdomain.com to 192.168.120.1
query[A] anotherdomain.com from 127.0.0.1
forwarded anotherdomain.com to 192.168.120.1