Help - Port Forward to dhcp client in mobile hotspot

My friends, i have a openwrt connected to my mobile hotspot on android device, i usually prefer the static ip interface while connecting and in this way i can portforward BUT my phone usually changes the gateway ip and with static ip my internet goes down.

Setting dhcp client i avoid the internet issue BUT i cant make to work portfoward (my needs are basically a printer and kde connect), is there a way to make this works ?

Obs : I have unlimited data plan on the phone hence i keep using it to avoid need to pay another internet provider

Depending on your carrier, many times this is not possible with IPv4 because they will use NAT/CG-NAT -- at the carrier and/or on your phone.

Do you have a public IP address on the wan of your OpenWrt router? Please post the first 2 octets (in bold: aaa.bbb.ccc.ddd) of this command:

ifstatus wan | grep address

thanks for you answer, i think i not explained right, sorry

i dont want to port forward to the internet BUT to my phone that acts a gateway since it is the mobile hotspot, so my setup is

phone (192.168.204.100) ---> openwrt router wan interface (dhcp client) ---> lan bridge interface (192.168.30.1) ---> my pc (192.168.30.10)

im trying to "port forward" kde connect port from my pc to my phone as example (they are all in LAN)

but since the phone is a android device, it random changes the wan constantly , so i cant assign a static ip for the openwrt wan interface

So you want your phone to be able to connect to the PC through the OpenWrt router?

Why do you need the OpenWrt router in this situation? Seems like you could directly connect your PC directly to the phone and not have any additional complications.

But, all you need to do is set a port forward on your OpenWrt router for the port(s) necessary to the address of the PC. Set the PC with a static IP or a DHCP reservation so that the PC's address never changes on the 192.168.30.0/24 network.

Then, on the phone, you just use the address that you find on the wan of your OpenWrt router and OpenWrt will port forward accordingly.

yes

i have other devices, that are connected by ethernet and dont have wifi , eg ip printer

i was able to do that and manage to work when the wan interface that connects to the phone was set to static, but as i explained, the phone router random changes the gateway, so i set the wan interface to be dhcp client, after setting it to dhcp client, port forwarding stops working .

I dont know if i need to do something extra to accomplish it, or if dhcp client is not compatible with port forwading. PC already static in both situations

If the phone always stays on the same subnet and it’s address is always the same, you can obviously set the router to a static ip so that it is predictable. However, there really isn’t anything you can do if the phone is changing its address or subnet.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.