banner



How To Find The Default Gateway On A Cisco Router

Contents

Introduction

Default routes are used to direct packets addressed to networks not explicitly listed in the routing table. Default routes are invaluable in topologies where learning all the more specific networks is non desirable, every bit in instance of stub networks, or not viable due to limited system resources such as memory and processing power.

This certificate explains how to configure a default route, or gateway of last resort. These IP commands are used:

  • ip default-gateway

  • ip default-network

  • and ip route 0.0.0.0 0.0.0.0

Prerequisites

Requirements

There are no specific requirements for this certificate.

Components Used

This document is non restricted to specific software and hardware versions. The command outputs shown are from the Cisco 2500 Series routers running Cisco IOS® Software Release 12.2(24a).

The information presented in this document was created from devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If you are working in a alive network, ensure that you sympathize the potential impact of whatever control before using information technology.

Conventions

For more data on document conventions, run across the Cisco Technical Tips Conventions.

ip default-gateway

The ip default-gateway command differs from the other ii commands. It should only exist used when ip routing is disabled on the Cisco router.

For instance, if the router is a host in the IP world, you can use this control to define a default gateway for it. You might also apply this command when your low terminate Cisco router is in kicking mode in order to TFTP a Cisco IOS® Software image to the router. In boot mode, the router does not take ip routing enabled.

This example defines the router on IP address 172.xvi.fifteen.4 equally the default road:

ip default-gateway 172.sixteen.xv.4

ip default-network

Unlike the ip default-gateway control, you can employ ip default-network when ip routing is enabled on the Cisco router. When you configure ip default-network the router considers routes to that network for installation every bit the gateway of concluding resort on the router.

For every network configured with ip default-network, if a router has a route to that network, that route is flagged equally a candidate default route. This network diagram displays the routing tabular array taken from router 2513:

fig1.gif

2513#show ip route            Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area        N1 - OSPF NSSA external blazon 1, N2 - OSPF NSSA external type two        E1 - OSPF external type 1, E2 - OSPF external type 2, Due east - EGP        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-i, L2 - IS-IS level-ii        ia - IS-IS inter surface area, * - candidate default, U - per-user static route        o - ODR, P - periodic downloaded static road  Gateway of final resort is non set       161.44.0.0/24 is subnetted, one subnets C       161.44.192.0 is directly connected, Ethernet0      131.108.0.0/24 is subnetted, 1 subnets C       131.108.99.0 is directly connected, Serial0 S    198.10.one.0/24 [1/0] via 161.44.192.ii

Note the static road to 198.10.1.0 via 161.44.192.ii and that the gateway of final resort is not set. If you lot configure ip default-network 198.10.i.0, the routing tabular array changes to this:

2513#evidence ip route            Codes: C - connected, S - static, I - IGRP, 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 blazon 2        E1 - OSPF external blazon 1, E2 - OSPF external type 2, Due east - EGP        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2        ia - IS-IS inter area, * - candidate default, U - per-user static route        o - ODR, P - periodic downloaded static route  Gateway of concluding resort is 161.44.192.2 to network 198.10.ane.0       161.44.0.0/24 is subnetted, i subnets C       161.44.192.0 is directly connected, Ethernet0      131.108.0.0/24 is subnetted, 1 subnets C       131.108.99.0 is directly connected, Serial0 S*   198.10.i.0/24 [ane/0] via 161.44.192.two R1# 2513#show ip protocols            2513#

The gateway of final resort is now ready every bit 161.44.192.2. This result is independent of any routing protocol, as shown by the show ip protocols command at the lesser of the output.

You tin can add another candidate default route by configuring another instance of ip default-network:

2513#configure concluding            Enter configuration commands, one per line.  Stop with CNTL/Z. 2513(config)#ip road 171.70.24.0 255.255.255.0 131.108.99.2            2513(config)#ip default-network 171.70.24.0            2513(config)#^Z            2513#show ip route            Codes: C - connected, S - static, I - IGRP, R - RIP, K - mobile, B - BGP        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area        N1 - OSPF NSSA external type one, N2 - OSPF NSSA external blazon 2        E1 - OSPF external type 1, E2 - OSPF external type 2, Due east - EGP        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2        ia - IS-IS inter area, * - candidate default, U - per-user static route        o - ODR, P - periodic downloaded static road  Gateway of terminal resort is 161.44.192.2 to network 198.10.1.0       171.70.0.0/xvi is variably subnetted, two subnets, ii masks S       171.70.0.0/16 [i/0] via 171.lxx.24.0 Due south       171.70.24.0/24 [1/0] via 131.108.99.ii      161.44.0.0/24 is subnetted, 1 subnets C       161.44.192.0 is directly connected, Ethernet0      131.108.0.0/24 is subnetted, 1 subnets C       131.108.99.0 is directly connected, Serial0 Southward*   198.10.1.0/24 [i/0] via 161.44.192.2

