How to Use Proxy on WSL 2

  1. Install cntlm.
    sudo apt-get install cntlm
  2. Configure the permission for cntlm.conf file.
    sudo chmod 644 /etc/cntlm.conf
  3. Configure proxy settings.
    sudo vi /etc/cntlm.conf
  4. Make sure the following parameters are configured.
    Domain Domain
    Username username
    Proxy 1.2.3.4:5678
    NoProxy localhost, 127.0.0., 10.
    Listen 3128
  1. Test connectivity. (Hit enter key if it asks a password)
    cntlm -M http://www.google.com
  2. Generate hashed passwords.
    cntlm -H
  3. Paste the generated passwords to the cntlm configuration file.
  4. Configure proxy.
    export http_proxy=http://localhost:3128/
    export https_proxy=http://localhost:3128/
  5. Start cntlm
    sudo cntlm -v -c /etc/cntlm.conf