Have you configured your Cisco router to do NAT?
Both will work but there is an important (performance) difference between the two. Let’s say we are using Ethernet. Here’s the first static route:
ip route 0.0.0.0 0.0.0.0 192.168.1.1
When your router wants to forward a packet that has matched this default route then it has to put the packet in a L2 frame. It checks the next hop address, does an ARP request, gets a reply and is able to forward the packet. Life is good.
Here’s another static route:
ip route 0.0.0.0 0.0.0.0 GigabitEthernet 0/1
This time we use an interface as the next hop. When your router wants to forward a packet with the interface as next hop then it has no idea what to use as the destination MAC address in the L2 frame. Ethernet is multi-access so that means there could be more than one device on the other end.
If you use a static route like this then the router will assume that the destination address in your packet is DIRECTLY CONNECTED to that Ethernet interface. This means that it will do an ARP request for each and every packet that it tries to deliver.
You can see it in action here:
R1(config)#ip route 0.0.0.0 0.0.0.0 GigabitEthernet 0/1
R1#debug arp ARP packet debugging is on
R1#ping 188.8.131.52 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 184.108.40.206, timeout is 2 seconds: *Mar 31 06:43:14.464: IP ARP: creating incomplete entry for IP address: 220.127.116.11 interface GigabitEthernet0/1 *Mar 31 06:43:14.465: IP ARP: sent req src 192.168.1.1 fa16.3ecf.35bc, dst 18.104.22.168 0000.0000.0000 GigabitEthernet0/1.
R1#ping 22.214.171.124 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 126.96.36.199, timeout is 2 seconds: *Mar 31 06:44:33.295: IP ARP: creating incomplete entry for IP address: 188.8.131.52 interface GigabitEthernet0/1 *Mar 31 06:44:33.296: IP ARP: sent req src 192.168.1.1 fa16.3ecf.35bc, dst 184.108.40.206 0000.0000.0000 GigabitEthernet0/1.
It will work but it’s a performance killer. Keep in mind this is only a problem on multi-access interfaces.
On serial interfaces (or other point-to-point interfaces) this doesn’t matter since there is only one device on the other end. Your dialer interface is also point-to-point. Configuring the IP address of the ISP will also work but it won’t matter.
Hope this helps!
Hi rene, when is it the right situation to use both, the outgoing interface and the next hope in a route?
I have read that if e.g. the outgoing interface fails but the next hop is still recursive the route still works and stays in the routing table.
But are there situations where one would use both??? Or is it a rule of thumb to use the Interface on p2p and next hope on broadcast interfaces?
In my reply above yours, you can see the example why it’s a bad idea to use an interface as the next hop for multi-access interfaces (like Ethernet). It’s best to stick to IP addresses as the next hop.
For point-to-point interfaces, it doesn’t matter much. Sometimes it can be useful to use the interface as the next hop since you don’t always have the next hop IP address right away (for example with PPP connections).
thanks for your reply!
in your post above you mention that it would work if you specify only the interface for a multi-access network but obviously it is a performance killer.
but it would only work if the other router connected to that interface has proxy-arp configured, right? as otherwise there would not be any arp response packet coming back!?
and do you know of any use case to specify both, the interface and the next-hop in a static route?
Do you know what i mean?
In the case of a point-to-point link, it is always sufficient to specify the outgoing interface. In the case of a broadcast/multi-access interface (like Ethernet), Cisco’s best practice is to specify BOTH the interface AND the next hop IP address. While in most cases, you can get away with using only the next-hop IP, there are a few circumstances where this can result in unexpected behavior. Cisco has a pretty good article explaining how you can get into trouble without specifying both here:
The take away from the article is this:
Cisco highly recommends that you specify the outbound interface and the next hop IP address when you configure static routes. When the outbound interface is a point-to-point type of link (for example, a serial link), the specification of the next hop address is not needed.
Hi Andrew. So what you’re trying to say is that with P2P links since there is only destination, it is satisfactory to only define the exit inerface for any packets. With a broadcast/multi-point interface there is more than one destination option so both the interface and the next hop IP address should be defined.
ip route 220.127.116.11 255.255.255.0 192.168.12.2
Why there is no reverse route from branch ?
In order to answer your question, it is important to understand the difference between a remote route and a directly connected route.
From the perspective of the HQ router, the 18.104.22.168 network is a remote route. If no static route is configured or if no routing protocol is configured on the HQ router, there is no way for HQ to “know” about this network. This is why a static route was configured in the example.
From the perspective of the Branch router, both the 22.214.171.124 AND the 192.168.12.0 networks are directly connected, so the Branch router knows how to reach hosts on both networks. Since we are pinging 126.96.36.199 which is the Fa 1/0 interface of the Branch router, no reverse route is necessary because the Branch router already knows how to reach 192.168.12.1 which is the IP of the host who initiated the ping.
I hope this has been helpful!
19 posts were merged into an existing topic: How to configure static route on Cisco IOS Router
I got a bit stuck in my static routing lab, now im doing a static route between 3x Cisco routers, they are connected to each other via serial links, I have added all connected networks to all 3 routers but it seems that I can’t ping the interfaces of the edge routers (when I do show ip route x.x.x.x the network is there) so im wondering in static route, do we need to have some other configurations (other than adding static routes) to make all interfaces pingable( they all are up and with a valid IP address)
As long as you have connectivity between directly connected routers and you’ve installed the remote networks on each router, you should be OK. No additional configuration should be necessary.
However, keep in mind that if your three routers are connected to each other in a loop, and you have created static routes to all possible networks, you may have created a routing loop.
I suggest you try to simplify your topology further and try configuring two routers only and have them share their networks. Once you get that working, you can expand to three and further configure routing to see where the problem occurs.
Keep us posted with your progress!
I hope this was helpful.
Thank you for your valuable reply.
My lab setup is as follows, I got R1 connected to R2 (in middle) and R2 is connected to R3, no connection is made between R1 and 3 (no loops here) now lets say R1 has networks 10.0.0.0 on fa interface and 192.168.12.0 on S0 —>R2
R2 has 2 networks 192.168.12.0 and 192.168.23.0 which connects to both R1 and R3
R3 has similar setup as R1, network 172.16.0.0 on its Fa interface and 192.168.23.0 on S0 -->R2
R2 have both directly connected networks plus 172.16.0.0 and 10.0.0.0 configured as static routes.
R1 has a static route to reach R3 via R2 and the same for R3
Interestingly, from R2, I can ping both Fa interfaces on R1 and R3, but can’t ping R3 Fa from R1 and vice verse, it just work fine if I configure a dynamic routing protocol, a bit weird to be as its a very simple concept but It just doest work
Appreciate your help here
Thanks a lot
Got it working! my bad, just added a default route on both edge routers and it worked
Thanks for the help guys.
I understand what the default route of 0.0.0.0/24 does…it says push all networks (outside the routing table) to the next hop router. I don’t understand when to use this or why we would want to use this. Anyway to break down this idea a bit more for me ? Thank you in advance!
When a router makes routing decisions, it looks at the destination IP address in the packet and compares it with all of the routes in the routing table looking for a match. Specifically, it looks to see if the IP address is contained within the subnets in the routing table. So for example, if you have a routing table like this:
192.168.8.0/24 route to next hop IP 10.10.10.1
172.16.55.0/24 route to next hop IP 10.10.20.1
172.16.58.128/25 route to next hop IP 10.10.20.1
0.0.0.0/0 route to next hop IP 10.10.30.1
Let’s say a packet comes in to the router with a destination IP of 172.16.58.144. It will look through the routing table to see if there is a route to a subnet within which this destination IP address exists. Now the subnets expressed in the routing table essentially define ranges of IP addresses. Specifically, the 172.16.58.128/25 subnet has a range of IP addresses from 172.16.58.128 to 172.16.58.255 (including network and broadcast addresses). The destination IP address falls into this range, so the next hop IP that is used is 10.10.20.1 as indicated in the routing table.
Now if a packet comes into the router with a destination IP address of 192.168.1.50 for example, you can easily see that this is not in the ranges of IP addresses defined by the first three subnets which are:
192.168.8.0 to 192.168.8.255
172.16.55.0 to 172.16.55.255
172.16.58.128 to 172.16.58.255
However, the 0.0.0.0/0 subnet also defines a range of IP addresses. This range is 0.0.0.0 to 255.255.255.255, in other words, all of them! Why? Because a subnet mask of 0.0.0.0 or a designation of /0 essentially says that the whole address is a host portion of the network. Therefore this is a subnet that contains all possible IP addresses.
Naturally, if the destination IP address doesn’t match any of the first three subnets or IP address ranges, it will definitely match the 0.0.0.0/0 range. This is like a catch-all last resort bucket that matches everything that is not matched by a more specific routing table entry. So this is why this is the default route.
Now in your post you indicated 0.0.0.0/24. This actually defines an IP address subnet with a range from 0.0.0.0 to 0.0.0.255. I believe you meant to write 0.0.0.0/0 which is indeed the definition of a default route. Is that right?
I hope this has been helpful!
is there an issue configuring two default route like below
ip route 0.0.0.0 0.0.0.0 188.8.131.52
ip route 0.0.0.0 0.0.0.0 184.108.40.206
No there is no issue. You can configure two default routes on a router, the router will simply do equal cost load balancing since both routes have an equal cost of 1 (static routes). Just keep in mind that packets routed to the default route will be distributed evenly across both links.
I hope this has been helpful!