Skip to content

Port forwarding should support IPv6 #7029

Open
@doggy8088

Description

@doggy8088
  • VSCode Version: 1.70.0
  • Local OS Version: Microsoft Windows [Version 10.0.19043.1826]
  • Remote OS Version: Ubuntu 20.04.4 LTS
  • Remote Extension/Connection Type: Containers
  • Logs: N/A

Steps to Reproduce:

  1. clone the project & open with vscode

    git clone https://github.com/doggy8088/devcontainer-dotnet-mssql-ipv6-issue.git code devcontainer-dotnet-mssql-ipv6-issue
  2. Reopen in Container

  3. Here is the PORTS info.

    image

  4. Connect to localhost locally using sqlcmd

    sqlcmd -S localhost -U sa -P P@ssw0rd -Q "SELECT 1;"

    It will result:

    Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. . Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired. Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.. 
  5. Connect to 127.0.0.1 locally using sqlcmd

    sqlcmd -S 127.0.0.1 -U sa -P P@ssw0rd -Q "SELECT 1;"

    It will run successfully.

    ----------- 1 (1 rows affected) 

I really expected I can connect to the db container using localhost. It because the PORTS shows that.

During few hours research, I realized that Windows use IPv6 by default. When VSCode use IPv4 to do the port forwarding, connect to localhost will route to ::1 and it will failed.

Two suggestions:

  1. Change the Local Address to show 127.0.01:1433 on the PORTS window.

  2. Port forwarding support IPv6.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugremote-explorer

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions