Cisco Ip Route Command

Show IP Route Command

Cisco Systems, Inc. is an American multinational technology conglomerate headquartered in San Jose, California, in the center of Silicon Valley. Cisco develops, manufactures and sells networking hardware, software, telecommunications equipment and other high-technology services and products.

Cisco provides IT products and services across five major technology areas: Networking (including Ethernet, optical, wireless and mobility), Security, Collaboration (including voice, video, and data), Data Center, and the Internet of Things.

IP address definition

An IP address is a unique address that identifies a device on the internet or a local network. IP stands for “Internet Protocol,” which is the set of rules governing the format of data sent via the internet or local network.

In essence, IP addresses are the identifier that allows information to be sent between devices on a network: they contain location information and make devices accessible for communication. The internet needs a way to differentiate between different computers, routers, and websites. IP addresses provide a way of doing so and form an essential part of how the internet works.

What is an IP?

An IP address is a string of numbers separated by periods. IP addresses are expressed as a set of four numbers — an example address might be 192.158.1.38. Each number in the set can range from 0 to 255. So, the full IP addressing range goes from 0.0.0.0 to 255.255.255.255.

IP addresses are not random. They are mathematically produced and allocated by the Internet Assigned Numbers Authority (IANA), a division of the Internet Corporation for Assigned Names and Numbers (ICANN). ICANN is a non-profit organization that was established in the United States in 1998 to help maintain the security of the internet and allow it to be usable by all. Each time anyone registers a domain on the internet, they go through a domain name registrar, who pays a small fee to ICANN to register the domain.

How do IP addresses work

If you want to understand why a particular device is not connecting in the way you would expect or you want to troubleshoot why your network may not be working, it helps understand how IP addresses work.

Internet Protocol works the same way as any other language, by communicating using set guidelines to pass information. All devices find, send, and exchange information with other connected devices using this protocol. By speaking the same language, any computer in any location can talk to one another.

The use of IP addresses typically happens behind the scenes. The process works like this:

  1. Your device indirectly connects to the internet by connecting at first to a network connected to the internet, which then grants your device access to the internet.
  2. When you are at home, that network will probably be your Internet Service Provider (ISP). At work, it will be your company network.
  3. Your IP address is assigned to your device by your ISP.
  4. Your internet activity goes through the ISP, and they route it back to you, using your IP address. Since they are giving you access to the internet, it is their role to assign an IP address to your device.
  5. However, your IP address can change. For example, turning your modem or router on or off can change it. Or you can contact your ISP, and they can change it for you.
  6. When you are out and about – for example, traveling – and you take your device with you, your home IP address does not come with you. This is because you will be using another network (Wi-Fi at a hotel, airport, or coffee shop, etc.) to access the internet and will be using a different (and temporary) IP address, assigned to you by the ISP of the hotel, airport or coffee shop.

As the process implies, there are different types of IP addresses, which we explore below.

Types of IP addresses

There are different categories of IP addresses, and within each category, different types.

Consumer IP addresses

Every individual or business with an internet service plan will have two types of IP addresses: their private IP addresses and their public IP address. The terms public and private relate to the network location — that is, a private IP address is used inside a network, while a public one is used outside a network.

Private IP addresses

Every device that connects to your internet network has a private IP address. This includes computers, smartphones, and tablets but also any Bluetooth-enabled devices like speakers, printers, or smart TVs. With the growing internet of things, the number of private IP addresses you have at home is probably growing. Your router needs a way to identify these items separately, and many items need a way to recognize each other. Therefore, your router generates private IP addresses that are unique identifiers for each device that differentiate them on the network.

Public IP addresses

A public IP address is the primary address associated with your whole network. While each connected device has its own IP address, they are also included within the main IP address for your network. As described above, your public IP address is provided to your router by your ISP. Typically, ISPs have a large pool of IP addresses that they distribute to their customers. Your public IP address is the address that all the devices outside your internet network will use to recognize your network.

Public IP addresses

Public IP addresses come in two forms – dynamic and static.

Dynamic IP addresses

