How to enable IPv6 or Dual Stack for self-hosted GitLab instance

The default installation for a self-hosted GitLab does not enable IPv6

You can verify it by running below command:

ss -tunpl | grep 443
tcp   LISTEN 0      511                    *

As you can see above, GitLab only listened the address which means only IPv4 request is available.

If you want IPv6 enabled, you can update file /etc/gitlab/gitlab.rb, and uncomment below configuration.

# nginx['listen_addresses'] = ['*', '[::]']
# registry_nginx['listen_addresses'] = ['*', '[::]']
# mattermost_nginx['listen_addresses'] = ['*', '[::]']
# pages_nginx['listen_addresses'] = ['*', '[::]']

This configuration tells Nginx(GitLab) to listen any address and '[::]'(which is the address in IPv6).

After that, run reconfigure to activate the updated config:

gitlab-ctl reconfigure

Now you can check whether GitLab is listening on IPv6:

ss -tunpl | grep 443
tcp   LISTEN 0      511                    *                                                                                users:(("nginx",pid=1856703,fd=7),("nginx",pid=1856702,fd=7),("nginx",pid=1856701,fd=7),("nginx",pid=1856700,fd=7),("nginx",pid=1856699,fd=7))
tcp   LISTEN 0      511                                 [::]:443           [::]:*                                                                                users:(("nginx",pid=1856703,fd=8),("nginx",pid=1856702,fd=8),("nginx",pid=1856701,fd=8),("nginx",pid=1856700,fd=8),("nginx",pid=1856699,fd=8))

If you see [::]:443 in the output, you know IPv6 is ready for you.