-
Notifications
You must be signed in to change notification settings - Fork 14
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
Runx doesn't set correct Hostip in case of multiple Virtual Switches on Windows #6
Comments
Thank you for the bug report and for digging that far into the root cause! I currently don't have a working Windows VM. It would be nice if you could help me with some information and checks. Can you show me the output of Maybe the
Current
|
|
Thank you!
Which one did work for you after disabling additional Virtual Switches in your first research? |
I am going to investigate now. But I think it may be better to adapt Another approach (for WSL) is to use Hostip="$(awk ' /nameserver/{ print $2 } ' < /etc/resolv.conf)" |
Thank you for the investigation!
For the powershell solution I doubt that it will fulfill this. Though, I am not sure. Wikipedia says that Poweshell 2.0 is included in Win7. Furthermore, the stackoverflow comments suggest that calling it is very slow. The attempt with The command
@eine Could you please have a look at this, too? |
On MSYS2 (MINGW64):
|
On Cygwin, it works and Hostip contains the public IP (which does not match any of IPv4 addresses of the adapters). $ Hostip="$(hostname -I | cut -d' ' -f1)"
$ echo $Hostip
158.x.x.x
$ ipconfig
Windows IP Configuration
Ethernet adapter Ethernet 2:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . : Home
Link-local IPv6 Address . . . . . : fe80::a464:f05b:a69c:7cff%11
IPv4 Address. . . . . . . . . . . : 192.x.x.x
Subnet Mask . . . . . . . . . . . : 255.x.x.x
Default Gateway . . . . . . . . . : 192.x.x.x
Wireless LAN adapter Local Area Connection* 2:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter Local Area Connection* 3:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter WiFi 5:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : Home
Ethernet adapter vEthernet (Default Switch):
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::45be:1119:d090:5b00%57
IPv4 Address. . . . . . . . . . . : 172.x.x.x
Subnet Mask . . . . . . . . . . . : 255.x.x.0
Default Gateway . . . . . . . . . :
|
On Debian (dunno if this is WSL1 or WSL2), it works and Hostip contains the local IPv4 of one of the adapters: $ Hostip="$(hostname -I | cut -d' ' -f1)"
$ echo $Hostip
172.x.x.x |
@eine Thank you! Would have been to easy have a general solution immediately ...
I wonder if this IP works; it might also cause yet another firewall issue. On debian I get valid ipv4 adresses combining
Maybe this gives useable results in MSYS2 and Cygwin? Edit: I've added an experimental option
|
Unfortunately, it does not:
Even if it worked in some setups, I don't think it's desirable to use it. IMHO, the most local IP should be used.
I guess that users with conflictive setups might want to setup |
What is the output of
I agree.
Why would you prefer an envvar over an option? However, I'd prefer an automatic solution that does not need either. |
The envvar can be set in |
I found that
@CptnGreen @eine Could you please check if this gives an IP adress everywhere and also works with |
@mviereck I can confirm that to be acceptable. The output when calling ipconfig is the same on MSYS2, Cygwin or WSL. FTR, that is what I used before I dropped by own script in favour of x11docker/runx: eine/hwd-ide@b716acc#diff-e5e5b287edfbf94abd53c6c6376f53f8972af68e8cfe7ea3cd3a5c2d62632ffbL4. There used to be some Docker NAT which started with |
@eine Thank you very much! I'll set this as default now.
I am surprised. Is there no obvious Docker interface anymore? My intention was to prefer |
It seems there is no obvious interface anymore. See docker/for-win#5538. I agree with you it would be more desirable, tho. |
Thank you for pointing on the related ticket. I've removed the |
Environment: Win10, WSL2.
runx
bash script goes throughipconfig.exe
output and setsHostip
var (needed for theDISPLAY
envvar) to the value from the first found "IPv4"-containing string.But when there are multiple Virtual Switches the first found value may be not correct (my case) so
runx
doesn't work becauseDISPLAY
is not set correctly.Disabling additional Virtual Switches solves the problem but it took about an hour for me (not mentioning reading through code) to find the reason of the problem.
Please take this situation into account.
Thanks.
The text was updated successfully, but these errors were encountered: