Static routes while manually intensive to keep up, are a very quick and effective way to route data from one subnet to different subnet. Lets start with the basics.
What is a static route? - a static route is a hard coded path in the router that specifies how the router will get to a certain subnet by using a certain path.
What do you mean by "hard coded"? - you or someone has typed in the network ID and the next hop to get to the network specified
How do I add a static route into my Cisco router? - Pretty simple router# config t ; get into the configuration mode router(config)# ip route A.B.C.D (destination network/host) A.B.C.D (mask) A.B.C.D (next hop); this is a simple static route
Are there any other ways to name the next hop except by using an IP address? - Yes, you can use the port name i.e. ethernet0, E0, S0 and so on
What is "distance metric" that I can add at the end of the command? - all routes have a value that allows the router to give a priority to which type of routing is used first. In static routes, the value is 1 which means no matter what other protocol you may have running like OSPF or RIP, the static route will always be used first. This can be changed to special needs. for example, if you have a frame link with ISDN back up, you can static routes for the frame and a second set of the same static routes but with a distance matric of 255. This means while the frame is up, it goes first but when the frame goes down, the router will try to use the 2nd static which is normally ignored due to the 255 value.
Why do I want to use static routes when there are neat routing protocols like OSPF? - static routes are easy, no overhead either on the link or the the CPU of the router. They also offer good security when coupled with a tight IP mask like 252 which gives only 2 hosts on a given link
If static routes are so easy, why not use them all the time? - Static routes while easy can be overwhelming in a large or complicated network. Each time there is a change, someone must manually make changes to reflect the change. If a link goes down, even if there is a second path, the router would ignore it and consider the link down.
One of the most common uses of a static map is the default classless route
- ip classless - ip route 0.0.0.0 0.0.0.0 [next hop]
This static map says that everything is remote and should be forwarded to the next hop( or supernet) which will take care fo the routing.
Dial on demand is also a big user of static routes. Many times with dial up or ISDN, you do not have the bandwidth or you do not want to pay the connection fees for routing updates so you use static routes.
Static routes allow you to set up load balancing after a fashion. Keep in mind that the IOS load balances across routes first and not interfaces. The easiest way to configure multiple routes on the same interface is to use the secondary IP command
Router 1 ! interface serial 0 ip address 192.0.0.1 255.255.255.0 ip address 192.0.0.2 255.255.255.0 secondary ! second route on same interface
interface serial 1 ip address 22.214.171.124 255.255.255.0 ip address 126.96.36.199 255.255.255.0 secondary
ip route 188.8.131.52 255.255.255.0 184.108.40.206; goes to serial 0 ip route 220.127.116.11 255.255.255.0 18.104.22.168; goes to serial 0 ip route 22.214.171.124 255.255.255.0 126.96.36.199; goes to serial 1
Router 2 ! interface ethernet 0 ip address 188.8.131.52 255.255.255.0 ! interface serial 0 ip address 184.108.40.206 255.255.255.0 ip address 220.127.116.11 255.255.255.0 secondary ! interface serial 1 ip address 18.104.22.168 255.255.255.0 ip address 22.214.171.124 255.255.255.0 secondary
The traffic would go out router 1 across the two IPs on serial 0 first then across 1 IP on serial 1 This gives you unequal load balancing.
This is just the basics of static routing. You can get very creative if you want and take things further then described here. I would suggest "Routing TCP/IP Vol 1" from Cisco Press for more information