Static IP address when in Tethering mode?

I use my OSMC (March 2022) with tethering enabled while travelling in my motorhome.
This works fine, I can connect my Android phone to the hotspot and control OSMC with Kore.
However, before I set off, I will test that the Pi/OSMC is working. This is done within the WiFi range of my home network. Which unfortunately uses the 192.168.0.x range. The same as the Pi/OSMC in Tethering mode!

Can anybody tell me how to define a fixed address for the Pi/OSMC in tethering mode. Anything other than 192.168.0.x will be fine.
I know that I can connect via ethernet and get a local lan dhcp address but that doesn’t allow me to test the hotspot.

Regards, M.

Tethering is normally used to pass through WiFi to ethernet or vice-versa. IIRC if you tether WiFi to an ethernet connection that’s got 192.168.0.x, the DHCP in connman will use subnet 192.168.1.x, otherwise it uses 192.168.0.x. It sounds like you have no ethernet in the motorhome so 192.168.0.x it is. If you do connect to ethernet at home I would expect connman to switch to serving 192.168.1.x and your phone should just get a new IP on that subnet.

Have you tried that?

Thank you for the suggestions. A couple of points to clarify:
“Tethering is normally used to pass through WiFi to ethernet or vice-versa.” Yes. But as far as I can tell, it is the only way to get an AP?
So yep. I’m fine with the way it works in motorhome - I See that the Pi has 192.168.0.1 and an AP I can connect to which gives my phone 192.168.0.x. All good and dandy.

The problem is in the home with a Lan at 192.168.0.x. Connect the ethernet cable and the Pi get ONE address (192.168.0.x - as decided by the LAN DHCP server). Disconnect the ethernet and Connman(?) makes its own addressing choices and picks 192.168.0.1. I now have an IP clash. TWO 192.168.0.1’s. My LAN router and the Pi hotspot. All I want to do is fix the Pi DHCP base address at 192.168.!=0.1.

Regards, M.

I’ve been told that if ethernet is on 192.168.0.x then the hotspot will be on 192.168.1.x when you set it up. I can’t check that without major disruption (my home lan is 192.168.1.x).

What does ifconfig say when you connect the Pi to ethernet? Here’s mine after enabling the tether.

osmc@pi3matrix:~$ ifconfig
eth0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
        inet 192.168.1.123  netmask 255.255.255.0  broadcast 192.168.1.255
        ether b8:27:eb:be:9f:dd  txqueuelen 1000  (Ethernet)
        RX packets 12817  bytes 17072851 (16.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6059  bytes 436739 (426.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 64  bytes 5126 (5.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 64  bytes 5126 (5.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

tether: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
        inet 192.168.0.1  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::e01b:7eff:fea0:cf0e  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:eb:ca:88  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 52  bytes 24056 (23.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
        inet6 fe80::ba27:ebff:feeb:ca88  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:eb:ca:88  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 72  bytes 33667 (32.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

If you’re not getting 192.168.1.1 on the tether, can you try disabling and re-enabling the tether when connected to ethernet?

Edit: I note in the tether setup screen it says ‘Do not connect this device to a wired network with a DHCP server’. I assume that applies only to the ‘WiFi to ethernet’ option.

[quote=“grahamh, post:4, topic:92906”]
I’ve been told that if ethernet is on 192.168.0.x then the hotspot will be on 192.168.1.x when you set it up.[/quote]

Hi Graham,
Whoever told you that, is … Spot On!
I had been testing/hacking without the ethernet cable plugged in. Plug the cable in and all pans out as I hoped it should.
Thanks for your help and the opportunity to discuss my problem. Regards, M.

1 Like