Linux基础——IPV6内核参数配置

发布时间 2023-10-17 16:18:03作者: gkhost

一、检查内核配置是否启动ipv6

net.ipv6.conf.bond0.forwarding = 1

net.ipv6.conf.bond0.disable_ipv6 = 0

net.ipv6.conf.all.forwarding = 1

net.ipv6.conf.default.forwarding = 1

 

二、检查内核启动IPV6配置

ansible -i ip all -m shell -a "sysctl -a | grep -iE 'forwarding|disable_ipv6'|grep bond0"

添加IPV6相关配置到/etc/sysctl.conf

ansible -i ip all -m shell -a "echo 'net.ipv6.conf.all.forwarding = 1'>>/etc/sysctl.conf"

ansible -i ip all -m shell -a "echo 'net.ipv6.conf.default.forwarding = 1'>>/etc/sysctl.conf"

ansible -i ip all -m shell -a "echo 'net.ipv6.conf.bond0.forwarding = 1'>>/etc/sysctl.conf"

ansible -i ip all -m shell -a "echo 'net.ipv6.conf.bond0.disable_ipv6 = 0'>>/etc/sysctl.conf"

ansible -i ip all -m shell -a "sysctl -p"

三、加载IPV6内核配置

sysctl -a | grep disable_ipv6