static route rules

Hi all,

I thought the prefix always had to be the same as the mask, it can't be shorter then what you provide in the route, i.e. you can't summarize it, that's what the summary-address command is for (i guess summarization is only limited to the routing protocols then?)

Why can i do ip route 192.168.6.0 255.255.254.0 fa0/0 ?

I would expect it would only accept 192.168.6.0 255.255.255.0

I expect to see inconsistent mask and address, but the router accepts the /23 route. One bit shorter though (255.255.252.0) and it does complain.

 

What are the exact rules for providing a static route?

 

Regards,

Comments

  • Hi!

    I expect to see inconsistent mask and address, but the router accepts the /23 route. One bit shorter though (255.255.252.0) and it does complain.

    What does the router complain about? Wrong subnet mask or overlapping subnets?

    Well take a look at the 192.168.6.0 /24 network..

    When you make the networks bigger with /25 then you get the following usable subnets..

     

    192.168.0.0/23 = 192.168.0.0 - 192.168.1.255

    192.168.2.0/23 = 192.168.2.0 - 192.168.3.255

    192.168.4.0/23 = 192.168.4.0 - 192.168.5.255

    192.168.6.0/23 = 192.168.6.0 - 192.168.7.255

    and so on...

    So the network 192.168.6.0/23 is a network address. Remember that you can only enter routes to network addresses!!!! Host routes are an exception here! 192.168.6.0/23 is avalid network address.

     

    Lets take a look at te /22 networks

    192.168.0.0/22 = 192.168.0.0 - 192.168.3.255

    192.168.4.0/22 = 192.168.4.0 - 192.168.7.255

    192.168.8.0/22 = 192.168.8.0 - 192.168.11.255

    and so on.

     

    As you can see the 192.168.6.0/22 network is not valid as the network addresses of the 192.168.6.0/22 (if is would exist and be valid) would overlap into the Networks 192.168.4.0/22 and 192.168.8.0/22. You cannot subnet every network into a piece like you want. You have to think about the bigger networks and if it is a part of them.

    Let me know if this helps.

     

    Regards!

    Markus

  • Static routes have no concept of classes (A, B, C). They just
    understand the concept of networks and expect the networks to be entered
    on their proper network boundary.

    192.168.6.0/24 is a network just like 192.168.6.0/23 is a network.
    192.168.4.0/22 is also a network but 192.168.6.0/22 is just an address
    within the 192.168.4.0/22 network. That's the only reason the router
    complained.

    You can enter whatever you like as long as you're entering it on the
    proper network boundary. 0.0.0.0/0, 0.0.0.0/1, 128.0.0.0/1, etc, etc, etc.

    --
    Brian Dennis, CCIEx5 #2210 (R&S/ISP-Dial/Security/SP/Voice)
    [email protected]

    Internetwork Expert, Inc.
    http://www.INE.com


    On 03/18/2012 01:25 PM, atv wrote:
    > Hi all,
    >
    > I thought the prefix always had to be the same as the mask, it can't be
    > shorter then what you provide in the route, i.e. you can't summarize it,
    > that's what the summary-address command is for (i guess summarization is
    > only limited to the routing protocols then?)
    >
    > Why can i do ip route 192.168.6.0 255.255.254.0 fa0/0 ?
    >
    > I would expect it would only accept 192.168.6.0 255.255.255.0
    >
    > I expect to see inconsistent mask and address, but the router accepts
    > the /23 route. One bit shorter though (255.255.252.0) and it does complain.
    >
    > What are the exact rules for providing a static route?
    >
    > Regards,
    >
    >
    >
    >
    > INE - The Industry Leader in CCIE Preparation
    > http://www.INE.com
    >
    > Subscription information may be found at:
    > http://www.ieoc.com/forums/ForumSubscriptions.aspx
  • What are the exact rules for providing a static route?

    There is no exact rules for static route, you can enter either host route or network route, in network route it can be either subnetted or supernetted network like, /11(255.224.0.0) or /21(255.255.248.0), /22(255.255.252.0), /25(255.255.255.128.0) or /30(255.255.255.252) or /32(255.255.255.255).

    See this example, I have some networks on R2, which is /24and /

    R2(config)#int lo0
    R2(config-if)#ip add 192.168.0.1 255.255.255.255

    R2(config-if)#int lo1
    R2(config-if)#ip add 172.16.0.1 255.255.252.0

    R1(config)#ip route 192.168.0.0 255.255.254.0 12.12.12.2
    R1(config)#do ping 192.168.0.1
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:
    !!!!!
    Success rate is 100 percent (5/5), round-trip min/avg/max = 20/100/376 ms
    R1(config)#ip route 172.16.0.0 255.255.252.0 12.12.12.2
    R1(config)#do ping 172.16.0.1
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 172.16.0.1, timeout is 2 seconds:
    !!!!!
    Success rate is 100 percent (5/5), round-trip min/avg/max = 16/47/84 ms

    So Router accepts the Host route or network route it can be either /23 or /24 or /25 etc  because this is the prefix of destination network, our local router doesn't know about destination prefixet.Only thing to remember here is how router selects the route, router selects route first based on longer matched prefix and second Administrative Distance.

    Good Luck

  • Thanks Markus, Brian and Narayan.

    Very helpful, i understand it now.

    <snip>

     

  • peetypeety ✭✭✭

    Why can i do ip route 192.168.6.0 255.255.254.0 fa0/0 ?

    Please don't do static routes to broadcast interfaces.  It's just bad, bad, bad.

  • Please don't do static routes to broadcast interfaces.  It's just bad, bad, bad.

    Well sometimes you need them...e.g. floating static routes etc. If it is necessary its not bad...just dirty sometimes :).

  • Why would you need to set interface when doing floating static, just use the next-hop? Also it probably makes more sense to use IP SLA for such scenario.

    Also remember that the router will ARP for all remote destinations as it considers that route as connected :)

  • If you really need to use a static route on an Ethernet interface, you can - just use the next-hop it is much more efficient.

    If you use the next-hop IOS will arp for the next-hop only. If you use the interface f0/0, it will arp for each destination. Imagine the following scenario:

    Router -- ISP

    ip route 0.0.0.0 0.0.0.0 f0/0

    The router would arp for every destination in the Internet, the sh ip arp will contains a lot of entries, which is not very good as compared to the next-hop approach.

    Also sometimes pointing to the interface itself can present problems if the far end device has proxy-arp disabled.

    HTH

    Good luck!

Sign In or Register to comment.