3
4
I want to isolate guests connecting to my Wi-Fi to the 10.0.0.x subnet, while giving them Internet access. The OpenWrt router is at 192.168.1.48 ("wifi" interface has 10.0.0.1) and my gateway is at 192.168.1.254. How would I go around setting up OpenWrt so that guests access the Internet through my gateway but remain confined to the 10. subnet?
I've read the guest-wlan recipe over at the OpenWrt wiki, but I can't figure out how to do what I want to do. So far I've managed to set up a DHCP server for guests that gives out 10.x addresses.
I've also noticed that I can resolve hostnames from a laptop in the 10.x network. From dnsmasq logs I can see it knows there's a nameserver at 192.168.1.254 (because it looked in /etc/resolv.conf I assume). But how and why are the packets crossing the firewall?
I'm running Backfire 10.03.1 on a WRT54GL. The gateway is a Linksys E4200. This is my OpenWrt configuration at the moment:
/etc/config/dhcp
config 'dnsmasq' option 'domainneeded' '1' option 'boguspriv' '1' option 'filterwin2k' '0' option 'localise_queries' '1' option 'rebind_protection' '1' option 'rebind_localhost' '1' option 'local' '/lan/' option 'domain' 'lan' option 'expandhosts' '1' option 'nonegcache' '0' option 'authoritative' '1' option 'readethers' '1' option 'leasefile' '/tmp/dhcp.leases' option 'resolvfile' '/tmp/resolv.conf.auto' config 'dhcp' 'lan' option 'interface' 'lan' option 'ignore' '1' config 'dhcp' 'wan' option 'interface' 'wan' option 'ignore' '1' config 'dhcp' option 'start' '100' option 'leasetime' '12h' option 'limit' '150' option 'interface' 'wifi'
/etc/config/network
config 'interface' 'loopback' option 'ifname' 'lo' option 'proto' 'static' option 'ipaddr' '127.0.0.1' option 'netmask' '255.0.0.0' config 'interface' 'lan' option 'ifname' 'eth0.0' option 'proto' 'static' option 'netmask' '255.255.255.0' option 'ipaddr' '192.168.1.48' option 'gateway' '192.168.1.254' option 'dns' '192.168.1.254' config 'interface' 'wan' option 'ifname' 'eth0.1' option 'proto' 'dhcp' config 'interface' 'wifi' option 'proto' 'static' option 'ipaddr' '10.0.0.1' option 'netmask' '255.255.255.0'
/etc/config/wireless
config 'wifi-device' 'wl0' option 'type' 'broadcom' option 'channel' '11' config 'wifi-iface' option 'device' 'wl0' option 'mode' 'ap' option 'ssid' 'OpenWrt' option 'encryption' 'none' option 'network' 'wifi'
/etc/config/firewall (haven't changed it from defaults)
config defaults option syn_flood 1 option input ACCEPT option output ACCEPT option forward REJECT # Uncomment this line to disable ipv6 rules # option disable_ipv6 1 config zone option name lan option network 'lan' option input ACCEPT option output ACCEPT option forward REJECT config zone option name wan option network 'wan' option input REJECT option output ACCEPT option forward REJECT option masq 1 option mtu_fix 1 config forwarding option src lan option dest wan # We need to accept udp packets on port 68, # see https://dev.openwrt.org/ticket/4108 config rule option name Allow-DHCP-Renew option src wan option proto udp option dest_port 68 option target ACCEPT option family ipv4 # Allow IPv4 ping config rule option name Allow-Ping option src wan option proto icmp option icmp_type echo-request option family ipv4 option target ACCEPT # Allow DHCPv6 replies # see https://dev.openwrt.org/ticket/10381 config rule option name Allow-DHCPv6 option src wan option proto udp option src_ip fe80::/10 option src_port 547 option dest_ip fe80::/10 option dest_port 546 option family ipv6 option target ACCEPT # Allow essential incoming IPv6 ICMP traffic config rule option name Allow-ICMPv6-Input option src wan option proto icmp list icmp_type echo-request list icmp_type destination-unreachable list icmp_type packet-too-big list icmp_type time-exceeded list icmp_type bad-header list icmp_type unknown-header-type list icmp_type router-solicitation list icmp_type neighbour-solicitation option limit 1000/sec option family ipv6 option target ACCEPT # Allow essential forwarded IPv6 ICMP traffic config rule option name Allow-ICMPv6-Forward option src wan option dest * option proto icmp list icmp_type echo-request list icmp_type destination-unreachable list icmp_type packet-too-big list icmp_type time-exceeded list icmp_type bad-header list icmp_type unknown-header-type option limit 1000/sec option family ipv6 option target ACCEPT # include a file with users custom iptables rules config include option path /etc/firewall.user ### EXAMPLE CONFIG SECTIONS # do not allow a specific ip to access wan #config rule # option src lan # option src_ip 192.168.45.2 # option dest wan # option proto tcp # option target REJECT # block a specific mac on wan #config rule # option dest wan # option src_mac 00:11:22:33:44:66 # option target REJECT # block incoming ICMP traffic on a zone #config rule # option src lan # option proto ICMP # option target DROP # port redirect port coming in on wan to lan #config redirect # option src wan # option src_dport 80 # option dest lan # option dest_ip 192.168.16.235 # option dest_port 80 # option proto tcp ### FULL CONFIG SECTIONS #config rule # option src lan # option src_ip 192.168.45.2 # option src_mac 00:11:22:33:44:55 # option src_port 80 # option dest wan # option dest_ip 194.25.2.129 # option dest_port 120 # option proto tcp # option target REJECT #config redirect # option src lan # option src_ip 192.168.45.2 # option src_mac 00:11:22:33:44:55 # option src_port 1024 # option src_dport 80 # option dest_ip 194.25.2.129 # option dest_port 120 # option proto tcp
I realize this is more of a general networking question than a OpenWrt question, but I thought I should mention OpenWrt. I have the slightest idea that making this work involves some iptables black magic, but I can't figure out the correct incantations, so I wanted to ask for help.
Thanks in advance!
I think it may be done with double NAT as well. Tried this a while ago with a couple of OpenWrt devices: http://wiki.openwrt.org/doc/recipes/routedclient - same idea, except using a main lan address as wan address for the guest network, cable connection instead of WiFi link, and blocking all the traffic on the guest AP except the traffic that flows to the gateway and comes from the gateway. Should fix the manual address configuration issue. I'll try it and come back with another answer.
– SaltwaterC – 2013-07-16T06:36:27.170