OpenWrt Forum Archive

Topic: [SOLVED] Forward 2nd wired lan (from 2nd router) out to Internet

The content of this topic has been archived on 6 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have an issue I can't seem to figure out with alot of research.
How can I forward a second wired network out of the WAN port? No Vlans. No wireless (AP).

-I have the OpenWRT network x.x.1.0 (Running CC 15)
-Second router has x.x.2.0.
-Both have STATIC ROUTES that work. x.x.2.x can ping x.x.1.1 and vise versa.
-Second router has firewall OFF. Forwarding both networks. Even proxy arp.

I can find no supporting documentation, tutorials, examples, forum posts etc on this.
All I found was info for AP Guest networks and Vlan trunking. I'm using neither.
I don't need DHCP or DNS on 2nd network. I can forward out to ISP DNS and DHCP is covered by router2.

I'm not iptables savvy and don't want to break my OpenWRT WAN settings. Seems I can only have a direct-connect interfaces as a ZONE so I can't use the GUI for this.

ROUTER1
me@OpenWrt:~# route -n
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         ISP     0.0.0.0         UG    0      0        0 eth0
ISP        0.0.0.0         255.255.224.0   U     0      0        0 eth0
ISP    0.0.0.0         255.255.255.255 UH    0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 br-lan
192.168.2.0     192.168.1.250   255.255.255.0   UG    1      0        0 br-lan << STATIC ROUTE

cat /etc/config/network
config route << STATIC ROUTE
        option interface 'lan'
        option target '192.168.2.0'
        option netmask '255.255.255.0'
        option gateway '192.168.1.250'
        option metric '1'
        option mtu '1500'

me@OpenWrt:~# ping -c1 192.168.2.233 < DHCP on x.x.2.0 network
PING 192.168.2.233 (192.168.2.233): 56 data bytes
64 bytes from 192.168.2.233: seq=0 ttl=127 time=0.887 ms WORKS
--------------
ROUTER 2
me@Router2:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
       I - ISIS, B - BGP, > - selected route, * - FIB route

S>* 0.0.0.0/24 [1/0] via 192.168.1.1, eth0 < STATIC ROUTE & DEFAULT GATEWAY
C>* 127.0.0.0/8 is directly connected, lo
C>* 192.168.1.0/24 is directly connected, eth0
C>* 192.168.2.0/24 is directly connected, switch0
----------------------

2nd network client
x.x.2.233>ping -n1 192.168.1.1
Sent=1, Received =1, Lost = 0 (0% Loss) WORKS
--------------
1st network client
x.x.1.30>ping 192.168.2.233
Packets: Sent = 2, Received = 2, Lost = 0 (0% loss), WORKS

But x.x.2.0 network can't go out to the Internet.
Please help if you can. Appreciated smile

(Last edited by shockedquartz on 2 Mar 2018, 23:45)

shockedquartz wrote:

S>* 0.0.0.0/24 [1/0] via 192.168.1.1, eth0 < STATIC ROUTE & DEFAULT GATEWAY

The line above looks odd. Shouldn't it be 0.0.0.0/0 instead of 0.0.0.0/24.

And I also recommend using a separate network between the routers instead of using the LAN which can result in asymmetric routing in LAN-to-LAN traffic.

The line above looks odd. Shouldn't it be 0.0.0.0/0 instead of 0.0.0.0/24.

Good call. I haven't done router/switch stuff in almost a decade. tongue

And I also recommend using a separate network between the routers

This OS seems to deal with all switch ports as a single network bridged. wlan/br-lan, etc.
It's not clear how this can be done. Certainly not in the gui. Or supported. I'm trying to avoid sub-interfaces and vlans and all the trunking fun. But if it's necessary. But does it solve the original problem?

Router treats the other stub network as foreign. It's routing it. Just dropping it instead of NATing.

It's not clear why a Router OS is so focused on being an Access Point with little to no mention of actual routing.
Is users having another wired network so rare in the life-time of OpenWRT? I feel old even saying that.

I tried fix #1 and it's the same. OpenWRT on x.x.1.0 treats x.x.2.0 as foreign and drops.

There's nothing in the snippets above (apart from the 0.0.0.0/24 0.0.0.0/0 confusion) to suggest that routing should not be possible.

Can you post the contents of /etc/config/network, /etc/config/firewall, and /etc/config/dhcp from your OpenWRT box? Sanitise any passwords which may be revealed.

600cc wrote:

There's nothing in the snippets above (apart from the 0.0.0.0/24 0.0.0.0/0 confusion) to suggest that routing should not be possible.

Can you post the contents of /etc/config/network, /etc/config/firewall, and /etc/config/dhcp from your OpenWRT box? Sanitise any passwords which may be revealed.

Hello.
The issue was the static route type on the openwrt/lede router. I set it to unicast and that worked.

The discussion might have continued from here.