![nftables/nginx 搭載の Debian 11 で IPv6 が動作しない](https://rvso.com/image/776287/nftables%2Fnginx%20%E6%90%AD%E8%BC%89%E3%81%AE%20Debian%2011%20%E3%81%A7%20IPv6%20%E3%81%8C%E5%8B%95%E4%BD%9C%E3%81%97%E3%81%AA%E3%81%84.png)
私は、nftables 0.9.8 を搭載した Debian 11 システムで Web サーバー (nginx 1.21.6) を実行しています。私の nftables 構成は次のとおりです。
table inet filter {
chain input {
type filter hook input priority filter; policy drop;
ip saddr @spamhaus4 counter packets 0 bytes 0 drop
ip6 saddr @spamhaus6 counter packets 0 bytes 0 drop
meta l4proto tcp meta nfproto ipv4 ip saddr @abused counter packets 0 bytes 0 drop
ip daddr 46.38.148.0-46.38.151.255 drop
iif "lo" log group 2 accept
iif != "lo" ip daddr 127.0.0.0/8 counter packets 0 bytes 0 drop comment "drop connections to loopback not coming from loopback"
iif != "lo" ip6 daddr ::1 counter packets 0 bytes 0 drop comment "drop connections to loopback not coming from loopback"
ct state established,related log group 2 accept
ct state invalid counter packets 47 bytes 2572 drop
tcp dport { 25, 80, 143, 443, 587, 2772, 9980, 45907 } log group 2 accept
ip protocol icmp icmp type { echo-reply, destination-unreachable, echo-request, router-advertisement, router-solicitation, time-exceeded, parameter-problem } log group 2 accept
ip6 nexthdr ipv6-icmp icmpv6 type { destination-unreachable, packet-too-big, time-exceeded, parameter-problem, echo-request, echo-reply, nd-router-solicit, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert, ind-neighbor-solicit, ind-neighbor-advert } log group 2 accept
ip6 nexthdr ipv6-icmp log group 2 accept
counter packets 2686 bytes 421604 drop
}
chain IPSinput {
type filter hook input priority filter + 10; policy drop;
counter packets 88448 bytes 15799025 queue num 0-3 bypass,fanout
}
chain forward {
type filter hook forward priority filter; policy drop;
}
chain output {
type filter hook output priority filter; policy accept;
}
chain IPSoutput {
type filter hook output priority filter + 10; policy drop;
counter packets 76196 bytes 201278628 queue num 0-3 bypass,fanout
}
}
nftables ファイアウォールは正常に動作します。
しかし、私のnginxサーバーはIPv6経由ではアクセスできません。私はさまざまなIPv6チェックツール(例:参考:)そしてまたQualys SSLテストIPv6経由でサーバーにアクセスできませんが、IPv4は正常に動作しています。私は各nginxサーバーにlisten [::]:80;
(resp.ディレクティブを含めました。そして、listen [::]:443;
netstat -anlp |grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 48846/nginx: master
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 48846/nginx: master
tcp 0 0 192.168.42.98:443 93.104.163.178:39001 VERBUNDEN 48847/nginx: worker
tcp 0 0 192.168.42.98:443 93.104.163.178:39368 VERBUNDEN 48847/nginx: worker
tcp 0 0 192.168.42.98:443 93.104.163.178:43086 VERBUNDEN 48847/nginx: worker
tcp6 0 0 :::80 :::* LISTEN 48846/nginx: master
tcp6 0 0 :::443 :::* LISTEN 48846/nginx: master
unix 3 [ ] STREAM VERBUNDEN 160451 48846/nginx: master
unix 3 [ ] STREAM VERBUNDEN 160453 48846/nginx: master
unix 3 [ ] STREAM VERBUNDEN 160450 48846/nginx: master
unix 3 [ ] STREAM VERBUNDEN 160448 48846/nginx: master
unix 3 [ ] STREAM VERBUNDEN 160452 48846/nginx: master
unix 3 [ ] STREAM VERBUNDEN 160446 48846/nginx: master
unix 3 [ ] STREAM VERBUNDEN 160449 48846/nginx: master
私のルーターでは、IPv6も有効にしています。
どこに問題があるのか、何か考えをお持ちの方はいらっしゃいますか?
答え1
@Zoredache のコメントのおかげで、ホストの IPv6 アドレスに ping を試してみました。自宅のネットワーク内でしか機能しませんでした。サブネットオンラインまたは別のサイトでは機能しませんでした。
その後、unix.stackoverflow.com で次の回答を見つけました。https://unix.stackexchange.com/a/443380/520989. ファイルを編集してに/etc/dhcpcd.conf
置き換えました。ルーター (Fritzbox 7583) で以前の構成を忘れてサーバーを再起動すると、問題は確かに解決しました。サーバーは IPv6 (nginx も) 経由で完全にアクセスできるようになりました。slaac private
slaac hwaddr