Difference between revisions of "Simple Static Routes Example"

From MikroTik Wiki
Jump to: navigation, search
(New page: 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 understa...)
 
m
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
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.
+
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:
 
Example scenario:
 +
 +
 
[[Image:Simple_Static_Routes_Example.gif]]
 
[[Image:Simple_Static_Routes_Example.gif]]
  
[http://www.picvalley.net/u/1292/2105124489.GIF Simple_Static_Routes_Example.gif]
 
  
 
'''Host 1:'''
 
'''Host 1:'''
Line 13: Line 14:
 
</pre>
 
</pre>
  
This adds an IP address 192.168.2.2 with subnet mask 255.255.255.0 (/24) to interface ether1.
+
This adds an IP address 192.168.2.2 with subnet mask 255.255.255.0 (/24) to interface ether1 of Host1.
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:
+
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:'''
 
'''Host 2:'''
Line 41: Line 42:
 
</pre>
 
</pre>
  
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.
+
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.
 
This way we get ping and trace to all hosts from all hosts in this network.
  
Alternative: Bridge setup.
+
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..

Latest revision as of 06:56, 27 July 2009

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