User Tools

Site Tools


linux:ipv6

Disable ipv6 support

Apache

By default, Apache will listen on all IPs, both IPv6 and IPv4. This is controlled by the Listen directive:

Listen 80

To turn off IPv6 in Apache, just change the Listen directive in /etc/apache2/ports.conf to

Listen 0.0.0.0:80

Repeat this for port 443 for HTTPS connections.

Then restart apache

/etc/init.d/apache2 restart

SSHD

By default, SSHD will listen on all IPs. This is configured in /etc/ssh/sshd_config as ListenAddress option.
To force SSHD to only listen to IPv4 explicitly set this:

ListenAddress 0.0.0.0

Then restart SSHD

/etc/init.d/ssh restart

postfix

vi /etc/postfix/main.cf 

Add inet_protocols line after inet_interfaces:

inet_protocols = ipv4

and restart postfix

/etc/init.d/postfix restart

Dovecot

vi /etc/dovecot/dovecot.conf

and add/change listen after the protocols = imap etc line, so it reads

listen = *

and restart dovecot

/etc/init.d/dovecot restart

EXIM

vi /etc/exim4/update-exim4.conf.conf

and change dc_local_interfaces so it reads

dc_local_interfaces='127.0.0.1'

and restart exim

/etc/init.d/exim4 restart

x11vnc

x11vnc has a -no6 option. This was broken in libvncserver1 package before 0.9.11.

x11vnc -no6

System wide

echo "# Disable IPv6" >> /etc/sysctl.conf
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "#" >> /etc/sysctl.conf
sysctl -p

reboot system at some point

Confirm open connections

lsof -i
linux/ipv6.txt · Last modified: 2023/05/29 11:55 by 127.0.0.1