1

Running Ubuntu 22.04.3 LTS on top of WSL2

Output of ifconfig:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1492
    inet 172.28.193.11  netmask 255.255.240.0  broadcast 172.28.207.255
    inet6 fe80::215:5dff:fe3e:7ffa  prefixlen 64  scopeid 0x20<link>
    ether 00:15:5d:3e:7f:fa  txqueuelen 1000  (Ethernet)
    RX packets 1402  bytes 590609 (590.6 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 163  bytes 52446 (52.4 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Output of ipconfig /all from PowerShell (pardon my machine's French):

    Configuration IP de Windows

   Nom de l’hôte . . . . . . . . . . : Zenbook-OZ
   Suffixe DNS principal . . . . . . :
   Type de noeud. . . . . . . . . .  : Hybride
   Routage IP activé . . . . . . . . : Non
   Proxy WINS activé . . . . . . . . : Non
   Liste de recherche du suffixe DNS.: Speedport_W_724V_01011603_07_008

Carte réseau sans fil Connexion au réseau local* 1 :

   Statut du média. . . . . . . . . . . . : Média déconnecté
   Suffixe DNS propre à la connexion. . . :
   Description. . . . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
   Adresse physique . . . . . . . . . . . : 3E-55-76-BE-66-95
   DHCP activé. . . . . . . . . . . . . . : Oui
   Configuration automatique activée. . . : Oui

Carte réseau sans fil Connexion au réseau local* 2 :

   Statut du média. . . . . . . . . . . . : Média déconnecté
   Suffixe DNS propre à la connexion. . . :
   Description. . . . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2
   Adresse physique . . . . . . . . . . . : 3E-55-76-BE-76-85
   DHCP activé. . . . . . . . . . . . . . : Oui
   Configuration automatique activée. . . : Oui

Carte réseau sans fil Wi-Fi :

   Suffixe DNS propre à la connexion. . . : Speedport_W_724V_01011603_07_008
   Description. . . . . . . . . . . . . . : MediaTek Wi-Fi 6E MT7922 (RZ616) 160MHz Wireless LAN Card
   Adresse physique . . . . . . . . . . . : 3C-55-76-BE-46-B5
   DHCP activé. . . . . . . . . . . . . . : Oui
   Configuration automatique activée. . . : Oui
   Adresse IPv6. . . . . . . . . . . . . .: 2003:c5:c715:bad9:aa0e:5e09:f399:6903(préféré)
   Adresse IPv6 temporaire . . . . . . . .: 2003:c5:c715:bad9:fc98:b63c:31e6:1374(préféré)
   Adresse IPv6. . . . . . . . . . . . . .: 2003:c5:c715:badb:904b:d90b:7543:f858(déprécié)
   Adresse IPv6 de liaison locale. . . . .: fe80::f215:b016:e094:6711%13(préféré)
   Adresse IPv4. . . . . . . . . . . . . .: 192.168.2.106(préféré)
   Masque de sous-réseau. . . . . . . . . : 255.255.255.0
   Bail obtenu. . . . . . . . . . . . . . : mercredi 13 mars 2024 01:52:12
   Bail expirant. . . . . . . . . . . . . : jeudi 4 avril 2024 00:38:51
   Passerelle par défaut. . . . . . . . . : fe80::1%13
                                       192.168.2.1
   Serveur DHCP . . . . . . . . . . . . . : 192.168.2.1
   IAID DHCPv6 . . . . . . . . . . . : 121394550
   DUID de client DHCPv6. . . . . . . . : 00-01-00-01-2C-2A-D6-E9-00-4C-E0-86-43-54
   Serveurs DNS. . .  . . . . . . . . . . : fe80::1%13
                                       192.168.2.1
   NetBIOS sur Tcpip. . . . . . . . . . . : Activé

Carte Ethernet Connexion réseau Bluetooth :

   Statut du média. . . . . . . . . . . . : Média déconnecté
   Suffixe DNS propre à la connexion. . . :
   Description. . . . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
   Adresse physique . . . . . . . . . . . : 3C-55-76-BE-46-B6
   DHCP activé. . . . . . . . . . . . . . : Oui
   Configuration automatique activée. . . : Oui

Carte Ethernet vEthernet (WSL (Hyper-V firewall)) :

   Suffixe DNS propre à la connexion. . . :
   Description. . . . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter
   Adresse physique . . . . . . . . . . . : 00-15-5D-AE-85-70
   DHCP activé. . . . . . . . . . . . . . : Non
   Configuration automatique activée. . . : Oui
   Adresse IPv6 de liaison locale. . . . .: fe80::5516:60d0:65b2:eb67%35(préféré)
   Adresse IPv4. . . . . . . . . . . . . .: 172.28.192.1(préféré)
   Masque de sous-réseau. . . . . . . . . : 255.255.240.0
   Passerelle par défaut. . . . . . . . . :
   IAID DHCPv6 . . . . . . . . . . . : 587208029
   DUID de client DHCPv6. . . . . . . . : 00-01-00-01-2C-2A-D6-E9-00-4C-E0-86-43-54
   NetBIOS sur Tcpip. . . . . . . . . . . : Activé

My question:

I don't understand where the IP address 172.28.193.11 (assigned to eth0 in the output ifconfig) comes from. The MAC address 00:15:5d:3e:7f:fa associated to eth0 in ifconfig does not appear anywhere in the output of ipconfig /all on PowerShell.

To what network interface does the MAC address 00:15:5d:3e:7f:fa correspond?

2 Answers 2

3

From Microsoft's article Comparing WSL Versions:

If you rely on a Linux distribution to have an IP address in the same network as your host machine, you may need to set up a workaround in order to run WSL 2. WSL 2 is running as a hyper-v virtual machine. This is a change from the bridged network adapter used in WSL 1, meaning that WSL 2 uses a Network Address Translation (NAT) service for its virtual network, instead of making it bridged to the host Network Interface Card (NIC) resulting in a unique IP address that will change on restart. To learn more about the issue and workaround that forwards TCP ports of WSL 2 services to the host OS, see WSL GitHub repository issue 4150, NIC Bridge mode (TCP Workaround)

1
  • That WSL link probably needs a bit of an update - If I get time I'll try to file a PR on it (the doc has a Github repo). The "workaround" mentioned in that linked Github issue is no longer the recommended solution since WSL2 2.0.0. Using networkingMode = mirror in your <windows_userprofile>\.wslconfig is a much cleaner solution now. Commented Mar 14 at 13:15
1

A few notes, starting with the suggestion to use the ip command and its subcommands. This replaces the deprecated ifconfig command. I'll use ip commands for any examples in this answer.

As mentioned in the other answer, WSL2 by default Footnote uses a virtual network interface. As for "where the ... address ... comes from", there's a Hyper-V virtual switch that interfaces between WSL and your computer.

You can see that virtual switch if you have both Windows Professional (or higher) and the Hyper-V Manager feature installed, by selecting the Virtual Switch Manager... action in the right-hand pane. However, I generally recommend you not make any modifications to it unless you are really certain you have the expertise.

That virtual switch also handed out the IP address you see for the WSL (Hyper-V firewall) interface in your ifconfig output.

In WSL, run ip route to show that the traffic is routing to the IP address of the WSL switch in Windows. In your output, that was 172.28.192.1, so you should see:

$ ip route
default via 172.28.192.1 dev eth0 proto kernel 

Footnote: Mirrored Mode

The (WSL (Hyper-V firewall)) in your ipconfig output in Windows tells me that you are running a fairly recent release of WSL2 that includes a new networking mode.

As mentioned above, the default networking mode in WSL2 is NAT. Up until fairly recently (September 2023), this was the only networking mode available to WSL2. However, release 2.0.0 of WSL2 brought several new "experimental" features, including "Mirrored" networking mode, where Windows network interfaces are mirrored into WSL2 instead of being NAT'd. That feature has been promoted, and is no longer experimental in the latest production WSL2 release.

If you were to have Mirrored mode enabled in your .wslconfig, then the IP addresses and interfaces you see with ifconfig/ip addr would generally match up with what you see in the Windows ipconfig /all command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .