[solved] Lose router's gateway when wan is connected

Whenever wan is connected, the ip of device assigned would be from the up-level's, as well as its gateway.
And I cannot connect to the openwrt until the wan was disconnected.

More than likely, you are connecting 2 routers in series, creating a double-NAT configuration. Not ideal, but should still work. In your case, the OpenWrt router is probably using the same network scope as the router above it, causing a conflict. Change it to some other network and it should be fine. The default is 192.168.1.1 (192.168.1.0/24 network). Try changing it to something else like 192.168.2.1.

1 Like

Thank you for your advice. This probability is crucial. So I've modified the scope of Lan to 192.168.0.1 in /etc/config/network. But the problem stays intact.

Three thoughts:

  1. if you changed the LAN address via the LuCI interface, verify that the LAN address of your OpenWrt router did indeed change -- v18.06.x has some basic anti-bricking checks, and this can cause it to roll back to the previous setting.

  2. If you haven't already done so, you might try simply resetting the router to the default configuration and/or if it is not up-to-date, flash it with the latest release version (18.06.1). Aside from the potential address clash described in my initial post, this will generally have the WAN and LAN setup properly on most devices.

  3. assuming that you're running a fresh and current install with defaults except possibly the change for the LAN address, my original idea clearly wasn't entirely right. With that in mind, more info will be needed:
    -- Describe (or better yet, diagram) the network: what is connected to what, physically, and what are the network addresses at each major point.
    -- Post the relevant config files for review: /etc/config/network, /etc/config/dhcp, /etc/config/firewall

I'm quite absolutely sure that the LAN address has been changed. Because my way is to change the ipaddr directly in the /etc/config/network file through ssh and then restart. After reboot, without a wan connected, I am be able to get in touch with the luci of openwrt. But once a wan is connected, my ip, viewed on my computer, becomes a subnet of the up-level's, and gonna lose the connection with the router's openwrt.
I also tried to change network.lan.ipaddr while compiling, but the result remains he same.
The three files remain the default (except network.lan.ipaddr='192.168.0.1'). In fact I did not want to touch them while comiling.

Based on the new information...

First, have you considered loading a release build of OpenWrt (latest is 18.06.1). Just in case there is something wrong with the configuration of your self-compiled image, this will help verify the general setup and rule out any other issues.

Second, you still haven't described or diagramed the network environment. So it is not possible to make any other suggestions since this is critical information.

Actually, each 18.06.x branch cannot be compiled successful. It always shows an error:
Just like this one: [Solved] Build from Master on ArchLinux gives error for freadahead.c The "workaround" mentioned in that post does not work in mine.
So I have to use the snapshot branch, i.e. "openwrt 18.06" to compile it. I know it may encounters some problems unknown, but there's no other choice.

You can download 18.06.1 official images from the downloads section, here.

There's no official image for my device. And I'd like to compile one and may submit a merge.
https://openwrt.org/toh/phicomm/phicomm_k3_a1

Well, if there is no official image for your device, it is not officially supported. And in that case, you may be on your own to figure out what is happening, simply because nothing about the system or the image can really be assumed to behave as it does on supported devices.

That said, your network environment description is still missing. So there really isn't anything more I can say or suggest.

There's been a lot of 3rd support of openwrt for my device. They're working. And my network config is same as theirs.
My network environment is simple. The router device's wan is connected to a fiber optic modem (it has a lan sub-network 192.168.1.0/24). That's all.

Well, it is, of course, mandatory to set your OpenWrt device to have a network other than 192.168.1.0/24. You said you've done that and it is still not working. For any supported device, the default configuration (aside from the network scope) would work without issue. Maybe the WAN port isn't really working as expected (i.e. maybe it is bridged with the LAN ports).

You're not really giving that much information -- you might think your network is simple (and maybe it is), and you might think your files are defaults (maybe they are). But unless you post them, it is not possible to say. And importantly, you haven't given any info about what you've tried to do to troubleshoot this issue, what systems are being used, and the like. It's really hard to give any advice or suggestions when the information is so sparse.

Examine the logs -- maybe there is a clue there. Verify that your downstream device(s) are still part of the expected network created by your OpenWrt device and/or look at the logs on those devices. Run traces and TCP dumps. Ask in the 3rd party forums where you've seen other people supporting your device.

1 Like

Finally I solved this problem.
The default vlan configure is not compatible to my device. After realizing this, I modified switch settings before compiling finished. The ipaddr of lan, actually, would not make the router disappeared from "network" any more. But this is also a issue in which in this case, router cannot connect to the up-level fiber optical modem.
Now, my device becomes perfect. I'm going to submit a merge to the official branch if they're friendly. Considering the previous situation, it might be another tough project. :slight_smile:
Anyway, thank you for your help. The conversation with you did help me a lot in solving it down.

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