How to change USB tethering using static IP?

There is no option in the fw 4.x to change USB tethering to static instead of using DHCP. Editing the /etc/config/network file manually doesnt work, the GLInet web gui always overwrites it when you disconnect and connect the USB tethering changing back to DHCP.

Can you please change this, and also is there a workaround for this?

You mean usb dongle 4g/5g? You can not change IP inside usb. I tried my usb dongle 4g and opened dongle web gui. Not possible to change IP, only insert dns IP address. So my decide to change LAN range IP in GL router.

Not sure what you mean. I want to give the usb0 tether device a static ip, of course inside the DHCP range of the 4g stick, but a static one so it is always the same.

May I ask why?

Since the 4G stick will give you DHCP anyway, it’s not really necessary. Want to understand the usecase here.

REASONS… REASONS…

Do you think I am just asking for no reason!?

Because:

  1. I am logging bandwidth statistics and need the WAN device, in this case usb0/tethering always have the same IP so the statistics is properly calculated

  2. the DHCP is buggy of the USB stick and sometimes not renew and device gets lost, so I want to set it to static with same IP

Changing /etc/config/network manually into:

config interface ‘tethering’
option proto ‘static’
option ifname ‘usb0’
option metric ‘30’
option ipaddr ‘192.168.123.2’
option gateway ‘192.168.123.254’
option netmask ‘255.255.255.0’
option dns ‘1.1.1.1 1.0.0.1’

doesnt work. If you disable tether and enable again, the GLinet web interface will awlays overwrite and change back to DHCP:

config interface ‘tethering’
option proto ‘dhcp’
option ifname ‘usb0’
option metric ‘30’

The LTE stick DHCP range is 192.168.123.* but randomly giving the IP for each connecti. I want it to be static at 192.168.123.2.

I have wrote this watchdog script so far not sure if it helps if the DHCP/usb device buggs out:

1 Like

Excuse me that I assume that normal people don’t know what they are doing :stuck_out_tongue:

I guess you have to go with luci anyway in that case. The GL GUI overwrites some stuff.

1 Like

That was the question, if there is a workaround. So I should disble the teather device in the GLInet web interface and then… what? Go into Luci, set tether/usb0 to bring up at boot with static?

When I click interfaces in Luci I get this message:

not sure if this will break/brick the device if I click continue interfering with the GLInet settings.

Worth a try. But I am not even sure if there are not some hooks that will enable the GL GUI anyway :frowning:

Nah, it does not. I never saw any issues*

*) Doesn’t mean there aren’t any, but at least I would say it’s pretty safe.