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

WSL vswitch ethernet configuration issue #9981

Closed
1 of 2 tasks
tprinsDW opened this issue Apr 17, 2023 · 2 comments
Closed
1 of 2 tasks

WSL vswitch ethernet configuration issue #9981

tprinsDW opened this issue Apr 17, 2023 · 2 comments
Labels

Comments

@tprinsDW
Copy link

tprinsDW commented Apr 17, 2023

Windows Version

Microsoft Windows [Version 10.0.22621.1413]

WSL Version

1.2.0.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.90.1-microsoft-standard-WSL2

Distro Version

Ubuntu 20.04

Other Software

No response

Repro Steps

  • attempt to have host machine be an smb client to wsl distro
  • attempt to launch nginx hello-world demo from wsl distro

Expected Behavior

  • WSL distro should be able to launch networking related containers and bind them to outgoing ports
  • windows host should be able to be a smb client to the wsl distro

Actual Behavior

I believe there is an issue with the wsl created vm switch 'WSL'. The wsl distro does have external internet and can ping the host ip but certain host<->distro networking capabilities are not working. For example, an nginx hello demo container does not work as well as my windows 11 host cannot successfully connect to the wsl distro as an smb client. Log of both examples are below. Also, I can no long see the switch in the 'Network Connections' list of adapters.

  • windows 11 host fails an smb connection to the ubuntu wsl distro
  • wsl distro's containers have errors when attempting to attach to the network

Diagnostic Logs

From Windows 11:
PS C:\Users\taylorprins> ipconfig /all
Ethernet adapter vEthernet (WSL):

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
Physical Address. . . . . . . . . : 00-15-5D-67-D9-A9
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::8609:fb1b:81d9:51af%60(Preferred)
IPv4 Address. . . . . . . . . . . : 172.30.224.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 1006638429
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2B-B4-AF-EE-74-78-27-B2-8E-C6
NetBIOS over Tcpip. . . . . . . . : Enabled
PS C:\Users\taylorprins\build> Test-NetConnection ubuntuwsl

ComputerName : ubuntuwsl
RemoteAddress : fe80::215:5dff:fefe:f258%60
InterfaceAlias : vEthernet (WSL)
SourceAddress : fe80::8609:fb1b:81d9:51af%60
PingSucceeded : True
PingReplyDetails (RTT) : 0 ms

PS C:\Users\taylorprins\build> Test-NetConnection ubuntuwsl smb
WARNING: TCP connect to (172.30.233.201 : 445) failed

ComputerName : ubuntuwsl
RemoteAddress : 172.30.233.201
RemotePort : 445
InterfaceAlias : vEthernet (WSL)
SourceAddress : 172.30.224.1
PingSucceeded : True
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded : False

PS C:\Users\taylorprins> Get-vmswitch | ? Name -Like 'WSL' | select *

DefaultQueueVmmqQueuePairs : 0
DefaultQueueVmmqQueuePairsRequested : 16
Name : WSL
Id : b95d0c5e-57d4-412b-b571-18a81a16e005
Notes :
Extensions : {Microsoft Azure VFP Switch Filter Extension, Microsoft Windows
Filtering Platform, Microsoft NDIS Capture}
BandwidthReservationMode : Absolute
PacketDirectEnabled : False
EmbeddedTeamingEnabled : False
AllowNetLbfoTeams : False
IovEnabled : False
SwitchType : Internal
AllowManagementOS : True
NetAdapterInterfaceDescription :
NetAdapterInterfaceDescriptions :
NetAdapterInterfaceGuid :
IovSupport : False
IovSupportReasons :
AvailableIPSecSA : 0
NumberIPSecSAAllocated : 0
AvailableVMQueues : 0
NumberVmqAllocated : 0
IovQueuePairCount : 0
IovQueuePairsInUse : 0
IovVirtualFunctionCount : 0
IovVirtualFunctionsInUse : 0
PacketDirectInUse : False
DefaultQueueVrssEnabledRequested : True
DefaultQueueVrssEnabled : False
DefaultQueueVmmqEnabledRequested : True
DefaultQueueVmmqEnabled : False
DefaultQueueVrssMaxQueuePairsRequested : 16
DefaultQueueVrssMaxQueuePairs : 0
DefaultQueueVrssMinQueuePairsRequested : 1
DefaultQueueVrssMinQueuePairs : 0
DefaultQueueVrssQueueSchedulingModeRequested : StaticVrss
DefaultQueueVrssQueueSchedulingMode : Dynamic
DefaultQueueVrssExcludePrimaryProcessorRequested : False
DefaultQueueVrssExcludePrimaryProcessor : False
SoftwareRscEnabled : True
RscOffloadEnabled : False
BandwidthPercentage : 0
DefaultFlowMinimumBandwidthAbsolute : 0
DefaultFlowMinimumBandwidthWeight : 0
CimSession : CimSession: .
ComputerName : DW-281
IsDeleted : False

PS C:\Users\taylorprins> Get-HNSNetwork | ? Name -Like 'WSL'

