Community discussions

MikroTik App
 
protoplast
just joined
Topic Author
Posts: 2
Joined: Wed Sep 19, 2012 5:07 pm

Route between two LANs Newbie question

Wed Sep 19, 2012 7:27 pm

Hi Hope someone can point me in the right direction.

I have a RB450 (updated to RouterOS 5.20)

2 LANs (172.16.1.0/24 (Main LAN) and 172.16.99.0/24 (Other LAN))

I would like the machines on the two LANs to be able to connect to each other through the router.

I have done a factory reset of the routerboard using winbox and the first time I connect I have said don't do the default config (I have also tried letting it do the default config).

Then added the two interface addresses:
 /ip address
add address=172.16.1.251/24 comment="Main LAN" disabled=no interface=\
    ether2 network=172.16.1.0

/ip address
add address=172.16.99.251/24 comment="Second LAN" disabled=no interface=\
    ether5 network=172.16.99.0 
I then added what I think is a firewall rule to allow forward between the two (i'm guessing this is where I am missing the point !) :
/ip firewall filter add action=accept chain=forward in-interface=ether2
/ip firewall filter add action=accept chain=forward in-interface=ether5
(there are no other firewall rules)

Then plugged a network cable into ports eth2 and eth5 of the routerboard from the respective network switches.

on a machine (172.16.1.141) on the 172.16.1.x network I have added a route
route add 172.16.99.0 mask 255.255.255.0 172.16.1.251

on a machine (172.16.99.20) on the 172.16.99.x network I have added a route
route add 172.16.1.0 mask 255.255.255.0 172.16.99.251

from the machine (172.16.1.141) on the 172.16.1.x network I can ping 172.16.99.151 (the other port on the router) and this works fine but I can't ping an actual machine (172.16.99.20).

If some one could help me I would be very grateful.

As you can tell I am RouterOS Newbie!!

Thanks
 
jadu
Frequent Visitor
Frequent Visitor
Posts: 86
Joined: Sat Feb 05, 2011 9:22 am
Location: Bucharest - Constanta

Re: Route between two LANs Newbie question

Thu Sep 20, 2012 1:15 pm

You need to add 2 routes:
dst address 172.16.1.0/24 gateway ether2 (optionaly you can put pref source 172.16.1.251)
dst address 172.16.99.0/24 gateway ether5 (optionaly you can put pref source 172.16.99.251)

Regards
 
protoplast
just joined
Topic Author
Posts: 2
Joined: Wed Sep 19, 2012 5:07 pm

Re: Route between two LANs Newbie question

Thu Sep 20, 2012 3:47 pm

Thanks jadu

That has worked, when I added the IP addresses to the two ports originally, two routes very similar to the two you suggested where created automatically, so I assumed they did not need to be manually added.

So you can see there is now two of each, is this correct ?
[admin@MikroTik] /ip route> print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 ADC  172.16.1.0/24      172.16.1.251    ether2                    0
 1   S  172.16.1.0/24      172.16.1.251    ether2                    1
 2 ADC  172.16.99.0/24     172.16.99.251   ether5                    0
 3   S  172.16.99.0/24     172.16.99.251   ether5                    1
[admin@MikroTik] /ip route>
Thanks
 
jadu
Frequent Visitor
Frequent Visitor
Posts: 86
Joined: Sat Feb 05, 2011 9:22 am
Location: Bucharest - Constanta

Re: Route between two LANs Newbie question

Mon Sep 24, 2012 3:36 pm

The routes that were added automatically when you've added the manually ones they will be deleted as well when you delete the manually routes.
 
rftnon
newbie
Posts: 29
Joined: Fri Feb 28, 2014 6:34 pm

Re: Route between two LANs Newbie question

Mon Apr 17, 2017 11:13 am

This topic is important and useful
 
MATU
just joined
Posts: 13
Joined: Thu Apr 03, 2014 11:01 am

Re: Route between two LANs Newbie question

Sun Jul 02, 2017 9:19 pm

I have bridge that I have assigned ip 172.16.2.254/24 and ip 172.16.1.254/24
The solution posted above always works when dealing with individuals ether ports but how comes it doesn't work when using a bridge? I still cant ping devices from the other network. I can only ping 172.16.1.254 and 172.16.2.254 only.
I have tried to put the static routes 172.16.1.0/24 gateway:172.16.1.254 and 172.16.2.0/24 gateway:172.16.2.254 but still cant ping across.
Kindly assist.
 
moaiad
just joined
Posts: 1
Joined: Wed Sep 06, 2017 9:47 am

Re: Route between two LANs Newbie question

Wed Sep 06, 2017 10:05 am

Hi i have RB2011UiAS and i configured it as the following:
ether 1 --> WAN 1
ether 9 --> WAN 2
ether 2 --> lan (192.168.10.0/24)
ether 3 --> lan (192.168.20.0/24)
ether 4 --> lan (192.168.30.0/24)
......
this is my route:

# DST-ADDRESS PREF-SRC GATEWAY DISTANCE
0 A S 0.0.0.0/0 6.10.15.25 1
1 S 0.0.0.0/0 192.168.1.1 1
2 ADC 6.10.15.24/29 6.10.15.26 ether1 0
3 DC 192.168.1.0/24 192.168.1.200 ether9 255
4 ADC 192.168.10.0/24 192.168.10.1 ether2 0
5 ADC 192.168.20.0/24 192.168.20.1 ether3 0
6 ADC 192.168.30.0/24 192.168.30.1 ether4 0
7 ADC 192.168.40.0/24 192.168.40.1 ether5 0
8 DC 192.168.50.0/24 192.168.50.1 ether6 255
i marked the WAN interfaces to separate the internet between my networks

I have a web service working on 192.168.10.10 ip address and i want to make it reachable from 192.168.20.0 network.
Thanks