Allow access to host:port in OfficeVlan from GuestVlan help

I am using OpenWrt at the small hotel I run. I have split my router's ethernet ports with vlan into 'lan' and 'GuestLAN'. Lan uses 192.168.0.0/24 and GuestLAN uses 192.168.254.0/24.

Everything works great but I need to know how to allow GuestLAN to route to and allow access to 192.168.0.3 ports 80 and 443.

Generally I'm pretty tech-savvy and can figure this stuff out, but this one is confusing me. Do I need a static route? A rule? Do I need general forwarding access, that is pinched off except to the host/ports I need?

Any help would be much appreciated.

No.

No.

Yes, a single firewall rule should be enough.

1 Like

Can someone help me what what that rule would look like?

I only want to open 192.168.0.3 80 & 443 to GuestLAN.

config defaults
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option synflood_protect '1'

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

config zone
        option name 'GuestLAN'
        option input 'ACCEPT'
        option network 'GuestLAN'
        option output 'ACCEPT'
        option forward 'ACCEPT'

config zone
        option name 'wan'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
        option network 'wan wan6'

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 src_ip 'fc00::/6'
        option dest_ip 'fc00::/6'
        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 include
        option path '/etc/firewall.user'

config forwarding
        option dest 'wan'
        option src 'GuestLAN'

config redirect
        option dest_port '22'
        option src 'lan'
        option src_dport '8022'
        option target 'DNAT'
        option dest_ip '192.168.254.210'
        option dest 'GuestLAN'
        option name '8022gaston'

config redirect
        option dest_port '80'
        option src 'wan'
        option name 'www'
        option src_dport '80'
        option target 'DNAT'
        option dest_ip '192.168.0.3'
        option dest 'lan'

config redirect
        option dest_port '443'
        option src 'wan'
        option name 'www-ssl'
        option src_dport '443'
        option target 'DNAT'
        option dest_ip '192.168.0.3'
        option dest 'lan'

config redirect
        option dest_port '25'
        option src 'wan'
        option name 'smtp'
        option src_dport '25'
        option target 'DNAT'
        option dest_ip '192.168.0.3'
        option dest 'lan'

config redirect
        option dest_port '465'
        option src 'wan'
        option name 'smtps'
        option src_dport '465'
        option target 'DNAT'
        option dest_ip '192.168.0.3'
        option dest 'lan'

config redirect
        option dest_port '587'
        option src 'wan'
        option name 'smtp-starttls'
        option src_dport '587'
        option target 'DNAT'
        option dest_ip '192.168.0.3'
        option dest 'lan'

It should look like that:

uci set firewall.guest_to_lan="rule"
uci set firewall.guest_to_lan.name="Allow-WEB-from-Guest"
uci set firewall.guest_to_lan.src="GuestLAN"
uci set firewall.guest_to_lan.dest="lan"
uci set firewall.guest_to_lan.dest_port="80 443"
uci set firewall.guest_to_lan.proto="tcp"
uci set firewall.guest_to_lan.dest_ip='192.168.0.3'
uci set firewall.guest_to_lan.famyly="ipv4"
uci set firewall.guest_to_lan.target="ACCEPT"
uci commit firewall
fw3 restart
1 Like

That worked! Thank-you!!

The rule is pretty darn simple... I have no idea why I couldn't figure that out...

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