Force SQL Server 2019/Ubunti to use ipv4 instead of ipv6

0

We are testing usability of Microsoft's SQL Server on Linux servers for our internal products, and we ran into a bump during config. We are trying to setup and configure SQLServer 2019 (preview) and we managed to setup the repo and install the sql server binaries from it. However, when we run sudo /opt/mssql/bin/mssql-conf setup and choose edition, it stalls for a while and errors out. The log shows:

2019-05-21 14:07:57.08 spid22s     Error: 26024, Severity: 16, State: 1.
2019-05-21 14:07:57.08 spid22s     Server failed to listen on 'any' <ipv6> 1433. Error: 0x2742. To proceed, notify your system administrator.
2019-05-21 14:07:57.08 spid22s     Error: 17182, Severity: 16, State: 1.
2019-05-21 14:07:57.08 spid22s     TDSSNIClient initialization failed with error 0x2742, status code 0xa. Reason: Unable to initialize the TCP/IP listener. A socket operation encountered a dead network. 

The culprit is obvious, setup attempts to start the server on <ipv6>, which we, for reasons unrelated to this, have disabled on production boxes. We need SQL Server to setup and run on <ipv4> and I don't seem to see any way to change that using mssql-config, as per mssql-config instructions.

Has anyone had any experience setting this up?

mmix

Posted 2019-05-21T13:03:36.593

Reputation: 111

Answers

1

Ok, found a solution in environment vars. Just use

sudo MSSQL_IP_ADDRESS=0.0.0.0 /opt/mssql/bin/mssql-conf setup

This will also force config to bind to any <ipv4> after restart. Since this behavior seems to be undocumented, I'll leave this here for posterity.

mmix

Posted 2019-05-21T13:03:36.593

Reputation: 111

Microsoft has been using IPv6 for close to 20 years, and it has been their default in Windows and in their own internal network for over a decade. The developers probably forgot that there are people who disable it in Linux (as you can't disable the IPv6 stack in Windows). – Michael Hampton – 2019-05-21T18:53:53.097

You can though, you can disable any and all protocols on individual adapters. I've been doing it for a while when using VPN, since a lot of VPN clients do not route IPv6 so IPv6 enabled apps bypass VPN. See here: https://medium.com/@JockDaRock/disabling-ipv6-on-network-adapter-windows-10-5fad010bca75

– mmix – 2019-05-22T09:32:53.703

1That only removes it from individual adapters, the IPv6 stack is still running though. In particular you can still bind services on IPv6 and connect on localhost. – Michael Hampton – 2019-05-22T15:36:49.863

1

sudo /opt/mssql/bin/mssql-conf set network.ipaddress 0.0.0.0

works too

Derek

Posted 2019-05-21T13:03:36.593

Reputation: 11