Network Setup for the ip default-network Global Configuration Command
This configuration example shows that without any dynamic routing protocol running, a router can be configured to choose from a number of candidate default routes based on whether the routing table has routes to networks other than 0.0.0.0/0. The ip default-network command allows a router to choose a default route or a gateway of last resort by checking its routing table, rather than based on static routes configured to specific next-hops.
The ip default-network A.B.C.D command sets network A.B.C.D as the default route. Packets destined to networks that are not in the routing table (unknown destination networks) will be directed or sent to this default network.
Below shows the routing table of RT1 before any ip default-network command is configured:
RT1(config)#ip route 198.10.20.0 255.255.255.0 10.10.10.2 RT1(config)#ip route 128.30.40.0 255.255.255.0 11.11.11.2 RT1(config)#^Z RT1# RT1#sh ip route Gateway of last resort is not set 128.30.0.0/24 is subnetted, 1 subnets S 128.30.40.0 [1/0] via 11.11.11.2 10.0.0.0/24 is subnetted, 1 subnets C 10.10.10.0 is directly connected, FastEthernet0/0 11.0.0.0/24 is subnetted, 1 subnets C 11.11.11.0 is directly connected, FastEthernet1/0 C 192.168.1.0/24 is directly connected, FastEthernet2/0 S 198.10.20.0/24 [1/0] via 10.10.10.2 RT1#
If a router has a route to the network specified by the ip default-network command, the router will consider the route to that network as the gateway of last resort and flag the route as a candidate default route. Below shows the routing table of RT1 when the ip default-network 198.10.20.0 command is configured on it:
RT1(config)#ip default-network 198.10.20.0 RT1(config)#^Z RT1# RT1#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, 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, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default o - ODR, P - periodic downloaded static route Gateway of last resort is 10.10.10.2 to network 198.10.20.0 128.30.0.0/24 is subnetted, 1 subnets S 128.30.40.0 [1/0] via 11.11.11.2 10.0.0.0/24 is subnetted, 1 subnets C 10.10.10.0 is directly connected, FastEthernet0/0 11.0.0.0/24 is subnetted, 1 subnets C 11.11.11.0 is directly connected, FastEthernet1/0 C 192.168.1.0/24 is directly connected, FastEthernet2/0 S* 198.10.20.0/24 [1/0] via 10.10.10.2 RT1# RT1#sh ip protocols RT1# RT1#ping 12.12.12.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 12.12.12.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 68/92/124 ms RT1#
10.10.10.2 is now the gateway of last resort of RT1; and this result is not dependent on any routing protocol.
Below shows the configuration steps for adding another candidate default route with another ip default-network command:
RT1(config)#do sh run | in ip default-network|ip route ip default-network 198.10.20.0 ip route 128.30.40.0 255.255.255.0 11.11.11.2 ip route 198.10.20.0 255.255.255.0 10.10.10.2 RT1(config)# RT1(config)#ip default-network 128.30.40.0 RT1(config)#do sh run | in ip default-network|ip route ip default-network 198.10.20.0 ip route 128.30.0.0 255.255.0.0 128.30.40.0 ip route 128.30.40.0 255.255.255.0 11.11.11.2 ip route 198.10.20.0 255.255.255.0 10.10.10.2 RT1(config)# RT1(config)#no ip route 128.30.0.0 255.255.0.0 128.30.40.0 %No matching route to delete RT1(config)# RT1(config)#do sh ip route Gateway of last resort is 10.10.10.2 to network 198.10.20.0 128.30.0.0/16 is variably subnetted, 2 subnets, 2 masks S 128.30.0.0/16 [1/0] via 128.30.40.0 S 128.30.40.0/24 [1/0] via 11.11.11.2 10.0.0.0/24 is subnetted, 1 subnets C 10.10.10.0 is directly connected, FastEthernet0/0 11.0.0.0/24 is subnetted, 1 subnets C 11.11.11.0 is directly connected, FastEthernet1/0 S* 198.10.20.0/24 [1/0] via 10.10.10.2
Note: The network specified by the new ip default-network command is not flagged as a candidate default route; additionally, the command is not shown in the running configuration. The ip default-network command is classful. When the network specified with this command is a subnet of a major network (eg: 10.10.0.0, 172.16.1.0), the router will configure a static route to the major network number (ip route 128.30.0.0 255.255.0.0) for the ip default-network command. The static route is configured without the notice of the user, as no message will be displayed. Deleting this route requires the no ip default-network command instead of the no ip route command!
The ip default-network command must be issued again using the major network number in order to flag the network as a candidate default route. Note: The ip default-network 128.30.40.0 command must be issued in order to obtain the output below.
RT1(config)#ip default-network 128.30.0.0 RT1(config)#do sh run | in ip default-network ip default-network 198.10.20.0 ip default-network 128.30.0.0 RT1(config)# RT1(config)#do sh ip route Gateway of last resort is 128.30.40.0 to network 128.30.0.0 * 128.30.0.0/16 is variably subnetted, 2 subnets, 2 masks S* 128.30.0.0/16 [1/0] via 128.30.40.0 S 128.30.40.0/24 [1/0] via 11.11.11.2 10.0.0.0/24 is subnetted, 1 subnets C 10.10.10.0 is directly connected, FastEthernet0/0 11.0.0.0/24 is subnetted, 1 subnets C 11.11.11.0 is directly connected, FastEthernet1/0 C 192.168.1.0/24 is directly connected, FastEthernet2/0 S* 198.10.20.0/24 [1/0] via 10.10.10.2 RT1# RT1#debug ip packet IP packet debugging is on RT1# RT1#ping 12.12.12.1 rep 1 Type escape sequence to abort. Sending 1, 100-byte ICMP Echos to 12.12.12.1, timeout is 2 seconds: ! Success rate is 100 percent (1/1), round-trip min/avg/max = 268/268/268 ms RT1# 00:11:28: IP: tableid=0, s=11.11.11.1 (local), d=12.12.12.1 (FastEthernet1/0), routed via FIB 00:11:28: IP: s=11.11.11.1 (local), d=12.12.12.1 (FastEthernet1/0), len 100, sending 00:11:28: IP: tableid=0, s=12.12.12.1 (FastEthernet1/0), d=11.11.11.1 (FastEthernet1/0), routed via RIB 00:11:28: IP: s=12.12.12.1 (FastEthernet1/0), d=11.11.11.1 (FastEthernet1/0), len 100, rcvd 3 RT1#
The output of the debug ip packet privileged command shows that the new default route to 128.30.40.0 via Fa1/0 to 11.11.11.2 is in effect.
Note: If the original static route is destined to the major network, configuring the default network twice would not be necessary. To be specific, if ip route 128.30.0.0 255.255.0.0 11.11.11.2 is configured instead of ip route 128.30.40.0 255.255.255.0 11.11.11.2, only ip default-network 128.30.0.0 is required instead of both ip default-network 128.30.40.0 and ip default-network 128.30.0.0.
RT1#sh ip route Gateway of last resort is 11.11.11.2 to network 128.30.0.0 S* 128.30.0.0/16 [1/0] via 11.11.11.2 10.0.0.0/24 is subnetted, 1 subnets C 10.10.10.0 is directly connected, FastEthernet0/0 11.0.0.0/24 is subnetted, 1 subnets C 11.11.11.0 is directly connected, FastEthernet1/0 C 192.168.1.0/24 is directly connected, FastEthernet2/0 S* 198.10.20.0/24 [1/0] via 10.10.10.2 RT1# RT1#sh run | in ip default-network|ip route ip default-network 198.10.20.0 ip default-network 128.30.0.0 ip route 128.30.0.0 255.255.0.0 11.11.11.2 ip route 198.10.20.0 255.255.255.0 10.10.10.2 RT1#
The major difference between configuring a static default route with the ip route 0.0.0.0 0.0.0.0 command and using the ip default-network command is that a static default route only defines a default route for the router which the command is configured on; while the default route selected by the ip default-network command can be propagated via a routing protocol. Below shows that RT1 advertises the default route as 0.0.0.0 to Internal-RT via RIPv1. The route is designated as a candidate default route on Internal-RT.
RT1: ! router rip network 192.168.1.0 default-information originate ! ====================================================================== Internal-RT: ! router rip network 192.168.1.0 ! Internal-RT#sh ip route Gateway of last resort is 192.168.1.1 to network 0.0.0.0 C 192.168.1.0/24 is directly connected, FastEthernet0/0 R* 0.0.0.0/0 [120/1] via 192.168.1.1, 00:00:07, FastEthernet0/0 Internal-RT# Internal-RT#ping 12.12.12.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 12.12.12.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 64/101/132 ms Internal-RT#
Note: The default-information originate RIP router subcommand is required on RT1. Some routing protocols (eg: EIGRP) do not require this command to redistribute the default route.
Below shows that when RT1 loses the route to the current default network, it will select other candidate default routes as the new default network:
RT1#debug ip routing IP routing debugging is on RT1# RT1#conf t Enter configuration commands, one per line. End with CNTL/Z. RT1(config)#no ip route 128.30.40.0 255.255.255.0 11.11.11.2 RT1(config)#^Z RT1# 00:03:09: RT: del 128.30.40.0/24 via 11.11.11.2, static metric [1/0] 00:03:09: RT: delete subnet route to 128.30.40.0/24 00:03:09: RT: NET-RED 128.30.40.0/24 RT1# RT1#sh ip route Gateway of last resort is 128.30.40.0 to network 128.30.0.0 S* 128.30.0.0/16 [1/0] via 128.30.40.0 10.0.0.0/24 is subnetted, 1 subnets C 10.10.10.0 is directly connected, FastEthernet0/0 11.0.0.0/24 is subnetted, 1 subnets C 11.11.11.0 is directly connected, FastEthernet1/0 C 192.168.1.0/24 is directly connected, FastEthernet2/0 S* 198.10.20.0/24 [1/0] via 10.10.10.2 RT1# 00:04:02: RT: recursion error routing 128.30.40.0 - probable routing loop 00:04:02: RT: del 128.30.0.0 via 128.30.40.0, static metric [1/0] 00:04:02: RT: delete network route to 128.30.0.0 00:04:02: RT: NET-RED 128.30.0.0/16 00:04:02: RT: NET-RED 128.30.0.0/16 00:04:02: RT: default path is now 198.10.20.0 via 10.10.10.2 00:04:02: RT: new default network 198.10.20.0 00:04:02: RT: NET-RED 198.10.20.0/24 00:04:02: RT: NET-RED 198.10.20.0/24 RT1# RT1#sh ip route Gateway of last resort is 10.10.10.2 to network 198.10.20.0 10.0.0.0/24 is subnetted, 1 subnets C 10.10.10.0 is directly connected, FastEthernet0/0 11.0.0.0/24 is subnetted, 1 subnets C 11.11.11.0 is directly connected, FastEthernet1/0 C 192.168.1.0/24 is directly connected, FastEthernet2/0 S* 198.10.20.0/24 [1/0] via 10.10.10.2 RT1# RT1#sh run | in ip default-network|ip route ip default-network 198.10.20.0 ip default-network 128.30.0.0 ip route 128.30.0.0 255.255.0.0 128.30.40.0 ip route 198.10.20.0 255.255.255.0 10.10.10.2 RT1#
No comments:
Post a Comment