I'm trying to set up a guest network for my IOT devices, and failing miserably
I have a main RT68U connected via WAN to the internet. I'm also running Diversion on this router. A second RT68U is configured as AP, and its WAN port is connected port 4 of the main RT68U. I only need to have a guest network (2.4 and 5GHz) on the AP, due to signal strength and the positioning of the IOT devices
I'm trying to use this https://www.snbforums.com/threads/expand-the-guest-network-to-two-merlin-routers.61231 as a guide.
On the AP, from the UI, I add guest networks for 2.4 and 5GHz, then from SSH I do the following (for now as individual commands, will use custom scripts once everything works)
That seems to work and create a vlan101, and the vlan cannot communicate with anything for now.
Then on the main RT68U, I add the following lines to a newly created /jffs/configs/dnsmasq.conf.add
and reboot. That allows dnsmasq to provide ip addresses to the vlan.
I create the same vlan101 on the main router, tied to lan port 4
And finally use iptables to ensure packets flow as expected (which I think it's the part where I have a problem). I get really confused by iptables and the author of that thread also seemed unsure
I can connect to the guest lan on the AP, and I get an IP address in the right range (so I know that the dnsmasq and part of the iptables commands work). But then I have no connectivity at all. It looks as if the vlan101 on the AP is not properly working.
I tried setting a vlan101 just on the main router, using all the same commands (just adding wl0.1 and wl1.1 where appropriate), and from that router everything works. So it looks as if the concept of creating a vlan, bridge and iptables works when everything is just on a single device
I think I have a problem where the vlan101 traffic on port 4 of the main router (which is the traffic from the AP) is not properly redirected. Clients connected to the guest network of the AP get an IP address, but cannot ping anything on the internet, nor access any internet resource.
Can someone please provide pointers to help me troubleshoot the problem? I don't expect to have the scripts fixed for me, but I'm way out of my depth here...
I have a main RT68U connected via WAN to the internet. I'm also running Diversion on this router. A second RT68U is configured as AP, and its WAN port is connected port 4 of the main RT68U. I only need to have a guest network (2.4 and 5GHz) on the AP, due to signal strength and the positioning of the IOT devices
I'm trying to use this https://www.snbforums.com/threads/expand-the-guest-network-to-two-merlin-routers.61231 as a guide.
On the AP, from the UI, I add guest networks for 2.4 and 5GHz, then from SSH I do the following (for now as individual commands, will use custom scripts once everything works)
Code:
robocfg vlan 101 ports "0t 5t"
vconfig add eth0 101
ifconfig vlan101 up
brctl addbr br1
brctl delif br0 wl0.1
brctl delif br0 wl1.1
brctl addif br1 vlan101
brctl addif br1 wl0.1
brctl addif br1 wl1.1
ifconfig br1 up
nvram set lan_ifnames="vlan1 eth1 eth2"
nvram set lan_ifname="br0"
nvram set lan1_ifnames="vlan101 wl0.1 wl1.1"
nvram set lan1_ifname="br1"
nvram commit
killall eapd
eapd
That seems to work and create a vlan101, and the vlan cannot communicate with anything for now.
Then on the main RT68U, I add the following lines to a newly created /jffs/configs/dnsmasq.conf.add
Code:
interface=br1
dhcp-range=br1,192.168.20.2,192.168.20.254,255.255.255.0,86400s
dhcp-option=br1,3,192.168.20.1
dhcp-option=br1,6,192.168.20.1
and reboot. That allows dnsmasq to provide ip addresses to the vlan.
I create the same vlan101 on the main router, tied to lan port 4
Code:
robocfg vlan 101 ports "4t 5t"
vconfig add eth0 101
ifconfig vlan101 up
brctl addbr br1
brctl stp br1 on
brctl addif br1 vlan101
ifconfig br1 192.168.20.1 netmask 255.255.255.0
ifconfig br1 up
nvram set lan_ifnames="vlan1 eth1 eth2"
nvram set lan_ifname="br0"
nvram set lan1_ifnames="vlan101"
nvram set lan1_ifname="br1"
nvram commit
And finally use iptables to ensure packets flow as expected (which I think it's the part where I have a problem). I get really confused by iptables and the author of that thread also seemed unsure
Code:
# Allow BR1 to access WAN
iptables -D FORWARD -i br1 -m state --state NEW -j ACCEPT >/dev/null 2>&1
iptables -I FORWARD -i br1 -m state --state NEW -j ACCEPT
# Prevent BR1 from accessing BR0 and vice versa
iptables -D FORWARD -i br1 -o br0 -m state --state NEW -j DROP >/dev/null 2>&1
iptables -I FORWARD -i br1 -o br0 -m state --state NEW -j DROP
iptables -D FORWARD -i br0 -o br1 -m state --state NEW -j DROP >/dev/null 2>&1
iptables -I FORWARD -i br0 -o br1 -m state --state NEW -j DROP
# I don t know what it does.
iptables -D INPUT -i br1 -m state --state NEW -j DROP >/dev/null 2>&1
iptables -I INPUT -i br1 -m state --state NEW -j DROP
# Allow DNSMASQ to distribute IP addresses for br1.
iptables -D INPUT -i br1 -p tcp --dport 53 -j ACCEPT >/dev/null 2>&1
iptables -I INPUT -i br1 -p tcp --dport 53 -j ACCEPT
# Allow DNSMASQ to distribute IP addresses for br1.
iptables -D INPUT -i br1 -p udp -m multiport --dport 53,67 -j ACCEPT >/dev/null 2>&1
iptables -I INPUT -i br1 -p udp -m multiport --dport 53,67 -j ACCEPT
sleep 1
killall eapd
eapd
I can connect to the guest lan on the AP, and I get an IP address in the right range (so I know that the dnsmasq and part of the iptables commands work). But then I have no connectivity at all. It looks as if the vlan101 on the AP is not properly working.
I tried setting a vlan101 just on the main router, using all the same commands (just adding wl0.1 and wl1.1 where appropriate), and from that router everything works. So it looks as if the concept of creating a vlan, bridge and iptables works when everything is just on a single device
I think I have a problem where the vlan101 traffic on port 4 of the main router (which is the traffic from the AP) is not properly redirected. Clients connected to the guest network of the AP get an IP address, but cannot ping anything on the internet, nor access any internet resource.
Can someone please provide pointers to help me troubleshoot the problem? I don't expect to have the scripts fixed for me, but I'm way out of my depth here...