Access 4G LTE USB Modem Homepage from another PC on different subnet

I have a USB 4g Modem plugged into a headless Raspberry Pi. The USB Modem provides a web interface in order to be able to configure it. To be able to access the interface you need to go to 192.168.0.1 and be on the same subnet as it.

As my Raspberry Pi is running headless I need to be able to access the web interface from another PC.

The Raspberry PI IP address is 10.1.0.3, my other PC is 10.1.0.4. When I run "ip a" on the Raspberry PI the USB modem has an IP address of 192.168.0.178.

How do I access the USB modem interface (192.168.0.1) from any PC on the 10.1.0.x subnet?

I am not able to change the USB modem IP address.

I hope this makes sense to someone as I am new to all this.

What is your modem model?

What happens if you access http://192.168.0.1 from your PC?
Install curl and run on the router: curl -I http://192.168.0.1 and copy/paste the output.

Model model: ZTE K5161z

I cannot access 192.168.0.1 from my PC (I eventually get a timeout in my browser).

curl command run on my router gives:

curl: (7) Failed to connect to 192.168.0.1 port 80 after 0 ms: Error

If I ssh in to my Raspberry Pi (where the USB modem is connected) the curl command on the Raspberry Pi gives:

HTTP/1.1 302 Redirect
Server: WebServer-Webs/
Date: Sat Mar 16 17:54:21 2024
Connection: close
Pragma: no-cache
Cache-Control: no-store
Content-Type: text/html
Location: http://192.168.0.1/index.html
X-Frame-Options: sameorigin
X-XSS-Protection: 1; mode=block

So, "my router" is not "my Raspberry"?
In this case your router needs a static route:
192.168.0.0/24 via 10.1.0.3

1 Like

That is correct, "my router" is not "my Raspberry Pi".

I have not set up a static route on OpenWRT before.

I looked at this page on the blog but I'm not sure how to translate your answer into the config I need. Can you offer some more help please?

Network --> Routing --> Add...

or

config route 'modem'
        option interface 'lan'
        option target '192.168.0.0'
        option netmask '255.255.255.0'
        option gateway '10.1.0.3'

I have entered that into /etc/config/network and done a 'service network restart' but still no luck accessing 192.168.0.1 from my PC.

The curl command from my router and trying to access the page from my PC both just timeout eventually.

Run tracert 192.168.0.1 from your (Windows?) PC and see if the path is correct.
What OS your Raspberry Pi is running?

All my PC's run a variant of debian linux.

I installed traceroute and ran traceroute 192.168.0.1 on my PC and got the reply:

traceroute to 192.168.0.1 (192.168.0.1), 30 hops max, 60 byte packets
 1  MyHostname (10.1.0.1)  2.496 ms  2.449 ms  1.675 ms
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

Make sure you have forwarding enabled on your Raspberry.

I have net.ipv4.ip_forward=1 in /etc/sysctl.org if that is correct. (It is un-commented.)

Well, then I would run tcpdump on Raspberry and see what's going on.

Thanks for all your help. What do I need to look for with tcpdump? This is all new to me.

I have run sudo tcpdump | grep "192.168" and get the following when I curl -I 192.168.0.1:

tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
14:39:03.893122 IP MyHostname.33198 > 192.168.0.1.http: Flags [S], seq 2321378838, win 64240, options [mss 1460,sackOK,TS val 1338176509 ecr 0,nop,wscale 7], length 0
14:39:04.928214 IP MyHostname.33198 > 192.168.0.1.http: Flags [S], seq 2321378838, win 64240, options [mss 1460,sackOK,TS val 1338177545 ecr 0,nop,wscale 7], length 0
14:39:07.008212 IP MyHostname.33198 > 192.168.0.1.http: Flags [S], seq 2321378838, win 64240, options [mss 1460,sackOK,TS val 1338179625 ecr 0,nop,wscale 7], length 0
14:39:11.088198 IP MyHostname.33198 > 192.168.0.1.http: Flags [S], seq 2321378838, win 64240, options [mss 1460,sackOK,TS val 1338183705 ecr 0,nop,wscale 7], length 0
14:39:19.327955 IP MyHostname.33198 > 192.168.0.1.http: Flags [S], seq 2321378838, win 64240, options [mss 1460,sackOK,TS val 1338191945 ecr 0,nop,wscale 7], length 0
14:39:35.968279 IP MyHostname.33198 > 192.168.0.1.http: Flags [S], seq 2321378838, win 64240, options [mss 1460,sackOK,TS val 1338208585 ecr 0,nop,wscale 7], length 0

