1、使用ifconfig命令查看网卡信息,如果出现了ipv6的信息证明ubuntu开启了ipv6
2、编辑配置文件/etc/sysctl.confvi /etc/sysctl.co艘绒庳焰nf加入内容或者使用echo 的形式进行追加net.ipv6.conf.all.disable_ipv6 = 1echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf
3、echo &孥恶膈茯quot;net.ipv6.conf.default.disable_ipv6 = 1">>/etc/sysctl.conf
4、echo "net.ipv6.conf.lo.disable_ipv6 = 1">>/etc/sysctl.conf
5、重启操作系统或者执行sysctl -p命令
6、操作完成之后继续使用ifconfig查看网卡信息ifconfigipv6信息消失,ubuntu关闭ipv6成功