Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port forwarding should support IPv6 #7029

Open
Tracked by #9848
doggy8088 opened this issue Aug 7, 2022 · 4 comments
Open
Tracked by #9848

Port forwarding should support IPv6 #7029

doggy8088 opened this issue Aug 7, 2022 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug remote-explorer
Milestone

Comments

@doggy8088
Copy link

  • 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.

@alexr00 alexr00 added bug Issue identified by VS Code Team member as probable bug remote Issues in the code server support labels Aug 22, 2022
@alexr00 alexr00 added this to the Backlog milestone Aug 22, 2022
@alexr00 alexr00 added remote-explorer and removed remote Issues in the code server support labels Aug 22, 2022
@Rar9
Copy link

Rar9 commented Dec 21, 2022

I can connect via ssh remote to ubuntu 22.04 server.

Then I start in vsc terminal via npm run dev the node app.

This will open ssh tunnel(s) with the particular port(s) and the button to open browser appears.

But after this the browser will not receive any further data if the connection is done via IPv6.

So either Vsc or Windows11 issue.

Ubuntu server can curl the localhost and will display the browser data.

@Lord-Leonard
Copy link

@Rar9 did you get it to work?

@Rar9
Copy link

Rar9 commented Jan 14, 2023

No for now I've disabled IPv6 localhost on server

@4llan
Copy link

4llan commented May 4, 2024

I had some dev containers that port forwarding was not working as expected when listening to localhost. After downgrading the remote and dev container extensions, I just noticed that the application was listening to the IPv6 loopback address (::1).

Steps to reproduce the issue:

  • Create a new dev container (python, i.e.);
  • Start a server listening to IPv6 loopback (python -m http.server --bind ::1 7777);

You see a message of vscode telling that the port is auto forwarded, but there's no response in the forwarded address. Also, there's a message in the "Shared" output about the forwarding:

... [info] [SharedProcessTunnelService] Created tunnel 9: localhost:7777 (local) to 0:0:0:0:0:0:0:1:7777 (remote).

Starting a server to the IPv4 loopback works as expected (python -m http.server --bind 127.0.0.1 7778).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug remote-explorer
Projects
None yet
Development

No branches or pull requests

5 participants