I don't know what any of this means.

curl eventually reports:

curl: (28) Failed to connect to 192.168.0.1 port 80 after 131276 ms: Error

Nothing shows up in tcpdump when I try to access 192.168.0.1 from my PC's browser.

If the PC is using this modem for Internet access, the network's default routes should lead to the modem anyway. If not you will need to add some local routes so that the packets for 192.168.0.1 end up at the modem instead of defaulting toward the Internet (where the ISP will drop them).

Is there another networking device involved or just a PC and the Pi? If that is the case, and the Pi is not running OpenWrt, why are you asking here?

Both the Pi and the PC are connected to a router running OpenWRT.

The PC is not using the USB modem for the internet.

Can we see ip r output from both OpenWrt and Raspberry?

ip r on router

default via 172.16.15.246 dev pppoe-wan proto static 10.1.0.0/16 dev eth0.2 proto kernel scope link src 10.1.0.1 172.16.15.246 dev pppoe-wan proto kernel scope link src 109.xxx.yyy.zzz 185.xxx.yyy.zzz via 172.16.15.246 dev pppoe-wan proto static

ip r on Raspberry Pi

default via 10.1.0.1 dev eth0 proto dhcp src 10.1.0.3 metric 200 default via 10.1.0.1 dev wlan0 proto dhcp src 10.1.0.5 metric 600 default via 192.168.0.1 dev lte0 proto dhcp src 192.168.0.178 metric 999 10.1.0.0/16 dev eth0 proto kernel scope link src 10.1.0.3 metric 200 10.1.0.0/16 dev wlan0 proto kernel scope link src 10.1.0.5 metric 600 172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 172.18.0.0/16 dev br-eb84369e222d proto kernel scope link src 172.18.0.1 172.69.0.0/16 dev br-9e54cf1f8a6b proto kernel scope link src 172.69.0.1 192.168.0.0/24 dev lte0 proto kernel scope link src 192.168.0.178 metric 999

I do not see there what was advised at the very beginning:

Sorry I had removed that as it wasn't working. I have re-added it.

ip r on router:
default via 172.16.15.246 dev pppoe-wan proto static
10.1.0.0/16 dev eth0.2 proto kernel scope link src 10.1.0.1
172.16.15.246 dev pppoe-wan proto kernel scope link src 109.xxx.yyy.zzz
185.xxx.yyy.zzz via 172.16.15.246 dev pppoe-wan proto static
192.168.0.0/24 via 10.1.0.3 dev eth0.2 proto static

ip r on Raspberry Pi:

default via 10.1.0.1 dev eth0 proto dhcp src 10.1.0.3 metric 200
default via 10.1.0.1 dev wlan0 proto dhcp src 10.1.0.5 metric 600
default via 192.168.0.1 dev lte0 proto dhcp src 192.168.0.178 metric 999
10.1.0.0/16 dev eth0 proto kernel scope link src 10.1.0.3 metric 200
10.1.0.0/16 dev wlan0 proto kernel scope link src 10.1.0.5 metric 600
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
172.18.0.0/16 dev br-eb84369e222d proto kernel scope link src 172.18.0.1
172.69.0.0/16 dev br-9e54cf1f8a6b proto kernel scope link src 172.69.0.1
192.168.0.0/24 dev lte0 proto kernel scope link src 192.168.0.178 metric 999

This is with your original suggestion added. Any ideas?

I do not see any OpenWrt related issue yet.
Temporary disable Wi-Fi on Raspberry to make sure it has only one connection to the LAN.
Run tcpdump -n host 192.168.0.1 and tcp port 80 on Raspberry and try accessing this IP:port from any other computer on the LAN.