ActivityId : FD65B8FC-36FF-477E-9E15-8C3972AB0271
AdditionalParams :
CurrentEndpointCount : 1
DNSServerList : 172.30.224.1
Extensions : {@{Id=F74F241B-440F-4433-BB28-00F89EAD20D8; IsEnabled=False; Name=Microsoft Azure VFP Switch
Filter Extension}, @{Id=E7C3B2F0-F3C5-48DF-AF2B-10FED6D72E7A; IsEnabled=False; Name=Microsoft
Windows Filtering Platform}, @{Id=430BDADD-BAB0-41AB-A369-94B67FA5BE0A; IsEnabled=True;
Name=Microsoft NDIS Capture}}
Flags : 9
GatewayMac : 00-15-5D-FE-F4-EB
Health : @{AddressNotificationMissedCount=0; AddressNotificationSequenceNumber=0;
DHCPNotificationMissedCount=0; DNSCacheNotificationMissedCount=0;
DNSCacheNotificationSequenceNumber=0; DNSNotificationMissedCount=0;
DNSNotificationSequenceNumber=0; InterfaceNotificationMissedCount=0;
InterfaceNotificationSequenceNumber=0; LastErrorCode=0; LastUpdateTime=133259586759460122;
MacAddressNotificationMissedCount=0; MacAddressNotificationSequenceNumber=0;
NeighborNotificationMissedCount=0; NeighborNotificationSequenceNumber=0;
RouteNotificationMissedCount=0; RouteNotificationSequenceNumber=0;
XlatNotificationMissedCount=0; XlatNotificationSequenceNumber=0}
ID : B95D0C5E-57D4-412B-B571-18A81A16E005
IPv6 : False
IsolateSwitch : True
LayeredOn : D21EB079-2316-4B15-8DFE-BA51E62EF64C
MacPools : {@{EndMacAddress=00-15-5D-FE-FF-FF; StartMacAddress=00-15-5D-FE-F0-00}}
MaxConcurrentEndpoints : 1
Name : WSL
NatName : ICS6A3393AB-9F16-41B7-A311-CDA1720D93A7
Policies : {}
State : 1
Subnets : {@{AdditionalParams=; AddressPrefix=172.30.224.0/20; Flags=0; GatewayAddress=172.30.224.1;
Health=; ID=26F8FAED-9908-42F0-94CB-ABF2CD77C508; IpSubnets=System.Object[]; ObjectType=5;
Policies=System.Object[]; State=0}}
SwitchGuid : B95D0C5E-57D4-412B-B571-18A81A16E005
TotalEndpoints : 2
Type : ICS
Version : 64424509440
Resources : @{AdditionalParams=; AllocationOrder=2; Allocators=System.Object[];
CompartmentOperationTime=0; Flags=0; Health=; ID=FD65B8FC-36FF-477E-9E15-8C3972AB0271;
PortOperationTime=0; State=1; SwitchOperationTime=0; VfpOperationTime=0;
parentId=CEBB11F3-6D2D-4253-91E0-DDA5A37F6E0D}

From Ubuntu WSL Distro:
taylorprins@UbuntuWSL:~/wsl_build$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:fe:f2:58 brd ff:ff:ff:ff:ff:ff
inet 172.30.233.201/20 brd 172.30.239.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::215:5dff:fefe:f258/64 scope link
valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:ef:12:e5:5f brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80::42:efff:fe12:e55f/64 scope link
valid_lft forever preferred_lft forever

taylorprins@UbuntuWSL:~/wsl_build$ docker run -P nginxdemos/hello
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2023/04/17 14:09:19 [emerg] 1#1: bind() to 0.0.0.0:80 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
2023/04/17 14:09:19 [notice] 1#1: try again to bind() after 500ms
2023/04/17 14:09:19 [emerg] 1#1: bind() to 0.0.0.0:80 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
2023/04/17 14:09:19 [notice] 1#1: try again to bind() after 500ms
2023/04/17 14:09:19 [emerg] 1#1: bind() to 0.0.0.0:80 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
2023/04/17 14:09:19 [notice] 1#1: try again to bind() after 500ms
2023/04/17 14:09:19 [emerg] 1#1: bind() to 0.0.0.0:80 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
2023/04/17 14:09:19 [notice] 1#1: try again to bind() after 500ms
2023/04/17 14:09:19 [emerg] 1#1: bind() to 0.0.0.0:80 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
2023/04/17 14:09:19 [notice] 1#1: try again to bind() after 500ms
2023/04/17 14:09:19 [emerg] 1#1: still could not bind()
nginx: [emerg] still could not bind()

@tprinsDW
Copy link
Author

For the record: If I switch the wsl config (via .wslconfig) to use an external vswitch, everything works as expected.

@OneBlue
Copy link
Collaborator

OneBlue commented Apr 25, 2023

Thanks for reporting this @tprinsDW. Unfortunately this is by design. The default networking mode doesn't allow ports to be bound externally.

There are workarounds though (see this link)

@OneBlue OneBlue closed this as completed Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants