Simple Static Routes Example

From MikroTik Wiki
Revision as of 14:31, 6 January 2009 by Normis (talk | contribs)
Jump to: navigation, search

This is a newbie tutorial. If you wonder how to ping an IP address in the network and you are not sure if you configured your static routes OK, this little article should help you understand it all.

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. The route means: all packets destined to 192.168.x.x will be sent to router 192.168.2.180 which will forward them to the 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.

This way we get ping and trace to all hosts from all hosts in this network.

Alternative: Bridge setup.