代码改变世界

debain关闭numa、ipv6和transparent_hugepage

2023-02-15 17:45  abce  阅读(362)  评论(0编辑  收藏  举报

关闭numa、ipv6和transparent_hugepage

$ sudo vi /etc/default/grub

添加

GRUB_CMDLINE_LINUX_DEFAULT="quiet numa=off transparent_hugepage=never ipv6.disable=1"
$ sudo grub-mkconfig -o /boot/grub/grub.cfg
$ sudo reboot

 

Debian关闭IPv6的其它方法
方法一:在sysctl.d中新加入配置文件
在/etc/sysctl.d/文件夹中新建disable-ipv6.conf,并写入配置

$ sudo touch /etc/sysctl.d/disable-ipv6.conf
$ sudo echo 'net.ipv6.conf.all.disable_ipv6 = 1' >> /etc/sysctl.d/disable-ipv6.conf
$ sudo echo 'net.ipv6.conf.default.disable_ipv6 = 1' >> /etc/sysctl.d/disable-ipv6.conf
$ sudo echo 'net.ipv6.conf.lo.disable_ipv6 = 1' >> /etc/sysctl.d/disable-ipv6.conf

使用以下命令运行配置文件

sysctl -p -f /etc/sysctl.d/disable-ipv6.conf

如果使用ip a命令,在输出中没有发现IPv6地址,则说明成功关闭了IPv6功能。

方法二:直接修改sysctl.conf配置文件
打开/etc/sysctl.conf,在Uncomment the next line to enable packet forwarding for IPv6前一行添加以下三行内容:

$ sudo echo 'net.ipv6.conf.all.disable_ipv6 = 1' >> /etc/sysctl.conf
$ sudo echo 'net.ipv6.conf.default.disable_ipv6 = 1' >> /etc/sysctl.conf
$ sudo echo 'net.ipv6.conf.lo.disable_ipv6 = 1' >> /etc/sysctl.conf

使用以下命令运行配置文件:

sysctl -p

如果使用ip a命令,在输出中没有发现IPv6地址,则说明成功关闭了IPv6功能。