A couple of days ago, pbr stopped working all of a sudden. After a few hours of unsuccessful troubleshooting, I've decided to flash a clean snapshot and install the latest pbr 1.1.7-61 on it. I've chosen snapshot because rc1 lacks some important packages.
Once again, I'm having troubles with domain-based policies. IP-based policy works, yet domain-based policy doesn't. Can't identify a problem and need help.
ubus call system board
{
"kernel": "6.6.63",
"hostname": "OpenWrt",
"system": "ARMv8 Processor rev 0",
"model": "FriendlyElec NanoPi R6S",
"board_name": "friendlyarm,nanopi-r6s",
"rootfs_type": "squashfs",
"release": {
"distribution": "OpenWrt",
"version": "SNAPSHOT",
"revision": "r28243-41f7322853",
"target": "rockchip/armv8",
"description": "OpenWrt SNAPSHOT r28243-41f7322853",
"builddate": "1733167822"
}
}
uci export dhcp
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 cachesize '1000'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
option nonwildcard '1'
option localservice '1'
option ednspacket_max '1232'
option filter_aaaa '0'
option filter_a '0'
list server '/.themoviedb.org/9.9.9.9'
list server '/.tmdb.org/9.9.9.9'
list server '/tmdb-image-prod.b-cdn.net/9.9.9.9'
config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
option dhcpv4 'server'
option dhcpv6 'server'
option ra 'server'
option ra_slaac '1'
list ra_flags 'managed-config'
list ra_flags 'other-config'
option force '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'
uci export firewall
package firewall
config defaults
option syn_flood '1'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
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'
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 'singbox'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option masq '1'
list network 'sb0'
list network 'sb1'
config forwarding
option src 'lan'
option dest 'singbox'
config include 'pbr'
option fw4_compatible '1'
option type 'script'
option path '/usr/share/pbr/firewall.include'
uci export network
package 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 'fd3f:3d54:ab27::/48'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'
list ports 'eth2'
config device
option name 'eth0'
option macaddr 'xx:xx:xx:xx:xx:xx'
config device
option name 'eth2'
option macaddr 'xx:xx:xx:xx:xx:xx'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '10.10.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
config device
option name 'eth1'
option macaddr 'xx:xx:xx:xx:xx:xx'
config interface 'wan'
option device 'eth1'
option proto 'dhcp'
option peerdns '0'
option dns '1.1.1.1 8.8.8.8 9.9.9.9'
config interface 'wan6'
option device 'eth1'
option proto 'dhcpv6'
config interface 'sb0'
option proto 'none'
option device 'sb0'
config interface 'sb1'
option proto 'none'
option device 'sb1'
uci export pbr
package pbr
config pbr 'config'
option enabled '1'
option verbosity '2'
option strict_enforcement '1'
option resolver_set 'dnsmasq.nftset'
list resolver_instance '*'
option ipv6_enabled '0'
list ignored_interface 'vpnserver'
option boot_timeout '30'
option rule_create_option 'add'
option procd_boot_delay '0'
option procd_reload_delay '1'
option webui_show_ignore_target '0'
option nft_rule_counter '1'
option nft_set_auto_merge '1'
option nft_set_counter '1'
option nft_set_flags_interval '1'
option nft_set_flags_timeout '0'
option nft_set_policy 'performance'
list webui_supported_protocol 'all'
list webui_supported_protocol 'tcp'
list webui_supported_protocol 'udp'
list webui_supported_protocol 'tcp udp'
list webui_supported_protocol 'icmp'
config include
option path '/usr/share/pbr/pbr.user.aws'
option enabled '0'
config include
option path '/usr/share/pbr/pbr.user.netflix'
option enabled '0'
config dns_policy
option name 'Redirect Local IP DNS'
option src_addr '192.168.1.5'
option dest_dns '1.1.1.1'
option enabled '0'
config policy
option name 'DOMAIN'
option dest_addr 'myip.is'
option interface 'sb0'
config policy
option name 'ADDRESS'
option dest_addr '89.36.33.33'
option interface 'sb0'
option enabled '0'
/etc/init.d/pbr status
pbr - environment
pbr 1.1.7-61 running on OpenWrt SNAPSHOT.
Dnsmasq version 2.90 Copyright (c) 2000-2024 Simon Kelley
Compile time options: IPv6 GNU-getopt no-DBus UBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP conntrack no-ipset nftset auth cryptohash DNSSEC no-ID loop-detect inotify dumpfile
pbr fw4 nft file: /usr/share/nftables.d/ruleset-post/30-pbr.nft
add chain inet fw4 pbr_mark_0x010000
add rule inet fw4 pbr_mark_0x010000 counter mark set mark and 0xff00ffff xor 0x010000
add rule inet fw4 pbr_mark_0x010000 return
add chain inet fw4 pbr_mark_0x020000
add rule inet fw4 pbr_mark_0x020000 counter mark set mark and 0xff00ffff xor 0x020000
add rule inet fw4 pbr_mark_0x020000 return
add chain inet fw4 pbr_mark_0x030000
add rule inet fw4 pbr_mark_0x030000 counter mark set mark and 0xff00ffff xor 0x030000
add rule inet fw4 pbr_mark_0x030000 return
add set inet fw4 pbr_sb0_4_dst_ip_cfg056ff5 { type ipv4_addr; auto-merge; counter; flags interval; policy performance; comment "DOMAIN";}
add rule inet fw4 pbr_prerouting ip daddr @pbr_sb0_4_dst_ip_cfg056ff5 counter goto pbr_mark_0x020000 comment "DOMAIN"
pbr chains - policies
chain pbr_forward { # handle 228
}
chain pbr_input { # handle 229
}
chain pbr_output { # handle 230
}
chain pbr_postrouting { # handle 232
}
chain pbr_prerouting { # handle 231
ip daddr @pbr_sb0_4_dst_ip_cfg056ff5 counter packets 0 bytes 0 goto pbr_mark_0x020000 comment "DOMAIN" # handle 1634
}
chain pbr_dstnat { # handle 227
}
pbr chains - marking
chain pbr_mark_0x010000 { # handle 1624
counter packets 0 bytes 0 meta mark set meta mark & 0xff01ffff | 0x00010000 # handle 1625
return # handle 1626
}
chain pbr_mark_0x020000 { # handle 1627
counter packets 0 bytes 0 meta mark set meta mark & 0xff02ffff | 0x00020000 # handle 1628
return # handle 1629
}
chain pbr_mark_0x030000 { # handle 1630
counter packets 0 bytes 0 meta mark set meta mark & 0xff03ffff | 0x00030000 # handle 1631
return # handle 1632
}
pbr nft sets
set pbr_sb0_4_dst_ip_cfg056ff5 { # handle 1633
type ipv4_addr
flags interval
counter
auto-merge
comment "DOMAIN"
}
dnsmasq sets
nftset=/myip.is/4#inet#fw4#pbr_sb0_4_dst_ip_cfg056ff5 # DOMAIN
IPv4 table 256 pbr_wan route:
default via xx.xx.xx.xx dev eth1
IPv4 table 256 pbr_wan rule(s):
30000: from all fwmark 0x10000/0xff0000 lookup pbr_wan
IPv4 table 257 pbr_sb0 route:
default via 172.16.250.1 dev sb0
IPv4 table 257 pbr_sb0 rule(s):
29998: from all fwmark 0x20000/0xff0000 lookup pbr_sb0
IPv4 table 258 pbr_sb1 route:
default via 172.16.251.1 dev sb1
IPv4 table 258 pbr_sb1 rule(s):
29996: from all fwmark 0x30000/0xff0000 lookup pbr_sb1
/etc/init.d/pbr reload
Using wan interface (on_start): wan
Found wan gateway (on_start): xx.xx.xx.xx
Setting up routing for 'wan/eth1/xx.xx.xx.xx' [✓]
Setting up routing for 'sb0/172.16.250.1' [✓]
Setting up routing for 'sb1/172.16.251.1' [✓]
Routing 'DOMAIN' via sb0 [✓]
Installing fw4 nft file [✓]
pbr 1.1.7-61 monitoring interfaces: wan sb0 sb1
pbr 1.1.7-61 (fw4 nft file mode) started with gateways:
wan/eth1/xx.xx.xx.xx [✓]
sb0/172.16.250.1
sb1/172.16.251.1
/etc/init.d/pbr status
pbr - environment
pbr 1.1.7-61 running on OpenWrt SNAPSHOT.
Dnsmasq version 2.90 Copyright (c) 2000-2024 Simon Kelley
Compile time options: IPv6 GNU-getopt no-DBus UBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP conntrack no-ipset nftset auth cryptohash DNSSEC no-ID loop-detect inotify dumpfile
pbr fw4 nft file: /usr/share/nftables.d/ruleset-post/30-pbr.nft
add chain inet fw4 pbr_mark_0x010000
add rule inet fw4 pbr_mark_0x010000 counter mark set mark and 0xff00ffff xor 0x010000
add rule inet fw4 pbr_mark_0x010000 return
add chain inet fw4 pbr_mark_0x020000
add rule inet fw4 pbr_mark_0x020000 counter mark set mark and 0xff00ffff xor 0x020000
add rule inet fw4 pbr_mark_0x020000 return
add chain inet fw4 pbr_mark_0x030000
add rule inet fw4 pbr_mark_0x030000 counter mark set mark and 0xff00ffff xor 0x030000
add rule inet fw4 pbr_mark_0x030000 return
add set inet fw4 pbr_sb0_4_dst_ip_cfg056ff5 { type ipv4_addr; auto-merge; counter; flags interval; policy performance; comment "DOMAIN";}
add rule inet fw4 pbr_prerouting ip daddr @pbr_sb0_4_dst_ip_cfg056ff5 counter goto pbr_mark_0x020000 comment "DOMAIN"
pbr chains - policies
chain pbr_forward { # handle 228
}
chain pbr_input { # handle 229
}
chain pbr_output { # handle 230
}
chain pbr_postrouting { # handle 232
}
chain pbr_prerouting { # handle 231
ip daddr @pbr_sb0_4_dst_ip_cfg056ff5 counter packets 0 bytes 0 goto pbr_mark_0x020000 comment "DOMAIN" # handle 1736
}
chain pbr_dstnat { # handle 227
}
pbr chains - marking
chain pbr_mark_0x010000 { # handle 1726
counter packets 0 bytes 0 meta mark set meta mark & 0xff01ffff | 0x00010000 # handle 1727
return # handle 1728
}
chain pbr_mark_0x020000 { # handle 1729
counter packets 0 bytes 0 meta mark set meta mark & 0xff02ffff | 0x00020000 # handle 1730
return # handle 1731
}
chain pbr_mark_0x030000 { # handle 1732
counter packets 0 bytes 0 meta mark set meta mark & 0xff03ffff | 0x00030000 # handle 1733
return # handle 1734
}
pbr nft sets
set pbr_sb0_4_dst_ip_cfg056ff5 { # handle 1735
type ipv4_addr
flags interval
counter
auto-merge
comment "DOMAIN"
}
dnsmasq sets
nftset=/myip.is/4#inet#fw4#pbr_sb0_4_dst_ip_cfg056ff5 # DOMAIN
IPv4 table 256 pbr_wan route:
default via xx.xx.xx.xx dev eth1
IPv4 table 256 pbr_wan rule(s):
30000: from all fwmark 0x10000/0xff0000 lookup pbr_wan
IPv4 table 257 pbr_sb0 route:
default via 172.16.250.1 dev sb0
IPv4 table 257 pbr_sb0 rule(s):
29998: from all fwmark 0x20000/0xff0000 lookup pbr_sb0
IPv4 table 258 pbr_sb1 route:
default via 172.16.251.1 dev sb1
IPv4 table 258 pbr_sb1 rule(s):
29996: from all fwmark 0x30000/0xff0000 lookup pbr_sb1
EDIT: fixed it after I saw this by setting confdir to the old path. Never would have though to check it myself!