Later the ip default-network command was entered in the output above, the network was not flagged as a default network. The Flag a Default Network section explains why.

Flag a Default Network

Note:The ip default-network command is classful. This means that if the router has a route to the subnet indicated past this command, it installs the route to the major net. At this point neither network has been flagged equally the default network. The ip default-network command must be issued once again, using the major net, in order to flag the candidate default route.

2513#configure last            Enter configuration commands, i per line. Cease with CNTL/Z.  2513(config)#ip default-network 171.70.0.0            2513(config)#^Z            2513#evidence ip route            Codes: C - continued, Southward - static, I - IGRP, 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 two        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-i, L2 - IS-IS level-ii        ia - IS-IS inter area, * - candidate default, U - per-user static road        o - ODR, P - periodic downloaded static route  Gateway of terminal resort is 171.lxx.24.0 to network 171.70.0.0   *   171.70.0.0/xvi is variably subnetted, ii subnets, 2 masks S*      171.70.0.0/16 [one/0] via 171.70.24.0 S       171.70.24.0/24 [1/0] via 131.108.99.2      161.44.0.0/24 is subnetted, i subnets C       161.44.192.0 is straight connected, Ethernet0      131.108.0.0/24 is subnetted, 1 subnets C       131.108.99.0 is directly continued, Serial0 Due south*   198.10.one.0/24 [ane/0] via 161.44.192.ii

If the original static route had been to the major network, the actress step of configuring the default network twice would not have been necessary.

In that location are all the same no IP protocols running here. Without any dynamic protocols running, you tin configure your router 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 you to configure robustness into the selection of a gateway of last resort. Rather than configuring static routes to specific next-hops, you can have the router choose a default route to a particular network by checking in the routing table.

If you lose the route to a particular network, the router selects the other candidate default. Y'all can remove the lost route by removing the static route in the configuration every bit follows:

2513#configure concluding            Enter configuration commands, one per line.  End with CNTL/Z.  2513(config)#no ip route 171.70.24.0 255.255.255.0 131.108.99.2            2513(config)#^Z            2513# %SYS-5-CONFIG_I: Configured from panel past console

After you remove the static route to the default network, the routing table looks like this:

2513#show ip road            Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area        N1 - OSPF NSSA external blazon 1, N2 - OSPF NSSA external type 2        E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2        ia - IS-IS inter area, * - candidate default, U - per-user static road        o - ODR, P - periodic downloaded static road  Gateway of last resort is 161.44.192.ii to network 198.10.1.0       161.44.0.0/24 is subnetted, i subnets C       161.44.192.0 is directly continued, Ethernet0      131.108.0.0/24 is subnetted, one subnets C       131.108.99.0 is directly connected, Serial0 South*   198.10.ane.0/24 [1/0] via 161.44.192.2 2513#

Utilize Different Routing Protocols

Gateways of last resort selected using the ip default-network command are propagated differently depending on which routing protocol is propagating the default route. For IGRP and EIGRP to propagate the route, the network specified by the ip default-network command must exist known to IGRP or EIGRP. This means the network must be an IGRP- or EIGRP-derived network in the routing table, or the static road used to generate the route to the network must exist redistributed into IGRP or EIGRP, or advertised into these protocols using the network command.

RIP advertises a road to 0.0.0.0 if a gateway of last resort is selected using the ip default-network command. This network specified in the ip default-network command need not be explicitly advertised under RIP. For example, notation that the gateway of concluding resort on this router was learned using the combination of the ip route and ip default-network commands. If you enable RIP on this router, RIP advertises a route to 0.0.0.0 (although not to the Ethernet0 network because of separate-horizon):

2513(config)#router rip            2513(config-router)#network 161.44.0.0            2513(config-router)#network 131.108.0.0            2513(config-router)#^Z 2513# %SYS-5-CONFIG_I: Configured from console by console 2513#debug ip rip            *Mar  2 07:39:35.504: RIP: sending v1 update to 255.255.255.255 via Ethernet0 (161.44.192.1) *Mar  two 07:39:35.508: RIP: build update entries *Mar  2 07:39:35.508:   network 131.108.0.0 metric 1 *Mar  two 07:39:35.512: RIP: sending v1 update to 255.255.255.255 via Serial0 (131.108.99.1) *Mar  2 07:39:35.516: RIP: build update entries *Mar  two 07:39:35.520:   subnet 0.0.0.0 metric 1 *Mar  ii 07:39:35.524:   network 161.44.0.0 metric one

