Making Network Calls from Terminal, over PdaNet WiFi Direct.

Justin Ross
2 min readJun 20, 2021

Insert fluffy intro here…

This article may be for you if you’re using PdaNet WiFi Direct to access the internet on your computer, you can access the internet fine through your browser, but other uses of your network aren’t working as expected.

This might have manifested itself in any number of ways. For me, it started with running brew update and getting back Could not resolve host: github.com.

Simplifying, I tried ping github.com and received ping: cannot resolve github.com: Unknown host.

Simplifying further, to rule out DNS issues, I tried pinging Google’s DNS with ping 8.8.8.8 and received perpetual request timeouts with 100% packet loss.

Thinking it may be a protocol issue, I tried to make an HTTP request, using curl https://google.com, for which I was met with curl: (6) Could not resolve host: google.com.

Again thinking it might be a DNS issue, I checked

This led me down a whole host of rabbit holes thinking there might be an issue with protocols and such with my VPN or with PdaNet.

The Resolution: Setup Proxy in Terminal

The core problem is that the automatic proxy you setup in Network Preferences for your PdaNet connection isn’t automatically setup for use in your terminal.

Presumably, your proxy file url is the same as mine: http://192.168.49.1:8000. If not, you’ll want to amend the commands below.

To complete this setup, you’ll want to run the following:

HTTP_PROXY=http://192.168.49.1:8000
HTTPS_PROXY=$HTTP_PROXY

With this, most of your use-cases are likely resolved. Your git pull, your brew update, your curl; any terminal commands that rely on http or https.

I‘m assuming the proxy may be used for other protocols as well, but I haven’t had a use-case with which to verify.

FTP_PROXY=$HTTP_PROXY
RSYNC_PROXY=$HTTP_PROXY

There are still some commands which wont work, like ping, traceroute, and nslookup. Anything using other protocols, like ICMP or UDP.

Summary:

Set your HTTP_PROXY and HTTPS_PROXY environment variables to whatever the proxy is that you enabled in Network Preferences. This will solve most of your issues.

If you’ve found this helpful, please respond with information about the issue that brought you here, to increase visibility for others in your situation.

#Unreviewed #Unedited

Cheers,
Justin

--

--