ubuntu 24.04 停用IPv6

編輯設定檔

#vi /etc/sysctl.conf

在檔案最後加下以下三行

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

重啟服務, 不必重開機

#sysctl -p

驗證是否成功 (確認輸出為 1)

#cat /proc/sys/net/ipv6/conf/all/disable_ipv6