0

I want to connect openwrt 22.03.2 to an ubuntu 22.04 via wireguard, and since I need to split the traffic, I use nftables to split the destination address.

So I need to run this command below to tag the destination address with package in ss_spec_dst_fw and nat

However an error is reported

root@OpenWrt:~# nft add rule inet nat SHADOWSOCKS ip daddr @ss_spec_dst_fw counter mark set 0x1 masquerade
Error: Could not process rule: Not supported
add rule inet nat SHADOWSOCKS ip daddr @ss_spec_dst_fw counter mark set 0x1 masquerade
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

root@OpenWrt:~# nft add rule inet nat SHADOWSOCKS ip daddr @ss_spec_dst_fw counter mark set 0x1 snat to 10.0.0.2
Error: Could not process rule: Not supported
add rule inet nat SHADOWSOCKS ip daddr @ss_spec_dst_fw counter mark set 0x1 snat to 10.0.0.2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

root@OpenWrt:~# nft add rule inet nat SHADOWSOCKS ip daddr @ss_spec_dst_fw counter snat to 10.0.0.2
Error: Could not process rule: Not supported
add rule inet nat SHADOWSOCKS ip daddr @ss_spec_dst_fw counter snat to 10.0.0.2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The following versions are available on openwrt


chain PREROUTING { # handle 1
                type nat hook prerouting priority filter; policy accept;
                ip protocol { icmp, tcp, udp, 33, esp, ah, 108, 132, 136 } counter packets 5804 bytes 1623605 jump SHADOWSOCKS # handle 4
        }

root@OpenWrt:~# ip rule
0:      from all lookup local 
32764:  from all fwmark 0x1 lookup vpn 
32766:  from all lookup main 
32767:  from all lookup default 
root@OpenWrt:~# ip route show table vpn
default dev vpn scope link 
root@OpenWrt:~# uname -a
Linux OpenWrt 5.10.146 #0 SMP Fri Oct 14 22:44:41 2022 armv7l GNU/Linux
root@OpenWrt:~# nftables
-ash: nftables: not found
root@OpenWrt:~# opkg list | grep nftables
nftables-json - 1.0.2-2.1
root@OpenWrt:~# opkg list | grep firewall
firewall4 - 2022-10-18-7ae5e14b-1
luci-app-firewall - git-23.093.42704-1c01c64

According to this document, nat is compatible with prerouting, and the syntax is also from the ntables reference. What should I do to make this work, including what mods to add to openwrt?

kursk.ye
  • 389
  • 1
  • 3
  • 12

0 Answers0