1. Static Routes - Configured by the administrator manually. The administrator must also update the table manually every time a change to the network takes place. Static routes are commonly used when routing from a network to a stub (a network with a single route) network.
A static route adds an entry to the routing table for a specific destination IP address or subnet.
To configure a static route, issue the
ip route prefix mask {ip-address | interface-type interface-number [ip-address]} [distance] [name] [permanent] [tag tag] command in global configuration mode
Static Routing: It may be implemented in either one of two ways by using ip route command:
1. By using the next-hop address
Ex: Router(config)#ip route 192.204.1.64 255.255.255.240 192.204.1.2
192.204.1.64 = destination network
255.255.255.240 = subnet mask
192.204.1.2 = next-hop address
Remember this by reading as: To get to the destination network of 192.204.1.64, with a subnet mask of 255.255.255.240, send all packets to 192.204.1.2
2. By using the exit interface
Router(config)#ip route 192.204.1.64 255.255.255.240 s0/0
192.204.1.64 = destination network
255.255.255.240 = subnet mask
s0/0 = exit interface
Remember this by reading as: To get to the destination network of 192.204.1.64, with a subnet mask of 255.255.255.240, send all packets out interface Serial 0/0
You must specify either the output interface (the interface on which all packets are sent to the destination network) or the next-hop address in a fully specified static route. You can use a fully specified static route when the output interface is a multi-access interface and you need to identify the next-hop address. The next-hop address must be directly attached to the specified output interface.
Fully Specified Static Route: You must specify both the output interface (the interface on which all packets are sent to the destination network) and the next-hop address in a fully specified static route. You can use a fully specified static route when the output interface is a multi-access interface and you need to identify the next-hop address. The next-hop address must be directly attached to the specified output interface.
1. configure terminal
2. ip route { ip-prefix | ip-addr/ip-mask } {[ next-hop | nh-prefix ] | [ interface next-hop | nh-prefix ]} [ name nexthop-name] [ tag tag-value] [ pref ]
or
ipv6 route ip6-prefix { nh-prefix | link-local-nh-prefix } | { nh-prefix [ interface ] | link-local-nh-prefix [ interface ]} [ name nexthop-name] [ tag tag-value] [ pref ]
3. (Optional) show { ip | ipv6 } static-route
4. (Optional) copy running-config startup-config
A static route on a Cisco router is most commonly defined by using the command
Router(config)# ip route A.B.C.D (destination network/host) A.B.C.D (subnet mask) A.B.C.D (next hop)
You can also use the port identifier such as e0, s1 etc. to define the next hop address. Optionally, the "distance metric" can be added at the end of the command to change the default weight.
2. Default Routes - The default route (gateway of last resort) is used when a route is not known or is infeasible. The command is
ip route 0.0.0.0 0.0.0.0 165.44.56.5
Here 165.44.56.5 is the gateway of last resort to network 0.0.0.0
Default route is used when there is no other known route to a given IP packet's destination. Default route is also known as gateway of last resort.
syntax is for setting default route is: ip route 0.0.0.0 0.0.0.0 <next_hop_address>
EX : Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1
You can also set default route by specifying the interface as :
Router(config)#ip route 0.0.0.0 0.0.0.0 s0
“ip default-gateway” command is used when ip routing is disabled on a Cisco router. The ip default-network and ip route 0.0.0.0 0.0.0.0 commands are used to set the gateway of last resort on Cisco routers that have ip routing enabled.
1. ip default-gateway <ip address>
Ex: ip default-gateway 192.168.14.2
2. ip default-network <ip address>
Ex: ip default-network 192.168.1.0
3. ip route 0.0.0.0 0.0.0.0 <ip-address>
Ex: ip route 0.0.0.0 0.0.0.0 192.168.1.2
Here 192.168.1.2 is the gateway of last resort to network 0.0.0.0
3. Dynamic Routes - As soon as dynamic routing is enabled, the routing tables are automatically updated. Dynamic routing uses broadcasts and multicasts to communicate with other routers. Each route entry includes a subnet number, the interface out to that subnet, and the IP address of the next router that should receive the packet. The commands to enable rip are:
router rip
network <major network number>
The commands to enable eigrp are :
router eigrp 0 - here 0 is the process-id
network <network-id>