Trouble setting up vlan

Hi all!

I'm trying to setup vlans in my network to isolate wifi clients (f.e. work, guest, etc.)

I have one main router and one access point (both with openwrt). I first want to configure the main router, and will attack the wifi access point later on.

The issue I'm facing right now is that I can connect my laptop to a wired untagged (vlan 10) port but cannot access the internet. I suspect a firewall issue because if I ssh to the router I can then ping google.com. It's either a firewall issue or some kind of bridging that I'm missing...

Here are my config files:

/etc/config/network

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd9a:60d4:dc94::/48'

config device
	option name 'br-personal'
	option type 'bridge'
	list ports 'eth0.10'

config interface 'personal'
	option device 'br-personal'
	option proto 'static'
	option ipaddr '192.168.10.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config device
	option name 'eth0.2'
	option macaddr '64:70:02:de:bb:dd'

config interface 'wan'
	option device 'eth0.2'
	option proto 'dhcp'

config interface 'wan6'
	option device 'eth0.2'
	option proto 'dhcpv6'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

# LAN (port 1)
config switch_vlan
	option device 'switch0'
	option vlan '10'
	option ports '0t 2 3t 4'
	option description 'Personal'
	option vid '10'

# LAN (port 2)
config switch_vlan
	option device 'switch0'
	option vlan '20'
	option ports '0t 3t'
	option description 'Work'
	option vid '20'

# LAN (port 3)
config switch_vlan
	option device 'switch0'
	option vlan '30'
	option ports '0t 3t 5'
	option description 'IoT'
	option vid '30'

# LAN (port 4)
config switch_vlan
	option device 'switch0'
	option vlan '40'
	option ports '0t 3t'
	option description 'Guest'
	option vid '40'

# WAN
config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '0t 1'
	option description 'WAN'
	option vid '2'

config device
	option name 'br-work'
	option type 'bridge'
	list ports 'eth0.20'

config interface 'work'
	option device 'br-work'
	option proto 'static'
	option ipaddr '192.168.20.1'
	option netmask '255.255.255.0'

config device
	option name 'br-iot'
	option type 'bridge'
	list ports 'eth0.30'

config interface 'iot'
	option device 'br-iot'
	option proto 'static'
	option ipaddr '192.168.30.1'
	option netmask '255.255.255.0'

config device
	option name 'br-guest'
	option type 'bridge'
	list ports 'eth0.40'

config interface 'guest'
	option device 'br-guest'
	option proto 'static'
	option ipaddr '192.168.40.1'
	option netmask '255.255.255.0'
/etc/config/firewall
config defaults
	option syn_flood	1
	option input		REJECT
	option output		ACCEPT
	option forward		REJECT
# Uncomment this line to disable ipv6 rules
#	option disable_ipv6	1

config zone
	option name		lan
	list   network		'lan'
	option input		ACCEPT
	option output		ACCEPT
	option forward		ACCEPT

config zone
	option name		wan
	list   network		'wan'
	list   network		'wan6'
	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

config rule
	option name		Allow-IGMP
	option src		wan
	option proto		igmp
	option family		ipv4
	option target		ACCEPT

# Allow DHCPv6 replies
# see https://github.com/openwrt/openwrt/issues/5066
config rule
	option name		Allow-DHCPv6
	option src		wan
	option proto		udp
	option dest_port	546
	option family		ipv6
	option target		ACCEPT

config rule
	option name		Allow-MLD
	option src		wan
	option proto		icmp
	option src_ip		fe80::/10
	list icmp_type		'130/0'
	list icmp_type		'131/0'
	list icmp_type		'132/0'
	list icmp_type		'143/0'
	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		echo-reply
	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
	list icmp_type		router-advertisement
	list icmp_type		neighbour-advertisement
	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		echo-reply
	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

config rule
	option name		Allow-IPSec-ESP
	option src		wan
	option dest		lan
	option proto		esp
	option target		ACCEPT

config rule
	option name		Allow-ISAKMP
	option src		wan
	option dest		lan
	option dest_port	500
	option proto		udp
	option target		ACCEPT

config zone
	option name		lan
	list   network		'lan'
	list   network		'work'
	option input		ACCEPT
	option output		ACCEPT
	option forward		ACCEPT

config zone
	option name		lan
	list   network		'lan'
	list   network		'iot'
	option input		ACCEPT
	option output		ACCEPT
	option forward		ACCEPT

config zone
	option name		lan
	list   network		'lan'
	list   network		'guest'
	option input		ACCEPT
	option output		ACCEPT
	option forward		ACCEPT


### 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

# port redirect of remapped ssh port (22001) on wan
#config redirect
#	option src		wan
#	option src_dport	22001
#	option dest		lan
#	option dest_port	22
#	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
/etc/config/dhcp

config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option cachesize '1000'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option localservice '1'
	option ednspacket_max '1232'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'
	option dhcpv6 'server'
	option ra 'server'
	list ra_flags 'managed-config'
	list ra_flags 'other-config'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

config dhcp 'work'
	option interface 'work'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'

config dhcp 'iot'
	option interface 'iot'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'

config dhcp 'guest'
	option interface 'guest'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'

config dhcp 'personal'
	option interface 'personal'
	option start '100'
	option limit '150'
	option leasetime '12h'

Any help appreciated.

Thank you!!

Start here: https://www.youtube.com/watch?v=qeuZqRqH-ug

If you need more, recommend the two older videos which are linked on the dumb accesspoint wiki page.

Thanks.

I've re-watched the video, but it's not really helping. The issue is that he talks about openwrt 19 and 21, while I have 23. His device uses DSA on 21, but mine seems to be stuck with swconfig. So the config on my device might look a bit more like his example on openwrt 19, but then the UI is different enough between the video and what I see that I am not sure if his steps apply to my setup or not...

I'm sure my setup is really close to working because I can ssh to the router and once there I can ping the internet...

FWIW, I've followed what was suggested here: Question about isolating a wireless client - #9 by psherman, ie modifying the /etc/config/network file manually to get different vlans.

Remove this (but not the original lan zone at the beginning of the file). Here is an example of how to set up the firewall for the work network. Multiply it for the rest.

config zone
        option name 'work'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        list network 'work'

config rule        
        option name 'WORK-DHCP-DNS'
	    option src 'work'
        option dest_port '53 67'
	    option proto 'udp'
	    option target 'ACCEPT'

config forwarding
        option dest 'wan'
        option src 'work'

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.