On 20/10/2021 09:15, Mark Rogers wrote:
My Pi is on my local network (headless and somewhat physically
inaccessible) at 192.168.1.200

I have a 3G USB stick connected to my Pi, which presents itself as an
ethernet device (eth1); the Pi gets an IP address of 192.168.8.100 and
the USB stick has a configuration website on 192.168.8.1

How can I access this website from my laptop (192.168.1.100) via SSH?

I tried SSH tunnelling but it's not working, at least in part because
the web page links to resources at http://192.168.8.1 which aren't
accessible. I have tried w3m on the Pi itself, but the web page has
loads of javascript so doesn't work.

Presumably I can set up a proxy somehow? Other suggestions?

I do this for pretty much exactly the same reason - accessing the web interface of a router via a name can often cause all sorts of problems for some reason. Anyway, the solution I have used takes me back to the 90s in many ways, as that's when I used the technique most. What you need is a Socks proxy and a browser that supports them (Firefox does, but to be honest I've not even looked at other browser support). You can use a standard ssh install to create the Socks proxy, so no need for extra software installs. The incantation is something along the lines of:

ssh -i ~/.ssh/id_rsa -D 1080 -f -C -q -N user@hostname.tld

Where:

-i is defining the ssh key, so no need to provide that if you are using password authentication or have that configured in the ~/.ssh/config file

-D sets the Socks port

-f backgrounds ssh

-C sets compression

-q sets quiet mod

-N stops execution of a remote command

Once that is running (sorry, can't double check things, I'm booted into that other OS with the 11 after it at the moment, a bit of an 'is it up to being a daily driver' challenge; painful so far), you can configure Firefox (or other supporting browser) to use the Socks proxy.

For Firefox just go to the bottom section of the Settings where you have Network Settings and a button to configure things. Go for the Manual proxy configuration and the Socks Host and port, so local host and 1080, Socks 5 is fine. There's probably an extra parameter on the SSH command if you are using a separate machine to run the Socks proxy and not your local one.

With any luck I've not made a blunder in those details, it's later than I thought!


    
-- 
 Paul Tansom  |  Aptanet Ltd.  |  https://www.aptanet.com/  |  023 9238 0001
=============================================================================
Registered in England | Company No: 4905028 | Registered Office: Ralls House,
Parklands Business Park, Forrest Road, Denmead, Waterlooville, Hants, PO7 6XP