Hi,
I have configured a router on a stick with two VLANs and am trying to get the ACLs working.
My configuration is simple. I use an OpenWRT 25.05 router and a managed switch that supports VLAN.
On both I used Port 1 as trunk.
VLAN1 = LAN IP (192.168.1.2)
VLAN20 = DMZ IP (192.168.20.1)
PC IP on LAN = 192.168.1.20
Server IP on DMZ = 192.168.20.10
Router configuration
IP: 192.168.1.2
Mask: 255.255.255.0
VLAN ID | Description | CPU(eth0) | CPU(eth1) | LAN 1 (trunk) | LAN 2 (PC) | WAN |
---|---|---|---|---|---|---|
1 | LAN | off | tagged | untagged | untagged | off |
7 | ISP | tagged | off | off | off | tagged |
20 | DMZ | off | tagged | tagged | off | off |
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 ''
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth1.1'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.1.2'
option netmask '255.255.255.0'
option ip6assign '60'
option gateway '192.168.1.1'
config interface 'wan'
option device 'eth0.7'
option proto 'pppoe'
option username ''
option password ''
option ipv6 'auto'
option disabled '1'
option auto '0'
config interface 'wan6'
option device 'eth0.7'
option proto 'pppoe'
option username ''
option password ''
option ipv6 'auto'
option disabled '1'
option auto '0'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option ports '1 2 3 4 6t'
option vid '1'
option description 'LAN'
config switch_vlan
option device 'switch0'
option vlan '3'
option vid '20'
option description 'DMZ'
option ports '4t 6t'
config interface 'dmz'
option proto 'static'
option device 'br-dmz'
option ipaddr '192.168.20.1'
option netmask '255.255.255.0'
config route
option interface 'lan'
option target '192.168.20.10/24'
option disabled '1'
Switch configuration
IP: 192.168.1.3
Mask: 255.255.255.0
Gateway: 192.168.1.2
VLAN ID | Description | LAN 1 (trunk) | ... | LAN 9 Server (DMZ) |
---|---|---|---|---|
1 | LAN | untagged | ||
20 | DMZ | tagged | untagged |
Firewall configuration
config defaults
option input 'REJECT'
option output 'ACCEPT'
option forward 'DROP'
option synflood_protect '1'
option drop_invalid '1'
config zone
option name 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
list network 'lan'
config forwarding
option src 'lan'
option dest 'wan'
config rule
option name 'Allow-DHCP-Renew'
option src 'wan'
option proto 'udp'
option dest_port '68'
option target 'ACCEPT'
option family 'ipv4'
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'
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'
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'
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 'DMZ'
option input 'REJECT'
option output 'ACCEPT'
option forward 'DROP'
option log '1'
list network 'dmz'
config rule
option name 'DMZ-DNS'
option src 'DMZ'
option dest_port '53'
option target 'ACCEPT'
config forwarding
option src 'DMZ'
option dest 'wan'
config zone
option name 'wan'
option input 'DROP'
option output 'ACCEPT'
option forward 'DROP'
option masq '1'
option mtu_fix '1'
list network 'wan'
list network 'wan6'
config rule
option name 'LAN-NAS-Ping'
list proto 'icmp'
option src 'lan'
option dest 'DMZ'
option target 'ACCEPT'
list src_ip '192.168.1.20'
list dest_ip '192.168.20.10'
option family 'ipv4'
config rule
option name 'LAN-NAS-HTTPS'
list proto 'tcp'
option src 'lan'
option dest 'DMZ'
option target 'ACCEPT'
option family 'ipv4'
option dest_port '443'
config rule
option name 'LAN-NAS-ssh'
list proto 'tcp'
option src 'lan'
list src_ip '192.168.1.20'
option dest 'DMZ'
list dest_ip '192.168.20.10'
option dest_port '22'
option target 'ACCEPT'
Problem description
I managed to setup the ACL for a ping from LAN to DMZ.
My problem is that when I try to connect either via ssh or https from LAN to DMZ, I get debug1: connect to address 192.168.20.10 port 22: Network is unreachable.
What I can do is to setup a static route from LAN to DMZ or from my PC to the Server, but then the ACLs are not needed anymore and I have full access to the Server.
I would like to be able to limit the access on IP and Port level.
Does anyone have a clue what I am doing wrong? I checked multiple sources but couldn't find the reason, why the ACLs are not working.
Thank you!