Dynamic IP addresses change automatically and regularly. ISPs buy a large pool of IP addresses and assign them automatically to their customers. Periodically, they re-assign them and put the older IP addresses back into the pool to be used for other customers. The rationale for this approach is to generate cost savings for the ISP. Automating the regular movement of IP addresses means they don’t have to carry out specific actions to re-establish a customer’s IP address if they move home, for example. There are security benefits, too, because a changing IP address makes it harder for criminals to hack into your network interface.

Static IP addresses

In contrast to dynamic IP addresses, static addresses remain consistent. Once the network assigns an IP address, it remains the same. Most individuals and businesses do not need a static IP address, but for businesses that plan to host their own server, it is crucial to have one. This is because a static IP address ensures that websites and email addresses tied to it will have a consistent IP address — vital if you want other devices to be able to find them consistently on the web.

This leads to the next point – which is the two types of website IP addresses.

WHAT IS IP ROUTE COMMAND

IP route command is used to configure the static route. Static routes are the most secure way of routing. They will also increase overall network performance. These features are extremely helpful in small network.

IP route command and parameters explained

We have two commands to configure the static route.

Router(config)# ip route destination_network_# [subnet_mask] IP_address_of_next_hop_neighbor [administrative_distance] [permanent]

and

Router(config)# ip route destination_network_# [subnet_mask] interface_to_exit [administrative_distance] [permanent]

Let’s explore above commands in detail

ip route

This is the base command which adds new route in routing table.

destination_network_#[subnet_mask]

This is the first parameter. It specifies the destination network address. We need to provide subnet mask if we are using sub-network. Sub-networks are the smaller networks created from one large network in subnetting. If we are not using sub-network then we can omit the subnet mask value. It will parse automatically.

IP_address_of_next_hop_neighbor / interface_to_exit

This parameter provides a way to reach the destination network. Both commands use separate way to assign this value. First command provides the IP address of next hop neighbor. It tells router that if it receives a packet for destination [that we set in previous parameter], forward that packet to this next hop neighbor IP address.

Second command also do the same job but in different way. It specifies exit interface instead of next hop IP address. It tells router that if it receives a packet for the destination specified by previous parameter then exits that packet from this interface. Device attached on other end of this interface will take care of the packet.

administrative_distance

Administrative distance is the trustworthiness of route. Route with the lowest AD value will be chosen while forwarding the packet. By default static route has two AD values depending on the previous parameter. If you have used next hop neighbor IP address, then the default AD value will be 1. If you have used exit interface, then the default AD value will be 0. This parameter allows us to create multiple static routes for the same destination. For example we can create primary and backup path for the destination network. To create backup path, we need to set AD value to higher than default, such as 2 or 3. With this configuration router will use primary path. Due to some reason if primary route fails, the router will start using backup route automatically.

permanent

When a route goes down router will remove that from routing table. Permanent parameter will keep this route in routing table even if it goes down. Its optional parameter we can omit it. If we omit it, router will remove this route from routing table if it goes down. You might use this parameter for security reason if you never want packets to take another path.

Configure Default Route

By default when a packet arrives in interface, router checks destination filed in packet and compare it with routing table. If it finds a match for destination network then it will forward that packet from related interface. If it does not find a match in routing table then it will discard that packet. This is the default behavior of router. Default route allows us to override this behavior. Default route is a way to deal with all unmatched packets. If no match for destination network found in routing table then it would be forwarded to the default route.

Following commands are used to set the default route

Router(config)# ip route 0.0.0.0 0.0.0.0 IP_address_of_next_hop_neighbor
[administrative_distance] [permanent]

Or

Router(config)# ip route 0.0.0.0 0.0.0.0 interface_to_exit
[administrative_distance] [permanent]

Above command sets destination network to 0.0.0.0/0 that represents all networks.

IP route command example

For demonstration purpose we will use Packet Tracer network simulator software. Beside Packet Tracer you can use any other network simulator software such RouterSim, GNS, Boson or even better if you could afford, use real Cisco devices for follow this practice.

