How do I get OpenWrt to use a proxy?

How do I get OpenWRT to use a proxy?
I don't mean opkg using a proxy, I already have that setup.
I also don't mean a transparent proxy for connected devices.
I mean the core os and ssh terminal being able to use the proxy required to be able to access files and services from the internet.

Where is your proxy server located?

There is no single option to do it, and you will need to configure each application that you are using to use a proxy, for instance for opkg see this, for ssh you will need to add a ProxyCommand to .ssh/config that tells it to pass through the proxy.

1 Like

would running a command from ssh then route the launched/child process's connection through said proxy?
Also, I already know opkg's option.

how do I do that on OpenWRT which doesn't have that (or any) files in the root user's home?

the proxy is located on my phone.
it's how my other devices are able to get online.

You can manually create the .ssh directory, or run ssh-keygen and it will create it for you with the correct permissions along with private & public key.

Okay, how do I set up its contents to give let ssh get online through a proxy?

Command doesn't exist on my OpenWRT router.

Like a hotspot?

Unless I'm missing something, then you'd just connect your OpenWrt to the phone. You can search and Join Networks under the Wireless menu on the web GUI.

hotspot app on phone.
devices have to connect to the app's proxy to actually get online through the hotspot app

To be clear: Your device/carrier doesn't allow hotspot, so you installed an additional Proxy App (e.g. PDANet).

So, you need to connect - then setup the OpenWrt for the proxy setting - correct?

My device/carrier does allow hotspot with the plan addon.
I have said addon, as well as the fastest plan.

Fastest plan slows hotspot data to just barely above dial-up when you hit the cap.
And I hit that cap in a couple days, if it even takes more than a day.
Slower plans don't do that to your hotspot data.
But I'm on the fastest plan, so I'm not downgrading to a slower plan.

I have to use the proxy powered hotspot app to get around that.

And I need to get OpenWRT's command line the ability to go through that proxy so that stuff I run from ssh has the ability to download and access stuff from the internet.

yes, pretty much.

I'm trying to understand how the carrier doesn't see this as a hotspot. Maybe there is some setting or app on your phone that masks this from the provider's view. I've never had a reason to investigate this to try to circumvent such a restriction... but I always thought that the phone informs the carrier if your phone is operating as a wifi AP or USB tethering device (with the exception of true local data transfer such as maybe a camera transferring images to your phone) with a bridge connection to the internet. Do you have some app on your phone that is operating as a proxy (making all of the data appear to be normal activity from the phone even though it is actually operating as an AP)?

The OP does. In my similar use case (e.g. a laptop) - I connect to the cell - but I setup the proxy in any clients on the device (e.g. the web browser).

Here is an example on an OS Level:

(I've never tested it on an OS network setting.)

OP wants to connect the OpenWrt to mobile - then additionally set it to use proxy. :thinking:

1 Like

It's the software running the device's built-in hotspot/tethering that tells them.
a common no-root way of getting around it is apps that make a wi-fi direct ssid,
and the proxy they serve is then needed to get online through that wi-fi direct ssid.

1 Like

I couldn't have said it better myself.
No seriously, I legitimately couldn't have said it better myself.

1 Like

@psherman - I've been thinking...if the OP's app runs a transparent proxy or something...

Couldn't they make a rule in the OpenWrt to redirect traffic to that IP/port (i.e. similar to Tor or redirecting DNS)?

if I knew how to do that, I wouldn't have posted this.
And it's not something I'm willing to risk bricking my router to trial & error towards it.

This is outside my experience, so I don't really know how to best advise. I've been reading to learn, but also wanted to make sure that the premise of this was possible (i.e. the proxy app on the phone that masks the effective hotspot functionality from the carrier).

1 Like

Would that work with all traffic of everything?