Network Printer access from work/guest network

Internet connection and home network is managed by an fritz.box and provides two ip subnets:

192.168.178.0/24 ("LAN")
192.168.179.0/24 ("Guest")

A OpenWRT Router is connected to booth networks on port 1 (lan) and port (4 guest) as client. It provides 2 additional wireless networks with dhcp as "work" networks:

192.168.1.0/24 ("work1")
192.168.2.0/24 ("work2")

these two networks have the fritz.box guest gate, 192.168.179.1 configured; allowing them to connect to the internet.

The motivation behind this is, to avoid any traffic between work1 and work2, as well any traffic between work and home. The devices should life in their bubbles.

Now i have an additional requirement: 2 network Printers are located in the lan 192.168.178.0/24 and i want to access them from work 1 network.
Any tipps/hints how to archive that? My best guess is to provide static routes on the openwrt router, but ony this seems not sufficent as a quick test shows; probably because the work networks do not have the openwrt as gate but the fritzbox; so i may need two routes and different gate in work networks? Or is mybe my approach wrong/to complex and there is a different or easier setup to realize my requierement?

Thanks and regards, Chris

Please run the following commands (copy-paste the whole block) and paste the output here, using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have

ubus call system board; \
uci export network; uci export wireless; \
uci export dhcp; uci export firewall; \
head -n -0 /etc/firewall.user; \
ip -4 addr ; ip -4 ro li tab all ; ip -4 ru; \
ls -l  /etc/resolv.* /tmp/resolv.* /tmp/resolv.*/* ; head -n -0 /etc/resolv.* /tmp/resolv.* /tmp/resolv.*/*

Following config allows me, at least to ping the printer on 192.168.178.91 from work_1 network but i have no further access (printing, web configuration interface). Any help is appreciated :slight_smile:

/tmp/resolv.* /tmp/resolv.*/*
{
        "kernel": "4.14.209",
        "hostname": "AC1750_OpenWrt",
        "system": "Qualcomm Atheros QCA956X ver 1 rev 0",
        "model": "TP-Link Archer C7 v5",
        "board_name": "tplink,archer-c7-v5",
        "release": {
                "distribution": "OpenWrt",
                "version": "19.07.5",
                "revision": "r11257-5090152ae3",
                "target": "ath79/generic",
                "description": "OpenWrt 19.07.5 r11257-5090152ae3"
        }
}
package network

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

config globals 'globals'
        option ula_prefix 'fd3d:8531:0fad::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0.1'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option gateway '192.168.178.1'
        option ipaddr '192.168.178.2'

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

config device 'wan_eth0_2_dev'
        option name 'eth0.2'
        option macaddr ''

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

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

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

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

config interface 'WORK_1'
        option proto 'static'
        option type 'bridge'
        list ipaddr '192.168.1.1/24'

config interface 'WORK_2'
        option proto 'static'
        option type 'bridge'
        option netmask '255.255.255.0'
        option ipaddr '192.168.2.1'

config interface 'WAN_GUEST'
        option proto 'dhcp'
        option ifname 'eth0.100'

config switch_vlan
        option device 'switch0'
        option vlan '4'
        option vid '100'
        option ports '0t 2t'

config route
        option target '192.168.178.91'
        option gateway '192.168.178.1'
        option netmask '255.255.255.255'
        option interface 'WORK_1'

package wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '36'
        option hwmode '11a'
        option path 'pci0000:00/0000:00:00.0'
        option htmode 'VHT80'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option key 'xxxx'
        option ssid 'Southside50'
        option encryption 'psk-mixed'

config wifi-device 'radio1'
        option type 'mac80211'
        option channel '11'
        option hwmode '11g'
        option path 'platform/ahb/18100000.wmac'
        option htmode 'HT20'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option key 'xxxx'
        option ssid 'Southside24'
        option encryption 'psk-mixed'

config wifi-iface 'wifinet2'
        option device 'radio0'
        option mode 'ap'
        option ssid 'vancouver'
        option encryption 'psk-mixed'
        option network 'WORK_1'
        option key 'xxxx'

config wifi-iface 'wifinet3'
        option ssid 'vancouver'
        option encryption 'psk-mixed'
        option device 'radio1'
        option mode 'ap'
        option network 'WORK_1'
        option key 'xxxx'

config wifi-iface 'wifinet4'
        option ssid 'toronto'
        option encryption 'psk-mixed'
        option device 'radio0'
        option mode 'ap'
        option network 'WORK_2'
        option key 'xxxx'

config wifi-iface 'wifinet5'
        option ssid 'toronto'
        option encryption 'psk-mixed'
        option device 'radio1'
        option mode 'ap'
        option network 'WORK_2'
        option key 'xxxx'

package 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'
        option nonwildcard '1'
        option localservice '1'

config dhcp 'lan'
        option interface 'lan'
        option ignore '1'

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_encoway'
        option interface 'work_encoway'
        option ignore '1'

config dhcp 'WORK_1'
        option start '100'
        option leasetime '12h'
        option limit '150'
        option interface 'WORK_1'
        option netmask '255.255.255.0'
        list dhcp_option '6,8.8.8.8,8.8.4.4'

config dhcp 'WORK_2'
        option start '100'
        option leasetime '12h'
        option limit '150'
        option interface 'WORK_2'
        list dhcp_option '6,8.8.8.8,8.8.4.4'

package firewall

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

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

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 zone
        option name 'wan_guest'
        option mtu_fix '1'
        option input 'REJECT'
        option forward 'REJECT'
        option masq '1'
        option output 'ACCEPT'
        option network 'WAN_GUEST'

config zone
        option input 'REJECT'
        option forward 'REJECT'
        option name 'work_1'
        option output 'ACCEPT'
        option network 'WORK_1'

config zone
        option input 'REJECT'
        option forward 'REJECT'
        option name 'work_2'
        option output 'ACCEPT'
        option network 'WORK_2'

config forwarding
        option dest 'wan_guest'
        option src 'work_1'

config forwarding
        option dest 'wan_guest'
        option src 'work_2'

config rule
        option src_port '68'
        option src 'work_1'
        option name 'Allow-Work_1-DHCPv4-Input'
        option target 'ACCEPT'
        option dest_port '67'
        list proto 'udp'
        option family 'ipv4'

config rule
        option src_port '68'
        option src 'work_2'
        option name 'Allow-Work_2-DHCPv4-Input'
        option family 'ipv4'
        option target 'ACCEPT'
        option dest_port '67'
        list proto 'udp'

config rule
        option src 'work_1'
        option target 'ACCEPT'
        option family 'ipv4'
        list dest_ip '192.168.178.91'
        list dest_ip '192.168.178.92'
        option dest 'lan'
        list proto 'all'
        option name 'Allow-Work_1-Printer-Input'

# This file is interpreted as shell script.
# Put your custom iptables rules here, they will
# be executed with each firewall (re-)start.

# Internal uci firewall chains are flushed and recreated on reload, so
# put custom rules into the root chains e.g. INPUT or FORWARD or into the
# special user chains, e.g. input_wan_rule or postrouting_lan_rule.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
6: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qle                                                                                   n 1000
    inet 192.168.178.2/24 brd 192.168.178.255 scope global br-lan
       valid_lft forever preferred_lft forever
8: eth0.100@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state                                                                                    UP qlen 1000
    inet 192.168.179.2/24 brd 192.168.179.255 scope global eth0.100
       valid_lft forever preferred_lft forever
18: br-WORK_1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue stat                                                                                   e UP qlen 1000
    inet 192.168.1.1/24 brd 192.168.1.255 scope global br-WORK_1
       valid_lft forever preferred_lft forever
19: br-WORK_2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state                                                                                    UP qlen 1000
    inet 192.168.2.1/24 brd 192.168.2.255 scope global br-WORK_2
       valid_lft forever preferred_lft forever
default via 192.168.179.1 dev eth0.100  src 192.168.179.2
192.168.1.0/24 dev br-WORK_1 scope link  src 192.168.1.1
192.168.2.0/24 dev br-WORK_2 scope link  src 192.168.2.1
192.168.178.0/24 dev br-lan scope link  src 192.168.178.2
192.168.179.0/24 dev eth0.100 scope link  src 192.168.179.2
broadcast 127.0.0.0 dev lo table local scope link  src 127.0.0.1
local 127.0.0.0/8 dev lo table local scope host  src 127.0.0.1
local 127.0.0.1 dev lo table local scope host  src 127.0.0.1
broadcast 127.255.255.255 dev lo table local scope link  src 127.0.0.1
broadcast 192.168.1.0 dev br-WORK_1 table local scope link  src 192.168.1.1
local 192.168.1.1 dev br-WORK_1 table local scope host  src 192.168.1.1
broadcast 192.168.1.255 dev br-WORK_1 table local scope link  src 192.168.1.                                                                                   1
broadcast 192.168.2.0 dev br-WORK_2 table local scope link  src 192.168.2.1
local 192.168.2.1 dev br-WORK_2 table local scope host  src 192.168.2.1
broadcast 192.168.2.255 dev br-WORK_2 table local scope link  src 192.168.2.1                                                                                   
broadcast 192.168.178.0 dev br-lan table local scope link  src 192.168.178.2
local 192.168.178.2 dev br-lan table local scope host  src 192.168.178.2
broadcast 192.168.178.255 dev br-lan table local scope link  src 192.168.178.2
broadcast 192.168.179.0 dev eth0.100 table local scope link  src 192.168.179.2
local 192.168.179.2 dev eth0.100 table local scope host  src 192.168.179.2
broadcast 192.168.179.255 dev eth0.100 table local scope link  src 192.168.179.2                                                                                   
0:      from all lookup local
32766:  from all lookup main
32767:  from all lookup default
ls: /tmp/resolv.*/*: No such file or directory
lrwxrwxrwx    1 root     root            16 Dec  6 08:31 /etc/resolv.conf -> /tm                                                                                   p/resolv.conf
-rw-r--r--    1 root     root            32 Jan 15 19:25 /tmp/resolv.conf
-rw-r--r--    1 root     root            47 Jan 15 19:25 /tmp/resolv.conf.auto
==> /etc/resolv.conf <==
search lan
nameserver 127.0.0.1

