3 Replies Latest reply: Jun 2, 2010 9:42 AM by Richard Burts RSS

    Using the "network" - "Ip route" - "ip host" commands

    netguru1977

      Hello,

       

      My question pertains to the use of the "network" command as well as the "ip host" and "ip route" commands.

       

      It is my understanding that the "network" command is used with RIP to dynamically send updates to other routers by issuing the command.

       

      It is also my understanding that the "ip route" and "ip host" commands are used to statically configure a route to a single destination.

       

      I just took the Cisco e-lab - "Review of basic configuration including RIP" where they had me use the "clock rate" command which tells me that the routers are both connected using a back to back serial interrface.

       

      So why did I have to enable RIP and use both the "network" and "ip host" commands? Was this just for my practice on using the commands?

       

      I am going back to review the chapters on routing this evening but was hoping someone could really shed some light on this for me.

       

      When to use the "network" command.

       

      When to use the "ip route" or "ip host" command

       

      And do I have to use both the "network" and "ip route" commands together? What about on back to back serial connection?

       

      Any help would be greatly appreciated.

        • 1. Re: Using the "network" - "Ip route" - "ip host" commands
          tnewshott

          The network command tells RIP which networks to participate on.  It will check local interfaces for those subnets and begin advertising on those interfaces which match the network statements.

           

          The "ip host" command allows you to create an alias for a given device.  So, if you have all of your routers with loopback addresses that should be universally reachable, you can configure all of the devices with host entries so instead of typing in the IP every time you can use the alias name instead.  It does not actually change the routing at all.

           

          The "ip route" command allows you to enter static routes - which can be useful in various circumstances.  These include places where you only have on exit point, where you want to force traffic across a specific path, or if you want to configure a floating static route to provide a backup path.  Floating static routes allow you to set a metric on the route in such a way that if the dynamic or primary path fails and that route is removed, the floating static route will remain and act as a failover path.

          • 2. Re: Using the "network" - "Ip route" - "ip host" commands
            Keith Barker - CCIE RS/Security, CISSP

            Hello,

             

            My question pertains to the use of the "network" command as well as the "ip host" and "ip route" commands.

             

            So why did I have to enable RIP and use both the "network" and "ip host" commands? Was this just for my practice on using the commands?

             

            I am going back to review the chapters on routing this evening but was hoping someone could really shed some light on this for me.

             

            When to use the "network" command.

             

            When to use the "ip route" or "ip host" command

             

            And do I have to use both the "network" and "ip route" commands together? What about on back to back serial connection?

             

            Any help would be greatly appreciated.

            Hello NetGuru -

             

            Let's consider this network diagram:

             

            3 routers in a row-NO-user.png

             

            R1 is not running any routing protocols, so he can only reach the local networks he is connected to.

             

            R1#show ip route
            Codes: C - connected, S - static, 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
                   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 not set

             

                 1.0.0.0/24 is subnetted, 1 subnets
            C       1.1.1.0 is directly connected, Loopback0
                 10.0.0.0/24 is subnetted, 1 subnets
            C       10.0.0.0 is directly connected, FastEthernet0/0

             

             


            In order for R1 to reach R3 at 23.0.0.3, R1 needs to learn a route.   We could use a routing protocol, or we can create a simple static route, with the command "ip route".   Lets add a static route so that R1 can reach the 23.0.0.0 network.

             

             


            R1#conf terminal

             

            R1(config)#ip route 23.0.0.0 255.0.0.0 10.0.0.2

             

            Now, when we issue the command "show ip route" we see the route we just added in the routing table.

             


            R1(config)#do show ip route
            Codes: C - connected, S - static, 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
                   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 not set

             

                 1.0.0.0/24 is subnetted, 1 subnets
            C       1.1.1.0 is directly connected, Loopback0
            S    23.0.0.0/8 [1/0] via 10.0.0.2
                 10.0.0.0/24 is subnetted, 1 subnets
            C       10.0.0.0 is directly connected, FastEthernet0/0

             

            As a result, we can now ping R3 at 23.0.0.3


            R1(config)#do ping 23.0.0.3

             

            Type escape sequence to abort.
            Sending 5, 100-byte ICMP Echos to 23.0.0.3, timeout is 2 seconds:
            !!!!!
            Success rate is 100 percent (5/5), round-trip min/avg/max = 44/71/104 ms

             

            Now, for convenience sake only, we can create an entry on R1 (using the "IP HOST" command, that says "If I refer to the host name of R3, I really mean the IP address of R3 at 23.0.0.3"  Again, this is just a convenience, and not required.   Lets demonstrate a ping to R3 before the IP HOST command, and then after.


            R1(config)#do ping r3

             

            Translating "r3"
            % Unrecognized host or address, or protocol not running.

             

            R1(config)#ip host r3 23.0.0.3
            R1(config)#do ping r3

             

            Type escape sequence to abort.
            Sending 5, 100-byte ICMP Echos to 23.0.0.3, timeout is 2 seconds:
            !!!!!
            Success rate is 100 percent (5/5), round-trip min/avg/max = 40/80/112 ms
            R1(config)#

             

            So as a review, the command "IP Route" is to add static routes and the command "IP HOST" is to match a name with an IP (like a mini DNS system, or hosts file on a computer).

             

            The network statement, in a routing protocol, simply says which of the interfaces, based on their configured IP addresses, will become part of the routing protocol you are configuring at the moment.

             

            Here is a short video on how the network statement operates.  I hope you enjoy it.

             

             

            Best wishes,

             

            Keith

            • 3. Re: Using the "network" - "Ip route" - "ip host" commands
              Richard Burts

              To the original poster

               

              Travis has given a good answer and I would like to come at the question from a slightly different perspective.

               

              Your understanding of the terms is flawed and sometimes that is leading you in wrong directions. After we get a clear understanding of what each term means, then we can more effectively discuss how they are used and when to use each one.

               

              You say:"It is also my understanding that the "ip route" and "ip host" commands are used to statically configure a route to a single destination."

              You are sort of correct about ip route in that it is used to configure a static route. But the static route could be to a single destination as you indicate, or it could be to a subnet, or it could be to a network, or it can be used to create a default route.

              As Travis points out the ip host command does not have anything to do with routing but is used to create a name that will resolve to the IP address of a device (such as a router). Note that the name used in ip host might be the same as, or might be different from, the DNS name for a device.

              Network is an important term in dynamic routing protocols. Note that almost all of the routing protocols use the network command. So if you associate network exclusively with RIP then you make it more difficult for yourself when you get to routing protocols like EIGRP or OSPF.

               

              So we have 2 routing terms (ip route and network) and the question may be when should you use one and when to use the other. The distinction is pretty simple. If you do not use dynamic routing then use ip route and if you do use dynamic routing then use network.

               

              HTH

               

              Rick