Create a practice topology as shown in fowling figure. Alternatively you can download this topology.

DeviceConnected fromConnected toIP Address
PC0FastEthernet0Router0’s FastEthernet0/010.0.0.2/8
Router0FastEthernet0/0PC0’s FastEthernet010.0.0.1/8
Router0Serial 0/0/0Router1’s serial0/0/0192.168.0.253/30
Router1Serial 0/0/0/Router0’s serial0/0/0192.168.0.254/30
Router1FastEthernet0/0PC1’s FastEthernet020.0.0.1/8
PC1FastEthernet0Router1’s FastEthernet0/020.0.0.2/8

Assign IP address to devices

Assign IP address 10.0.0.2/8 to PC0.

Repeat same process for PC1 and assign IP address 20.0.0.2/8.

Assign IP address to interfaces of router

Double click Router0 and click CLI and press Enter key to access command prompt of router.

Two interfaces FastEthernet0/0 and Serial0/0/0 of Router0 are used in this topology. By default interfaces on router are remain administratively down during the start up. We need to configure IP address and other parameters on interfaces before we could actually use them for routing. Interface mode is used to assign IP address and other parameters. Interface mode can be accessed from global configuration mode. Following commands are used to access global configuration mode.

Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#

From global configuration mode we can enter in interface mode. From there we can configure the interface. Following commands will assign IP address on FastEthernet0/0.

Router(config)#interface fastEthernet 0/0
Router(config-if)#ip address 10.0.0.2 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#

interface fastEthernet 0/0 command is used to enter in interface mode.

ip address 10.0.0.2 255.0.0.0 command will assign IP address to interface.

no shutdown command will bring the interface up.

exit command is used to return in global configuration mode.

Serial interface needs two additional parameters clock rate and bandwidth. Every serial cable has two ends DTE and DCE. These parameters are always configured at DCE end. We can use show controllers interface command from privilege mode to check the cable’s end.

Router#show controllers serial 0/0/0
Interface Serial0/0/0
Hardware is PowerQUICC MPC860
DCE V.35, clock rate 2000000
[Output omitted]

Fourth line of output confirms that DCE end of serial cable is attached. If you see DTE here instead of DCE skip these parameters.

Now we have necessary information let’s assign IP address to serial interface.

Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface serial 0/0/0
Router(config-if)#ip address 192.168.0.253 255.255.255.252
Router(config-if)#clock rate 64000
Router(config-if)#bandwidth 64
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#

Router#configure terminal Command is used to enter in global configuration mode.

Router(config)#interface serial 0/0/0 Command is used to enter in interface mode.

Router(config-if)#ip address 192.168.0.253 255.255.255.252 Command assigns IP address to interface. For serial link we usually use IP address from /30 subnet.

Router(config-if)#clock rate 64000 And Router(config-if)#bandwidth 64 In real life environment these parameters control the data flow between serial links and need to be set at service providers end. In lab environment we need not to worry about these values. We can use these values.

Router(config-if)#no shutdown Command brings interface up.

Router(config-if)#exit Command is used to return in global configuration mode.

We will use same commands to assign IP addresses on interfaces of Router1. Since we have provided clock rate and bandwidth on serial interface of Router0 we need not to assign them on serial interface of Router1. Following command will assign IP addresses on interface of Router1.

Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface fastEthernet 0/0
Router(config-if)#ip address 20.0.0.1 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface serial 0/0/0
Router(config-if)#ip address 192.168.0.254 255.255.255.252
Router(config-if)#no shutdown
Router(config-if)#exit

Configure Static Route

Run following command from global configuration mode in routers.

Router0

Router(config)#ip route 20.0.0.0 255.0.0.0 192.168.0.254

Router1

Router(config)#ip route 10.0.0.0 255.0.0.0 192.168.0.253

That’s all we need to switch packet from one network to another. To verify the result we can use ping command. Access the command prompt of PC1 and use ping command to test the connectivity from PC0.

A successful reply indicates that static routing is configured properly. In next article we will extend this example with more complex topology.

Drop your comment

0Shares

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *