modified on 27 July 2009 at 03:56 ••• 58,541 views

Simple Static Routes Example

From MikroTik Wiki

Jump to: navigation, search

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:


Simple Static Routes Example.gif


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..