October 14, 2016

Otvorena mreža - beyond wan port

Otvorena mreža - beyond wan port

Sometimes you need to access your upstream wan router, well this is usually no possible, especially when you are using Otvorena mreža firmware.

Let's say your upstream router has 192.168.1.1 ip address, if you try to ping it you will not get a response:

# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes

--- 192.168.1.1 ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss

and if you do traceroute you will see that by default all data is routed trough digger0 or digger1 interface:

# traceroute 192.168.1.1
traceroute to 192.168.1.1 (192.168.1.1), 30 hops max, 38 byte packets
 1  10.254.0.2 (10.254.0.2)  13.184 ms  12.571 ms  13.107 ms
 2  10.254.0.14 (10.254.0.14)  14.365 ms  16.191 ms  17.410 ms

Let's check out routing table:

# ip rule
0:	from all lookup 128 
1:	from all lookup local 
500:	from all iif eth0 lookup main 
500:	from all to 92.53.140.74 lookup main 
500:	from all to 46.54.226.43 lookup main 
999:	from all lookup babel 
1000:	from all lookup olsr 
1099:	from all lookup babel_default 
1100:	from all lookup olsr_default 
32766:	from all lookup main 
32767:	from all lookup default 

So we can add a new route that will catch ip range of our wan network:

ip rule add to 192.168.1.0/24 lookup main pref 500

And that is is, now you can ping and access your upstream router.