The default route announced using the ip default-network command is non propagated by Open up Shortest Path Offset (OSPF). For more detailed information on behavior of default routes with OSPF, refer to How Does OSPF Generate Default Routes?.

The default road announced using the ip default-network control is not propagated past IS-IS.

ip road 0.0.0.0 0.0.0.0

Creating a static route to network 0.0.0.0 0.0.0.0 is another manner to prepare the gateway of last resort on a router. As with the ip default-network command, using the static road to 0.0.0.0 is not dependent on any routing protocols. Withal, ip routing must be enabled on the router.

Note:IGRP does non sympathise a route to 0.0.0.0. Therefore, it cannot propagate default routes created using the ip route 0.0.0.0 0.0.0.0 command. Use the ip default-network control to have IGRP propagate a default road.

EIGRP propagates a route to network 0.0.0.0, but the static road must be redistributed into the routing protocol.

In earlier versions of RIP, the default route created using the ip route 0.0.0.0 0.0.0.0 was automatically advertised past RIP routers. In Cisco IOS Software Release 12.0T and later, RIP does not advertise the default route if the route is not learned via RIP. It may be necessary to redistribute the road into RIP.

The default routes created using the ip route 0.0.0.0 0.0.0.0 command are non propagated by OSPF and IS-IS. Additionally, this default cannot be redistributed into OSPF or IS-IS using the redistribute command. Utilise the default-information originate control to generate a default route into an IS-IS or OSPF routing domain. For more detailed information on behavior of default routes with OSPF, refer to How Does OSPF Generate Default Routes?

This is an example of configuring a gateway of terminal resort using the ip route 0.0.0.0 0.0.0.0 command:

router-3#configure terminal            Enter configuration commands, one per line. Finish with CNTL/Z.    router-3(config)#ip route 0.0.0.0 0.0.0.0 170.170.3.4            router-3(config)#^Z            router-3#        router-3#bear witness ip route            Codes: C - connected, S - static, I - IGRP, R - RIP, Yard - mobile, B - BGP    D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area     N1 - OSPF NSSA external blazon 1, N2 - OSPF NSSA external type two    E1 - OSPF external type 1, E2 - OSPF external type two, E - EGP    i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-ii, * - candidate default    U - per-user static route, o - ODR  Gateway of terminal resort is 170.170.3.4 to network 0.0.0.0   170.170.0.0/24 is subnetted, 2 subnets    C 170.170.2.0 is directly continued, Serial0    C 170.170.3.0 is directly connected, Ethernet0    South* 0.0.0.0/0 [1/0] via 170.170.iii.4    router-3#    router-3#

Annotation:If you lot configure multiple networks as candidate default routes using the ip default-network control, the network that has the lowest administrative distance is chosen every bit the network for the gateway of last resort. If all the networks have the aforementioned administrative altitude then the network listed first in the routing tabular array (show ip road lists the routing table) is chosen equally the network for the gateway of last resort. If you apply both the ip default-network and ip road 0.0.0.0 0.0.0.0 commands to configure candidate default networks, and the network used by the ip default-network command is known statically, the network defined with the ip default-network command takes precedence and is called for the gateway of concluding resort. Otherwise if the network used by the ip default-network command is derived by a routing protocol, the ip route 0.0.0.0 0.0.0.0 command, which has a lower administrative distance, takes precedence and is chosen for the gateway of last resort. If y'all apply multiple ip route 0.0.0.0 0.0.0.0 commands to configure a default route, traffic is load-balanced over the multiple routes.

Summary

Use the ip default-gateway command when ip routing is disabled on a Cisco router. Use the ip default-network and ip route 0.0.0.0 0.0.0.0 commands to prepare the gateway of concluding resort on Cisco routers that have ip routing enabled. The mode in which routing protocols propagate the default route information varies for each protocol.

Related Information

  • IP Routed Protocols Engineering Support Folio
  • Technical Support - Cisco Systems

How To Find The Default Gateway On A Cisco Router,

Source: https://www.cisco.com/c/en/us/support/docs/ip/routing-information-protocol-rip/16448-default.html

Posted by: madsensels1994.blogspot.com

0 Response to "How To Find The Default Gateway On A Cisco Router"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel