Community discussions

MikroTik App
 
splichy
just joined
Topic Author
Posts: 4
Joined: Mon May 04, 2015 3:03 pm

Static route via directly connected nexthop from different subnet

Wed Sep 02, 2015 12:57 am

Hi,

I have two subnets in one LAN and I need to route some traffic from mikrotik via nexthop in other subnet, see attached drawing.
NW_dia.png
In linux is solution quite simple:
ifconfig eth0 xx.yy.252.196/29 //ip addres from 1st subnet
ip route add xx.yy.247.168/29 via dev eth0 //route to directly connected subnet
ip route add 10.71.0.0/16 via xx.yy.247.171 //route via gw from other directly connected subnet

So in mikrotik I have this related configuration:
/ip address print detail 
 4 D address=xx.yy.252.196/29 network=xx.yy.252.192 interface=eth1-vl882 
     actual-interface=eth1-vl882 

/ip route print detail 
 1 A S  dst-address=0.0.0.0/0 pref-src=xx.yy.252.196 gateway=xx.yy.252.193 
        gateway-status=xx.yy.252.193 reachable via  eth1-vl882 
        check-gateway=ping distance=2 scope=30 target-scope=10 

 6   S  dst-address=10.71.0.0/16 pref-src=xx.yy.252.196 gateway=xx.yy.247.171 
        gateway-status=xx.yy.247.171 unreachable distance=10 scope=30 
        target-scope=10 

15 A S  dst-address=xx.yy.247.168/29 gateway=eth1-vl882 
        gateway-status=eth1-vl882 reachable distance=1 scope=10 target-scope=10 

17 ADC  dst-address=xx.yy.252.192/29 pref-src=xx.yy.252.196 gateway=eth1-vl882 
        gateway-status=eth1-vl882 reachable distance=0 scope=10 


/ping xx.yy.247.171
  SEQ HOST                                     SIZE TTL TIME  STATUS             
    0 xx.yy.247.171                             56  64 0ms  
    1 xx.yy.247.171                             56  64 0ms  
    2 xx.yy.247.171                             56  64 0ms  

/tool traceroute xx.yy.247.171
 # ADDRESS                          LOSS SENT    LAST     AVG    BEST   WORST
 1 xx.yy.247.171                     0%    9   0.3ms     0.5     0.3     2.4
but gateway-status=xx.yy.247.171 unreachable :/

when I change target-scope:
5 A S  dst-address=10.71.0.0/16 pref-src=xx.yy.252.196 gateway=xx.yy.247.171 
        gateway-status=xx.yy.247.171 recursive via xx.yy.252.193 eth1-vl882 
        distance=10 scope=30 target-scope=30 
But default GW doesn't know about subnet 10.71.0.0/16 - why is route recursive via default GW, when I have correct route to 2nd subnet?

Any suggestions?

Thx
You do not have the required permissions to view the files attached to this post.
 
jonathan2493
newbie
Posts: 25
Joined: Fri Feb 13, 2015 4:25 am

Re: Static route via directly connected nexthop from different subnet

Fri Sep 11, 2015 1:36 pm

since you dont have a subnet of xx.yy.247.168/29 on the mikrotik router, you need to route it first towards the internet router. The internet router would then look at the destination subnet(10.71.0.0/16) towards the next hop of xx.yy.247.171.

On the mikrotik router:
ip route add dst-address=10.71.0.0/16 gateway=xx.yy.252.193
On the internet router:
ip route add dst-address=10.71.0.0/16 gateway=xx.yy.247.171
On the firewall pic:
ip route add dst-address=xx.yy.252.192 gateway=xx.yy.247.169
hth