A cable modem with built in primary router provide the internet. So there are no “wan” port on the primary router. Primary router has IP 192.168.0.1 and acts as DHCP server.
A mini old laptop EEEPC with installed openwrt will be my secondary router. It only has one wired NIC port. No wireless. Connect it’s wired NIC port to one of the primary router’s “lan” ports. And changed its IP to static 192.168.0.20/24. Disable its DHCP as there already has one DHCP server from the primary router. From Luci Networks/Diagnostic/ping, bad connection. Also tried following on CLI of the EEEPC:
nslookup google.com 126.96.36.199 //showing some IP, seems some connection.
nslookup google.com // showing bad connection.
ping 188.8.131.52 //showing some IP, seems some connection.
ping google.com //showing bad connection.
First step I want to let this EEEPC can connect to internet. But how?
Haven’t try vgaetera’s suggestion. Want to clarify first.
You can't build an orthodox router with one NIC only.
It would require either iptables/sysctl tricks or utilizing VLANs to mimic standard behavior.
About that topic I have theoretical knowledge only, so all the testing and troubleshooting would be on yourself.
To use as a LAN client with a static IP, you also have to set up the gateway and DNS options on the LAN network. The gateway is the main router IP. The DNS server can be the main router or a third party like 184.108.40.206. With these settings OpenWrt can reach the Internet. You don't need a WAN network since it isn't actually routing anything.
As others mentioned, the most likely use case for such a machine is as a VPN client or server giving other computers on your LAN access to a VPN.
config the eth0 as static IP eg. 192.168.0.20/24 (the primary router is 192.168.0.1)
gateway IP using the primary router's IP 192.168.0.1
DNS is also udsing192.168.0.1
In the future, other LAN client (my laptop A) will configured as static IP eg. 192.168.0.21 with its gateway IP configured as 192.168.0.20 which is my EEEPC(openwrt) IP. So my laptop A will go to EEEPC(openwrt) first, then EEEPC will go to primary router to connect to internet.
The problem now is EEEPC(openwrt) fail to connect to internet.
Got it -- took me a minute with the acronym and why you didn't use more than those letters, but I much better understand the situation now.
(Depending on which EEPC you have, it may be a better choice with an Ethernet dongle than a cheap wireless router as your application doesn’t require wireless and benefits from CPU power)
Another option may be one of the inexpensive routers supported by OpenWrt, with many suggestions and opinions in the long thread linked below. I don't know what prices / availability there are where you are, but many are not much more expensive than a USB Ethernet dongle here in the US (US$20 or less).