Ping a device in another network

Hi, I am really new in OpenWRT and in networking.
I am trying to ping to 192.168.2.1 from a device 192.168.1.x without success

But when I ping the inverse it works I mean ping to 192.168.1.1 from 192.168.2.x.
This is my config network file:

root@OpenWrt:/etc/config# cat network 

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fdd4:a639:f35e::/48'

config interface 'lan'
	option type 'bridge'
	option ifname 'eth1 eth2 eth3'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option ipaddr '192.168.2.1'
	option gateway '192.168.1.1'

config interface 'wan'
	option ifname 'eth0'
	option proto 'dhcp'

config interface 'wan6'
	option ifname 'eth0'
	option proto 'dhcpv6'

config interface 'VPN'
	option ifname 'ipsec0'
	option proto 'static'
	option ipaddr '10.10.10.1'
	option netmask '255.255.255.0'

I want to do establish connection between those devices for copy files through network.
Thanks in advance.

This makes sense for two reasons:

  1. The OpenWrt router is (most likely) operating in NAT Masquerading mode with the firewall enabled, so the pings cannot get though the firewall to the network behind the OpenWrt router.
  2. The main router (Nokia) doesn't know where the 192.168.2.0/24 network is and how to reach it.

Does the Nokia device have the ability to add static routes?

I think you refer to this.


What should I do in this case?

I assume the Nokia router (.1.0 network) is plugged into the wan port of the OpenWrt router.

So the OpenWrt router holds a 192.168.1.X IP due to DHCP from the Nokia. First remove the option gateway from the LAN network that is wrong it should not be there. The gateway is through the WAN network and has been set automatically by DHCP.

Ordinarily the routing is one way that a .2 client will have their IP masqueraded to the .1 IP of the OpenWrt router as it leaves there. Thus the .1 network does not know there is a .2 network and there is no way to reach it directly. This is usually desirable for security. If you trust everything in both networks you can set up symmetric routing where the .2 network is open to the .1 as you want. (More specific firewall rules can be set up to limit some access later).

Change the wan proto to static and set the IP address to 192.168.1.2 (or some other known and not currently in use IP in the Nokia network) and set the gateway and dns (in wan) to 192.168.1.1.

Next you need to install a static route in the Nokia: the route to 192.168.2.0/24 is via 192.168.1.2. Nearly all stock firmware has a way to do this.

Then back on the OpenWrt router, turn off masquerade in the wan firewall zone, and set up a forward from wan to lan (in addition to the existing one from lan to wan). You now have symmetric routing between the two networks. Any .2.0 IP can be reached by clients on the .1 network and vise versa. Finally you may want to change the wan input default to accept so that OpenWrt itself can be reached from the .1 side.

1 Like

Yes, exactly... good that it is there:

add a route on the Nokia router: 192.168.2.0/24 via 192.168.1.x (where x is replaced by the address of the OpenWrt WAN).

Then you'll need to turn off masquerading on the WAN zone in the firewall, and finally allow WAN > LAN forwarding

@psherman @mk24
I cannot install the static route in the Nokia router


I've tried with this, but the option "VIA" doesn't exists in the form.

oh... "via" would also be "gateway"... so the network is 192.168.2.0/24 (/24 = 255.255.255.0) with gateway 192.168.1.x.

If you follow @mk24 's comment (which was posted as I was typing my response), the recommendation was to set a static IP on the OpenWrt WAN -- that is the address that will be used in place of the 192.168.1.x above.

I've tried to do this with the Nokia router but it don't let me.


In the other IPv4 interface it says me this:

So I don't really know what I'm doing bad.

How are the Nokia and the OpenWrt connected? IPSEC over the internet?

Hi Trendy, those them are connected via Ethernet cable on eth0 in the OpenWRT and port 3 on the Nokia Router.
About the IPSEC I have only found this config.

Then on Nokia you need to add the static route for 192.168.2.0 mask 255.255.255.0 gateway 192.168.1.X (where .X is the IP that OpenWrt gets on wan interface)

The problem is the same, it doesn't let me becasue pppoe


And if I select he second interface it says me that the gateway is not in the same subnet.

You are using the wrong gateway.
And the interface should be the LAN on Nokia.

1 Like

Thanks for the help. In other hand these are the the configurations of thos interfaces.
1:


2:

These are both wan interfaces, they are not applicable in your case. If there is no lan interface in the drop down list in the static routes, there is not much you can do.

1 Like

It says me exactly the same in the two interfaces.

That's true, there is not another interface in the dropdown list.I don't know what more can I do.