Configure a default gateway in a CISCO router (gateway of last resource)

Default routes are used to direct packets addressed to networks not explicitly listed in the routing table.

There are 3 possibilities to configure this.

  1. ip default-gateway
  2. ip default-network
  3. and ip route 0.0.0.0 0.0.0.0

Lets start by the first.

1 – The ip default-gateway command differs from the other two commands. It should only be used when ip routing is not enabled on the Cisco router.

For instance, if the router is a host in the IP world, you can use this command to define a default gateway for it. You might also use this command when your low-end Cisco router is in boot mode in order to upload a Cisco IOS Software image to the router.

In boot mode, the router does not have ip routing enabled.

2 – you can use ip default-network when ip routing is active on the Cisco router. When you configure ip default-network the router considers routes to that network for installation as the gateway of last resort on the router.

HJFR_Router#configure terminal
HJFR_Router#ip route 170.70.24.0 255.255.255.0 131.108.99.2
HJFR_Router(config)#ip default-network 170.70.0.0
HJFR_Router(config)#^Z

HJFR_Router#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 type 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 route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 170.70.24.0 to network 170.70.0.0

 *   170.70.0.0/16 is variably subnetted, 2 subnets, 2 masks
S*      170.70.0.0/16 [1/0] via 170.70.24.0
S       170.70.24.0/24 [1/0] via 131.108.99.2
     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
S*   198.10.1.0/24 [1/0] via 161.44.192.2

3 – Creating a static route to network 0.0.0.0 0.0.0.0 is another way to set the gateway of last resort on a router. As with the ip default-network command, using the static route to 0.0.0.0 is not dependent on any routing protocols. However, ip routing has to be enabled on the router.

Note: IGRP does not understand 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 command to have IGRP propagate a default route.

EIGRP propagates a route to network 0.0.0.0, but the static route has to 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 by 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 might be necessary to redistribute the route into RIP.

OSPF and IS-IS does not propagate the default routes created by the command: ip route 0.0.0.0 0.0.0.0. Additionally, this default route can not be redistributed into OSPF or IS-IS using the redistribute command.

Use the default-information originate command to generate a default route into an IS-IS or OSPF routing domain.

HJFR_Router#configure terminal
HJFR_Router(config)#ip route 0.0.0.0 0.0.0.0 170.170.3.4
HJFR_Router(config)#^Z
HJFR_Router#
 
HJFR_Router#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 type 1, N2 - OSPF NSSA external type 2
 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
 U - per-user static route, o - ODR

Gateway of last 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 connected, Serial0
C 170.170.3.0 is directly connected, Ethernet0
S* 0.0.0.0/0 [1/0] via 170.170.3.4
HJFR_Rotuer#

Configurar uma placa de rede Personalizada no VMware Fusion PRO

Criar uma placa de rede personalizada no VMware Fusion PRO.

Table to help Subnetting

This table has the goal to make the manual subnet calculation more easy and fast. It gives us the number of bits necessary or the number of hosts depending on the needs.

Number of necessary bits for H 8 7 6 5 4 3 2 1
Number of Hosts 256 128 64 32 16 8 4 2 NA
Number of necessary Bits for N 1 2 3 4 5 6 7 8
Value of “Subnet Mask” 0 128 192 224 240 248 252 254 255
Number of Valid Networks 1 2 4 8 16 32 64 128 N/A

 

The Number of host is the total amount of hosts, valid and invalid.

e.g.:

We want to know the value of a subnet to host 10 machines.
To meet that aim our network administrator gives us the following network 192.168.1.0 to subnet.

Classical way is:

To host 10 machines we will need to use the following calculation formula: 2^n-2=10 being N the number of bits that we will need.

N=4

2^4-2 = 14

So to meet the goal our binary octet should look like this:

NNNNHHHH

4 Bits for Networking (N) and 4 bits for Hosts (H).

Our network would have a subnet mask of: 2^7+2^6+2^5+2^4=128+64+32+16=240

Numbers translated:

2^7 is the value of the firs N from left to right.

2^6 is the Value of the second N from left to right.

2^5 is the value of the Third N from left to right

2^4 is the value of the Fourth N from left to Right

Now Lets see how the table can make this faster:

First we need 10 hosts so it is necessary to search a value that is close to 10 but bigger.

So we see the value 16 Green also we could meet the number by searching the number of necessary bits 4.

Then we just go down in the column and check the values,  “Subnet Mask” 240  and the number of networks is 16.

Number of necessary bits for H 8 7 6 5 4 3 2 1
Number of Hosts 256 128 64 32 16 8 4 2 NA
Number of necessary bits for N 1 2 3 4 5 6 7 8
Value of “Subnet Mask” 0 128 192 224 240 248 252 254 255
Number of Subnets 1 2 4 8 16 32 64 128 N/A

 

Our network would be the 192.168.1.0 with the Mask 255.255.255.240 with the Network address of 192.168.1.0, first valid ip address 192.168.1.1 and the last valid ip address 192.168.1.14, the broadcast address will be the 192.168.1.15

Hope this helps everybody in their daily work.

My experience in IT

%d bloggers like this: