I'm trying to setup a wireless network that routes all traffic to a local webserver (basically a hotel wifi login page).
Here's my dhcpd config:
$ cat /etc/dhcpd.conf
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
# option domain-name-servers 8.8.8.8;
range 192.168.1.2 192.168.1.254;
}
And here is how I configure iptables
:
ifconfig wlan0 up
ifconfig wlan0 192.168.1.1 netmask 255.255.255.0
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables -P FORWARD ACCEPT
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -A POSTROUTING -j MASQUERADE
echo "1" > /proc/sys/net/ipv4/ip_forward
systemctl restart dhcpd4
Devices connected to my network are properly redirected to 192.168.1.1:80
if they try to connect to any IP address, but all requests to domain names end up timing out.
How do I get domain names to point to my local server as well (I commented out that line in my dhcpd
config to see if that would help, but it didn't)? Or am I going about this the wrong way?
All help is appreciated.