2
I have built a portable router using a raspberry pi. My setup works, unless I connect to a hotspot that requires some kind of web based login.
After some investigation, I think I've tracked it down to a nameserver issue. I am using google's nameservers in my dhcpd.conf file below, this works without issues when i connect to hotspots that dont require an initial web login (home wifi, for example).
/etc/dhcp/dhcpd.conf
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 192.168.111.0 netmask 255.255.255.0 {
range 192.168.111.100 192.168.111.200;
option broadcast-address 192.168.111.255;
option routers 192.168.111.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name "local-network";
option domain-name-servers 8.8.8.8, 8.8.4.4;
}
Removing the option domain-name-servers
line makes all clients on wlan1
unable to resolve hostnames.
I am able to find the current hotspot's nameservers inside /etc/resolv.conf
/etc/resolv.conf
nameserver 212.27.40.241
nameserver 212.27.40.240
On my macbook, if I manually enter these nameservers in the network settings area, I am redirected to the hotspot's login page. Once logged in, I can remove these manual entries and it will revert to the name servers provided by my DHCP server.
However, this is not an optimal solution as the connected hotspot on wlan0
will change as I travel and I will have more than one device connected to wlan1
.
My goal here is to remove this last step. Is there some way to automate this on the raspberrypi server? Or am I approaching this in the wrong way? Is the best solution to always use the hotspot's default DNS? If so, how do i instruct dhcpd
to do so automatically?
Some info about my setup:
- 2 physical wifi adapters
wlan0
to connect to various hotspotswlan1
to create a local network.isc-dhcp-server
(dhcpd
) to distribute IP addresses overwlan1
hostapd
to create a local hotspot- NAT traversal using
iptables