|
如果你是想学习设置nftables,可以参考下面我的主路由nftables nat配置,但是,旁路由肯定是不需要nat的,旁路由仅仅只是简单的做ip转发。
- table ip nat {
- chain nat_prerouting {
- type nat hook prerouting priority -100; policy accept;
- # port forwarding: PVE, HomeAssistant, qbittorrent & WireGuard
- iifname $DEV_WAN ip protocol { tcp, udp } th dport 53847 dnat to 192.168.10.7
- iifname $DEV_WAN dnat to tcp dport map { 8006 : 192.168.10.250, 8123 : 192.168.10.252 }
- iifname $DEV_WAN udp dport 13231 dnat to 192.168.10.251
- }
- chain nat_postrouting {
- type nat hook postrouting priority 100; policy accept;
- # masquerade private IP addresses
- ip saddr $LAN_SET oifname $DEV_WAN masquerade
- # allow access from home LAN to Modem
- ip saddr $HOME_LAN oifname $DEV_MODEM snat to $IP_MODEM
- }
- }
复制代码 |
|