Set Static ip from modem to openwrt router but dhcp inside

Hello,

My device is Mi Router 4a gig edition
I want dhcp inside openwrt router with static ip from modem.
I tried this

uci set network.lan.proto="static"
uci set network.lan.ipaddr="192.168.0.50"
uci set network.lan.netmask="255.255.255.0"
uci set network.lan.gateway="192.168.0.100"
uci set network.lan.dns="192.168.0.100"
uci commit network
/etc/init.d/network restart

Openwrt as client device guide but devices get ip from my modem.

I want use different ip block , different dhcp server ; short mean isolate everythink from my modem.

Is it possible? I can do it via stock rom.

Don't connect it to your moden then.

(Is there something missing in your details?)

???

  • LAN is a DHCP server by default
  • If you want to set a WAN IP instead of being a DHCP client, then statically set that IP too

My internet came from cable net , coaxiel one. And modem has not setting for device by device static ip.

(I should use it to access internet)

Example i should set static ip from pc network settings. Else every reboot changes my ip address then i cant port forward from any device.

We're discussing the OpenWrt.

You can, or you can tell OpenWrt to assign it the same IP everytime.

Oh, you you mean a local static IP for the PC, so you can forward from the public IP!

This is done on the OpenWrt, not the modem.

See: https://openwrt.org/docs/guide-user/base-system/dhcp_configuration#static_leases

Sorry, I didn't explain myself. I want to use static ip in the modem that I am connected to with wan port
(set manualy wan port ip without disable dhcp) and distribute ip with dhcp inside in openwrt.

I know how to set static ip inside openwrt :slight_smile:

You want to set one Public IP to multiple hosts???

Then you use a router with NAT/port forwarding (e.g. an OpenWrt).

Do you have a public IP on your OpenWrt WAN port now?

Port forwarding is easy step which i already did.

ı just want learn set wan ip to static (ex. 192.168.0.50 from wan ip (for modem), with openwrt inside dhcp relay must give ip in 192.168.1.X block)

Hope i can explain what i asked :frowning:

Then set the WAN port static 192.168.0.50.

DHCP Relay is a term...and it would get DHCP from WAN...I assume you didn't mean DHCP Relay...but DHCP Server on LAN.

Then change LAN to 192.168.1.x/24. It will give out IPs in the 192.168.1.0/24 range. This was the setting by default.

If i set like that, there is no internet on device.
( i know broadcast is wrong , must be 192.168.0.255 , just tested with 255 but still on error )

  • The gateway must be correct to get Internet. This must be the 192.168.0.x IP of your modem.
  • You also need to set the DNS servers.

Oh, after set the dns to my config it worked.

Thanks man, appreciated.

Best regards

1 Like

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