Last Updated on August 7, 2021 by Admin 3
Which of the following is the correct command to define a default route using a gateway address of 172.16.0.254?
- ip default-route 172.16.0.254 255.255.0.0
- ip route 0.0.0.0 0.0.0.0 172.16.0.254
- default-gateway 172.16.0.254
- ip route default 172.16.0.254
The ip route command is used to manually define a static route to a destination network. The syntax of the command is as follows:
ip route [destination_network] [mask] [next-hop_address or exit interface] [administrative_distance] [permanent]
The attributes of the command are as follows:
– destination_network: Defines the network that needs to be added in the routing table.
– mask: Defines the subnet mask used on the network.
– next-hop_address: Defines the default gateway or next-hop router that receives and forwards the packets to the remote network.
– administrative_distance (AD): States the administrative distance. Static routes have an AD of 1, which can be changed to change the priority of the route.
Creating a default route is accomplished by substituting 0.0.0.0 for both the [destination_network] and [mask] fields, yielding the following command to create a default route through host 172.16.0.254:
router(config)# ip route 0.0.0.0 0.0.0.0 172.16.0.254
Any route configured manually is considered a static route. Another example of a command that creates a non-default route is shown below:
router(config)# ip route 192.168.12.0 255.255.255.0 220.127.116.11
This command would instruct the router on which the command was executed to send any traffic for the 192.168.12.0/24 network to the router located at 18.104.22.168.
You can also affect the route by changing the administrative distance of the route. By default, all static routes have an AD of 1, making them preferable to routes learned from routing protocols. However, you can add the AD parameter at the end of the command as shown below, making the static route less desirable than one learned from a routing protocol such as RIP:
router(config)# ip route 192.168.12.0 255.255.255.0 22.214.171.124 150
One reason to configure the routes this way could be to make the static route a backup route to the route learned by RIP, such as when the static route is a less desirable route through a distant office.
Once the ip route command has been used to add either a static route or a static default route to a router, the routes should appear in the routing table. They will be indicated with an S next to a static route and an S* for a default static route. The first two examples from the explanation above would appear in the routing table as follows:
S*0.0.0.0/0 [1/0] via 172.16.0.254 S 192.168.12.0/24 [1/0] via 126.96.36.199
The ip default-route, default-gateway, and ip route default commands are incorrect because they are not valid Cisco IOS commands.
Configure, verify, and troubleshoot IPv4 and IPv6 static routing