Software >> OS >> Unix >> Linux >> RHEL >> How to disable ipv6

 

RHEL 6


##  METHOD (1) : disable at the system parameters

echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf

echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf  


## activate by

sysctl -p    


## METHOD (2) : Set in kernel running parameters

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


## confirm disabled  

sysctl -a --pattern=net.ipv6.conf.*disable


## METHOD (3)

## create /etc/modprobe.d/ipv6.conf

echo "options ipv6 disable=1" > /etc/modprobe.d/ipv6.conf

## reboot

reboot



RHEL 7/8


##  METHOD (1) : disable at the system parameters

echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf 

echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf  


## activate by

sysctl -p    


## METHOD (2) : Set in kernel running parameters

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


## confirm disabled  

sysctl -a --pattern=net.ipv6.conf.*disable


## METHOD (3) - disable in kernel

## Edit /etc/default/grub and add ipv6.disable=1 in line GRUB_CMDLINE_LINUX,
## See the sample output below

cat /etc/default/grub

(command output)
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="ipv6.disable=1 crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"



## Regenerate a GRUB configuration file and overwrite existing one:

grub2-mkconfig -o /boot/grub2/grub.cfg