Created
February 28, 2024 14:31
-
-
Save yude/d350a3f13e6701f5e36c8b1797e33e58 to your computer and use it in GitHub Desktop.
nftables で、特定のサブネット以外のトラフィックをマスカレードする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/sbin/nft -f | |
flush ruleset | |
table inet filter { | |
chain input { | |
type filter hook input priority 0; | |
} | |
chain forward { | |
type filter hook forward priority 0; | |
} | |
chain output { | |
type filter hook output priority 0; | |
} | |
} | |
table ip nat { | |
chain prerouting { | |
type nat hook prerouting priority 0; | |
} | |
chain postrouting { | |
type nat hook postrouting priority 100; | |
ip daddr != {10.20.0.0/16} oifname "eth0" masquerade | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment