WEB-UI ( Luci )ã使ã£ãå ´å
Luci 㧠ip rule ãä½ã£ã¦ ip route ãã¼ãã«ãä½ããã¨ã¯ã§ããã
ååãã£ãã³ãã³ãããã®ããªã·ã¼ã«ã¼ãã£ã³ã°ãLuCIï¼WEBï¼çµç±ã§ãã話ã§ãã
ãããã¨ã¯æ¬¡ã®éãã
nftables ã§ãã¼ã¯ãæ±ãã
ãã¼ã¯æ¸ãã±ãããAcceptãããprerouting 㧠ãã¼ã¯ãããip rule ã§ã«ã¼ãã£ã³ã°ãã¼ãã«ãåããã
nftables ã®prerouting(ãã¼ã¯æ¡ä»¶ï¼ãå¥ãã¼ãã«ã«ãã
ããªã·ã¼ã«ã¼ãã£ã³ã°ç¨ã®ã«ã¼ãã£ã³ã°ãã¼ãã«
ip rule è¨å®ã§ããã¼ã¯æ¸ãã±ããå°ç¨ã®ã«ã¼ãã£ã³ã°ãã¼ãã«ãä½ãã
è¨å®ã® Neworking -> routing -> { Static IPv6 route , IPv6 Rule }ãç·¨éãã¦æ¬¡ã®ãããªè¨å®ãä½ãã
IPv6 Routing ã®è¨å®
IPv6 Rulesã®è¨å®
ãã®çµæã次ã®ãããªè¨å®ãä½ãããã
config route6 option interface 'wg0' option target '2000::/3' option gateway 'fd00:aaa:afac:1919::1' option table '666' config rule6 option lookup '666' option mark '0x29a'
ããã§å°ç¨ã®ã«ã¼ãã£ã³ã°ãã¼ãã«ãä½ããã¨ãã§ããããMARKã«ä¸è´ããã«ã¼ã«ãä½ããã¨ãã§ããã
ãã®çµæã¯ã³ãã³ããã確èªã§ããã
ã«ã¼ã«ãä½æãããã
> ip -6 rule list 1: from all fwmark 0x29a lookup 666
ã«ã¼ãã£ã³ã°ãè¨å®ãããã
> ip -6 route show table 666 2000::/3 via fd00:aaa:afac:1919::1 dev wg0 proto static metric 1024 pref medium
ã«ã¼ãã£ã³ã°ããã¹ãããã(google.comã®AAAAçµè·¯)
> GGv6=2404:6800:400a:80b::200e > ip -6 route get fibmatch $GGv6 mark 666 2000::/3 via fd00:aaa:afac:1919::1 dev wg0 table 666 proto static metric 1024 pref medium
ãã¼ã¯æ¸ãã±ããã®çµè·¯ãä½ããããã¨ãããã£ãã
ãã¡ã¤ã¢ã¦ã©ã¼ã«è¨å®ã§ããã¼ã¯ãä»ããã
config rule option name 'Add Mark' option family 'ipv6' list proto 'all' list src_ip 'fd03:3304:1128:3939::3' option target 'MARK' option set_mark '666' option src 'lan6' option dest '*'
ããã§ããã¹ãã¡ããããªãã®ããsource zone
ãã¡ããã¨å
¥ãããã¨ã
çºä¿¡ zoneãå
¥ããã¨ã inet fw4 ã®mangle_prerouting
ã«ã«ã¼ã«ãä½ãããã
src zone
ãé©å½ã«Anyã¨ããã㨠mangle_forward
ãmangle_output
ã«å
¥ã£ã¦ãã¾ããæ©ã¾ãã
ãã®è¨å®ã§ãnft ã«æ¬¡ã®ã«ã¼ã«ã追å ããã
> nft list chain inet fw4 mangle_prerouting table inet fw4 { chain mangle_prerouting { type filter hook prerouting priority mangle; policy accept; iifname "br-lan" ip6 saddr fd03:3304:1128:3939::3 counter meta mark set 0x0000029a comment "!fw4: Add Mark" } }
æå®ããSRC Addr ã®ãã±ããããã¼ã¯ãã¦ããã
ãã¼ã¯ãããã±ããã許å¯ãã
ãã¼ã¯ãã¤ãããã±ããããForward許å¯ããã
次ã®ãããªè¨å®ãã§ããã
config rule option name 'Accept Mark' option family 'ipv6' option src '*' option target 'ACCEPT' option mark '666' list proto 'all' option dest '*'
ãã®è¨å®ã®çµæã¨ãã¦ãnft ã«æ¬¡ã®ã«ã¼ã«ã追å ããã
> nft list chain inet fw4 forward table inet fw4 { chain forward { type filter hook forward priority filter; policy drop; meta nfproto ipv6 meta mark 0x0000029a counter accept comment "!fw4: Accept Mark" # ãã ## ç¥ jump handle_reject } }
以ä¸ã«ãã£ã¦ããã¼ã¯ãã¦ãã±ãããæµãã
OpenWrtLuCIã®ç»é¢ããããã¡ã¤ã¢ã¦ã©ã¼ã«ã§ãã¼ã¯ãããã±ãããã転éãããã¨ãåºæ¥ãã
OpenWRT ã¯ããããã¡ãã
è¨å®ããã¹ã£ã¦ãã¦ãã確èªã§ããããã³ãã³ãããå¼·å¼ã«ãã±ããéãããã
ããæ¹ãããããªãã¨ãã¯ãã³ãã³ãã§ä½ã£ã¦ãããåãè¨å®ãLuCIã§è©¦ãã°ãããã
ã¡ã¼ã«è£½åã使ãã¨æå½ãã次第ã«è©¦ãç¾½ç®ã«ãªããã©ããã¦ãã¹ãã¬ã¹ãæããã ããã¥ã¢ã«ããã£ã¦ãæ£è§£ãããããªãã®ã§é£ããã
ãã®ç¹ã§ã¯ãOpenWrtã使ãã°Linuxã ãã³ãã³ãã§è¡ããããWRTéå®äºè±¡ãã©ãããUbuntuãRaspiã§ã試ãããã§ãã¹ã®çºè¦ãçå®ã«æ©ã¿ãé²ããããã®ã§æ¬å½ã«å¬ããã