admin avatar

Debian 10 how to turn IPv6 on and off

🕑 by admin





Debian way to turn on and off IPv6

Check if the system has ipv6 kernel loaded

lsmod | grep ipv6

Return data similar to the following, it means that the ipv6 kernel is loaded

1
2
3
4
5
6
nf_reject_ipv6         16384  1 ip6t_REJECT
nf_log_ipv6            16384  5
nf_conntrack_ipv6      20480  8
nf_defrag_ipv6         16384  1 nf_conntrack_ipv6
nf_log_common          16384  2 nf_log_ipv6,nf_log_ipv4
nf_conntrack          114688  8 nf_conntrack_ipv6,nf_conntrack_ftp,nf_conntrack_ipv4,nf_conntrack_broadcast,nf_nat_ftp,nf_conntrack_netbios_ns,xt_conntrack,nf_nat

Check if there is an IPv6 address

1
2
3
ifconfig 
ip address list
netstat -anptl

Command to temporarily close ipv6

1
2
sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1

Temporarily open the ipv6 command

1
2
sysctl -w net.ipv6.conf.all.disable_ipv6=0
sysctl -w net.ipv6.conf.default.disable_ipv6=0

Permanently shut down the system ipv6

1
2
3
4
5
6
7
8
echo " ">>/etc/sysctl.conf
echo "# made for disabled IPv6 in $(date +%F)">>/etc/sysctl.conf
echo 'net.ipv6.conf.all.disable_ipv6 = 1'>>/etc/sysctl.conf
echo 'net.ipv6.conf.default.disable_ipv6 = 1'>>/etc/sysctl.conf
echo 'net.ipv6.conf.lo.disable_ipv6 = 1'>>/etc/sysctl.conf
tail -5 /etc/sysctl.conf
sysctl -p
netstat -anptl

Or edit the system kernel configuration file

1
2
3
4
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

Open the system's ipv6 permanently, and change the 1 in the above code to 0. . .

View system ipv6 status command

1
2
cat /proc/sys/net/ipv6/conf/all/disable_ipv6
cat /proc/sys/net/ipv6/conf/default/disable_ipv6
Return 0 to enable, 1 to disable ipv6





💘 相关文章


📝 有偿服务

• 服务器合租380/年
• 服务器配置:2.4G,6核12线程
• nvme raid 1硬盘
• 不提供服务器自主面板
• 适合稳定的个人博客
• 提供备份服务,备份空间自备
• 只提供ipv6地址,搭配cloudflare使用
• 提供想要安装的程序和域名
• 博客必须是和谐健康的
• 博客不能是视频和图片站
• 提供以下付费服务
• 建站,FTP,备份,Linux,Wordpress等建站问题咨询管理
• 加微信:344452500(不闲聊,直接说事)

写一条评论

Based on Golang + fastHTTP + sdb | go1.16.8 Processed in 0ms