Manual:Simple Static Routing
Ether1 of Router1 is connected to ISP and will be the gateway of our networks. Router2 is connected to ether2 of Router1
and will act as a gateway for clients connected to it from LAN2. Router1 also connects one client to ether3. Our goal is to
create setup so that clients from LAN1 can reach clients from LAN2 and all of them can connect to internet.
Configuration
Lets consider that ISP gave us an address 10.1.1.2/30 and gateway is 10.1.1.1
Router1:
/ip address
add address=10.1.1.2 interface=ether1
add address=172.16.1.1/30 interface=ether2
add address=192.168.1.1/24 interface=ether3
/ip route
add gateway=10.1.1.1
add dst-address=192.168.2.0/24 gateway=172.16.1.2
Router2:
/ip address
add address=172.16.1.2/30 interface=ether1
add address=192.168.2.1/24 interface=ether2
/ip route
add gateway=172.16.1.1
If you look at configuration then you will see that on Router1 we added route to destination 192.168.2.0/24. It is required
for clients from LAN1 to be able to reach clients on LAN2. On Router2 such route is not required since LAN1 can be
reached by default route.
Simple Static Routes Example
This is a very simple example. If you need to ping an IP address in the network and you are not sure if you
configured your static routes OK, this little article could help you understand how...
Example scenario:
Host 1:
/ip address add address=192.168.2.2/24 interface=ether1
/ip route add dst-address=192.168.0.0/16 gateway=192.168.2.180
This adds an IP address 192.168.2.2 with subnet mask 255.255.255.0 (/24) to interface ether1 of Host1. The /ip
route means: all packets destined to 192.168.x.x will be sent to the router 192.168.2.180, which in turn will forward
them to their destination when we add the below configuration:
Host 2:
/ip address add address=192.168.1.69/24 interface=ether1
/ip route add dst-address=192.168.0.0/16 gateway=192.168.1.180
Router 1:
/ip address add address=192.168.2.180/24 interface=ether1
/ip address add address=192.168.21.1/24 interface=ether2
/ip route add dst-address=192.168.1.0/24 gateway=192.168.21.2
The route entry makes all packets with dst-address 192.168.1.x received from any interface, be sent through
gateway 192.168.21.2.
Router 2:
/ip address add address=192.168.21.2/24 interface=ether1
/ip address add address=192.168.1.180/24 interface=ether2
/ip route add dst-address=192.168.2.0/24 gateway=192.168.21.1
The route entry makes all packets with dst-address 192.168.2.x received from any interface, be sent through
gateway 192.168.21.1, since that router is connected to the destination network - it is the correct path.
This way we get ping and trace to all hosts from all hosts in this network.
An alternative approach to have connectivity among all hosts would be a Bridge setup, when all hosts are in the
same subnet. But in the real world most ISPs etc prefer to segment the network..