5.1. Configuring IP Unicast-Routing
Overview
Function Introduction
Static routing is a concept describing one way of configuring path selection of routers in computer networks. It is the type of routing characterized by the absence of communication between routers regarding the current topology of the network. This is achieved by manually adding routes to the routing table. The opposite of static routing is dynamic routing, sometimes also referred to as adaptive routing.
In these systems, routes through a data network are described by fixed paths (statically). These routes are usually entered into the router by the system administrator. An entire network can be configured using static routes, but this type of configuration is not fault tolerant. When there is a change in the network or a failure occurs between two statically defined nodes, traffic will not be rerouted. This means that anything that wishes to take an affected path will either have to wait for the failure to be repaired or the static route to be updated by the administrator before restarting its journey. Most requests will time out (ultimately failing) before these repairs can be made. There are, however, times when static routes can improve the performance of a network. Some of these include stub networks and default routes.
Principle Description
N/A
Configuration
This example shows how to enable static route in a simple network topology.
There are 3 static routes on Switch1 one is to achieve remote network 10.10.12.0/24, the other two are to achieve the loopback addresses on Switch2 and Switch3. There is a default static route on Switch3, that is, static routes use same gateway or nexthop address. There are 2 static routes on swithc2, both of them are to achieve the remote switch’s loopback address.
step 1 Enter the configure mode
Switch# configure terminal
step 2 Enter the interface configure mode set the attributes and ip address
Configure on Switch1:
Switch(config)# interface eth-0-9
Switch(config-if)# no shutdown
Switch(config-if)# no switchport
Switch(config-if)# ip address 10.10.10.1/24
Switch(config-if)# exit
Switch(config)# interface loopback 0
Switch(config-if)# ip address 192.168.0.1/32
Switch(config-if)# exit
Configure on Switch2:
Switch(config)# interface eth-0-9
Switch(config-if)# no shutdown
Switch(config-if)# no switchport
Switch(config-if)# ip address 10.10.10.2/24
Switch(config-if)# exit
Switch(config)# interface eth-0-17
Switch(config-if)# no shutdown
Switch(config-if)# no switchport
Switch(config-if)# ip address 10.10.12.2/24
Switch(config-if)# exit
Switch(config)# interface loopback 0
Switch(config-if)# ip address 192.168.0.2/32
Switch(config-if)# exit
Configure on Switch3:
Switch(config)# interface eth-0-17
Switch(config-if)# no shutdown
Switch(config-if)# no switchport
Switch(config-if)# ip address 10.10.12.3/24
Switch(config-if)# exit
Switch(config)# interface loopback 0
Switch(config-if)# ip add 192.168.0.3/32
Switch(config-if)# exit
step 3 Configuring static route
Configure on Switch1:
Note:Specify the destination prefix and mask for the network for which a gateway is required, for example, 10.10.12.0/24. Add a gateway for each of them (in this case 10.10.10.2 for all). Since R2 is the only next hop available, you can configure a default route instead of configuring the same static route for individual addresses.
Switch(config)# ip route 10.10.12.0/24 10.10.10.2
Switch(config)# ip route 192.168.0.2/32 10.10.10.2
Switch(config)# ip route 192.168.0.3/32 10.10.10.2
Configure on Switch2:
Switch(config)# ip route 192.168.0.1/32 10.10.10.1
Switch(config)# ip route 192.168.0.3/32 10.10.12.3
Configure on Switch3:
Note:Specify 10.10.12.2 as a default gateway to reach any network. Since 10.10.12.2 is the only route available you can specify it as the default gateway instead of specifying it as the gateway for individual network or host addresses.
Switch(config)# ip route 0.0.0.0/0 10.10.12.2
step 4 Exit the configure mode
Switch(config)# end
step 5 Validation
Use the following command to display the route information on Switch1:
Switch# show ip route
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
[*] - [AD/Metric]
* - candidate default
C 10.10.10.0/24 is directly connected, eth-0-9
C 10.10.10.1/32 is in local loopback, eth-0-9
S 10.10.12.0/24 [1/0] via 10.10.10.2, eth-0-9
C 192.168.0.1/32 is directly connected, loopback0
S 192.168.0.2/32 [1/0] via 10.10.10.2, eth-0-9
S 192.168.0.3/32 [1/0] via 10.10.10.2, eth-0-9
Use the following command to display the route information on Switch2:
Switch# show ip route
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
[*] - [AD/Metric]
* - candidate default
C 10.10.10.0/24 is directly connected, eth-0-9
C 10.10.10.2/32 is in local loopback, eth-0-9
C 10.10.12.0/24 is directly connected, eth-0-17
C 10.10.12.2/32 is in local loopback, eth-0-17
S 192.168.0.1/32 [1/0] via 10.10.10.1, eth-0-9
C 192.168.0.2/32 is directly connected, loopback0
S 192.168.0.3/32 [1/0] via 10.10.12.3, eth-0-17
Use the following command to display the route information on Switch3:
Switch# show ip route
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
[*] - [AD/Metric]
* - candidate default
Gateway of last resort is 10.10.12.2 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 10.10.12.2, eth-0-17
C 10.10.12.0/24 is directly connected, eth-0-17
C 10.10.12.3/32 is in local loopback, eth-0-17
C 192.168.0.3/32 is directly connected, loopback0
Application cases
N/A