[Day 6] 7. Static and Default Routing
Static Routing
Static routing involves manually specifying routes in the routing table.
-
Command:
A(config)# ip route <Destination Network> <Subnet Mask> <Next Hop Address> -
Example:
A(config)# ip route 172.16.30.0 255.255.255.0 172.16.20.2 B(config)# ip route 172.16.10.0 255.255.255.0 172.16.20.1 -
Explanation:
- 172.16.30.0: Destination network.
- 255.255.255.0: Subnet mask for the destination network.
- 172.16.20.2: Next-hop IP address (IP address of the next router).
Important Commands
Use these after you specify the static routes:
-
Save Configuration:
A# copy run startThis saves the running configuration to the startup configuration.
-
Display Routing Table:
A# show ip routeThis command displays the router's IP routing table, listing all known networks and the paths to reach them.
Default Route
A default route is used when no other route is available for a destination network. It is often used for routing traffic to the internet or other external networks.
-
Command:
A(config)# ip route 0.0.0.0 0.0.0.0 <Next Hop Address> -
Example:
A(config)# ip route 0.0.0.0 0.0.0.0 172.16.20.2This tells the router to send all traffic destined for any network not explicitly listed in the routing table to the next-hop IP address.
Combining Routes
- Specific Routes are considered first.
- Default Routes are used if no specific route matches.
Example:
A(config)# ip route 172.16.10.0 255.255.255.0 172.16.20.1 (Specific Route) A(config)# ip route 0.0.0.0 0.0.0.0 172.16.40.2 (Default Route)
Steps for Basic Router Configuration
- (Provide hostname for the router)
Router(config)#hostname A A(config)#enable secret (password)A(config)#line con 0 / aux 0 / vty 0 4A(config)#password (password)A(config)#loginA(config)#exitA(config)#interface (id like g0/0)A(config)#no shutA(config)#ip address (ip) (subnet mask)A(config)#ip route (destination network) (subnet mask) (next-hop-address)
Exit Interface
The exit interface refers to the network interface on a router used to forward packets towards their destination. It specifies the physical or virtual interface used for outbound traffic.
-
Routing Table Example:
10.1.1.0/24 [90/30720] via 192.168.1.1, 00:00:10, FastEthernet0/1- 10.1.1.0/24: Destination network.
- via 192.168.1.1: Next-hop IP address.
- FastEthernet0/1: Exit interface.
In this example, packets destined for 10.1.1.0/24 are forwarded out of the FastEthernet0/1 interface to reach the next-hop IP address 192.168.1.1.
Drawbacks
- Multi-Access Network Scenario:
If the next network has multiple exit points, the exit interface may not always work effectively. - Solution:
The best solution is to use the next-hop address rather than relying on the exit interface in such scenarios.
Read Next
[Day 6] 8. Register Values and Password Recovery
### **Configuration Register Values**: 1. **0x2142**: - Bypasses the **NVRAM startup configuration** during the boot process. - Thi...
[Day 7] 1. Static Routes
### **Network Topology** Consider a network with three routers—A, B, and C—connected in a triangular fashion: - **Router A**: - `172....