WSL:- Networking Issue – Day 01

Background

I was having problems with a python script on my MS Windows computer.

Chose to try out the same python script in Win OS / WSL Subsystem.

Python

Installed WLS, specifically Ubuntu flavored.

It comes with Python.

But, stuck trying to perform python module installs.

 

Network

Is it possible that the error is not Ubuntu Linux?

And, also the issue is not Python.

 

Introduction

Let us do a quick reconnaissance on the networking subsystem in Linux.

 

Networking Tools

Ping

Pinged a couple of sites such as google.com, cnn.com.

No good.


Ping Output

Text

Temporary failure in name resolution

Image

 

Troubleshooting

ip addr

In ubuntu, let us get our IP Address using “ip addr”.

Syntax

ip addr

Sample

ip addr | grep eth0

Output
Output-Image

Output-Text

6: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
inet 172.22.146.115/20 brd 172.22.159.255 scope global eth0

Explanation
  1. eth0
    • Line 1
      • State:- UP
    • Line 2
      • IP Address:- 172.22.146.115
      • Gateway:- 172.22.159.255

Our ethernet (eth0) network interface is up.

We have a functional IP Address and Gateway.

 

ping

Attempted to ping cnn.com using it’s IP Address.

Go cnn.com IP Address using the MS Windows host.

BTW, CNN.COM’s is 151.101.1.67.

 

 

Resolution

Our issue appears to be name resolution.

Let us go clean up our resolv.conf configuration file.

resolv.conf

Outline
  1. Commented out current name server
    • Change from:-
      • nameserver 172.22.144.1
    • Change to:-
      • nameserver 172.22.144.1
  2. Added new name servers
    • In our case, roll pretty hard with Google
      • nameserver 8.8.8.8
        nameserver 8.8.4.4
Original
Image

Revised
Image

 

/etc/wsl.conf

Outline
  1. Inform wsl not to both generating the resolv.conf file
    • It is a simple configuration entry
    • vi /etc/wsl.conf
      • Add
        • [network]
        • generateResolvConf = false
Revised
Image

 

Validation

ping

ping cnn.com

output
output image

 

Crediting

  1. Microsoft/WSL

 

Summary

As of 2022-February-22nd, this continues to be an enduring and pernicious issue and stumbling block.

The change made to wls.conf does not hold.

One has to go back and re-add the following entries:-

[network]
generateResolvConf = false

ever so often.

I am not so sure whether it is WSL session-specific.

One thought on “WSL:- Networking Issue – Day 01

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s