I've installed a snapshot openwrt 22 build (so no LUCI), and can SSH to 192.168.1.1, but when I connect the router's WAN port to my ISP's router, the openwrt IP changes to the upstream router 192.168.0.x range, and I can't SSH to it anymore.
What can i change in the network or dhcp config files so the openwrt router keeps the static assigned 192.168.1.1 when the WAN port is connected and get internet?
OpenWrt default lan interface is 192.168.1.1/24.
If your ISP router is in the 192.168.0.1/24, then there isn't any overlapping.
What is the subnet used in the lan interface of your ISP router?
Yes, normally i can connect my ISP router to WAN on openwrt in two different ranges, and it's fine. But for some reason on the WR904AC the local LAN IP is set by the DHCP by the ISP router.
If I connect WWAN it works ok, the openwrt keeps to 192.168.1.1.
Please run the following commands (copy-paste the whole block) and paste the output here, using the "Preformatted text </> " button:
Remember to redact passwords, MAC addresses and any public IP addresses you may have
ubus call system board; \
uci export network; uci export wireless; \
uci export dhcp; uci export firewall; \
ip -4 addr ; ip -4 ro li tab all ; ip -4 ru
I don't see WR904AC in the hardware listings. If it is a WR902AC or other router with only one Ethernet port, on such devices OpenWrt defaults to having the Ethernet port in the lan bridge and no wan network. You would need to remove the Ethernet port from br-lan and create a wan interface with the Ethernet port as its device. Of course that means the lan can only be wifi, so first start up a wifi AP on lan and log in by wifi.
First create a new SSID and assign it on a new interface, which will be part of lan firewall zone. After you are able to connect to it successfully, and not get yourself locked outside, then you can proceed to make the changes on the lan interface.
# Configure network
uci -q delete network.mgmt_dev
uci set network.mgmt_dev="device"
uci set network.mgmt_dev.type="bridge"
uci set network.mgmt_dev.name="br-mgmt"
uci -q delete network.mgmt
uci set network.mgmt="interface"
uci set network.mgmt.proto="static"
uci set network.mgmt.device="br-mgmt"
uci set network.mgmt.ipaddr="192.168.3.1"
uci set network.mgmt.netmask="255.255.255.0"
uci commit network
/etc/init.d/network restart
# Configure wireless
WIFI_DEV="$(uci get wireless.@wifi-iface[0].device)"
uci -q delete wireless.mgmt
uci set wireless.mgmt="wifi-iface"
uci set wireless.mgmt.device="${WIFI_DEV}"
uci set wireless.mgmt.mode="ap"
uci set wireless.mgmt.network="mgmt"
uci set wireless.mgmt.ssid="mgmt"
uci set wireless.mgmt.encryption="none"
uci commit wireless
wifi reload
# Configure DHCP
uci -q delete dhcp.mgmt
uci set dhcp.mgmt="dhcp"
uci set dhcp.mgmt.interface="mgmt"
uci set dhcp.mgmt.start="100"
uci set dhcp.mgmt.limit="150"
uci set dhcp.mgmt.leasetime="1h"
uci commit dhcp
/etc/init.d/dnsmasq restart
uci -q delete firewall.mgmt
uci set firewall.mgmt="zone"
uci set firewall.mgmt.name="mgmt"
uci set firewall.mgmt.network="mgmt"
uci set firewall.mgmt.input="ACCEPT"
uci set firewall.mgmt.output="ACCEPT"
uci set firewall.mgmt.forward="REJECT"
uci commit firewall
/etc/init.d/firewall restart
Then connect to mgmt ssid and verify you can connect to the router.
Follow the instructions here to make the lan interface without dhcp and enable dhcp client.
After it is connected you can either create a new SSID for the clients, or change the MGMT interface to connect upstream via the lan by enabling forwarding from mgmt zone to lan zone and enabling masquerade on lan zone.