==> /tmp/resolv.conf <==
search lan
nameserver 127.0.0.1

==> /tmp/resolv.conf.auto <==
# Interface WAN_GUEST
nameserver 192.168.179.1
head: /tmp/resolv.*/*: No such file or directory

PS: I exchanged the two ports from fritzbox to a vlan trunk link to have only one (long) cable. This is reflected in the config but not in the original problem description.

Not needed, delete it.

Do you have a static route for 192.168.1.0/24 on the fritz?
I think you have asymetric routing here. Packet from work_1 network goes to OpenWrt then directly to printer. Printer however responds back via its gateway, the fritz, which should forward it to OpenWrt. But it may as well drop the packet as invalid.

@trendy you're correct the route is not needed, it only saves one hop. It works perfect without.
I already also had the static route on fritz already. In turned out it was a (beginner) firewall issue: route back & icmp rules were missing.

config rule
       option src 'lan'
       list src_ip '192.168.178.91'
       option dest 'work_1'
       option target 'ACCEPT'
       option name 'Allow-Work_1-Printer-HL-L5100DN-Reverse'

config rule
       option src 'lan'
       list src_ip '192.168.178.92'
       option dest 'work_1'
       option target 'ACCEPT'
       option name 'Allow-Work_1-Printer-HL-L5100DN-Reverse'

config rule
       option src 'work_1'
       option dest 'lan'
       list dest_ip '192.168.178.91'
       list dest_ip '192.168.178.92'
       option target 'ACCEPT'
       list proto 'icmp'
       option name 'Allow-Work_1-Printer-ICMP'

I can now open the webinterface from work_1 as well i can print documents from there :slight_smile:

1 Like

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