Help me understand the 'ip route' command for cisco routersStatic routing is redirectingCisco NAT Config for...

My adviser wants to be the first author

Counting certain elements in lists

How can I change step-down my variable input voltage? [Microcontroller]

Possible Leak In Concrete

Why using two cd commands in bash script does not execute the second command

Making a sword in the stone, in a medieval world without magic

What is the greatest age difference between a married couple in Tanach?

How to deal with taxi scam when on vacation?

I need to drive a 7/16" nut but am unsure how to use the socket I bought for my screwdriver

Ban on all campaign finance?

How to simplify this time periods definition interface?

Brexit - No Deal Rejection

Can hydraulic brake levers get hot when brakes overheat?

When do we add an hyphen (-) to a complex adjective word?

Why doesn't the EU now just force the UK to choose between referendum and no-deal?

Theorems like the Lovász Local Lemma?

Why are the outputs of printf and std::cout different

Is having access to past exams cheating and, if yes, could it be proven just by a good grade?

Happy pi day, everyone!

Life insurance that covers only simultaneous/dual deaths

Informing my boss about remarks from a nasty colleague

Is a lawful good "antagonist" effective?

Can elves maintain concentration in a trance?

How to deal with a cynical class?



Help me understand the 'ip route' command for cisco routers


Static routing is redirectingCisco NAT Config for DSL1 Router 2 LANs?Any tips for Cisco IOS newbie from Linux world?Cisco Router - NAT in and out on the same interfaceCisco ASA 5505 Voice/Data VLANs not pinging/routingCisco Lab Network - 2 routers, 1 switchWeird routing between two networksWhat is the purpose of GRE in IPSec or IPSec in GRE?Port forwarding through 2 routers to clientCan only ping from cisco router to router in IPSEC dynamic to static tunnel













3















I just can't wrap my head around it.



For example:



alt text



I want the left-most router to be able to ping my computers on the left and vice-versa.



Where would I set up ip route and to what address. I feel like I'm just guessing and don't really understand the concept.



Picture is from Cisco Packettracer.










share|improve this question


















  • 3





    nice computer names...

    – Chris S
    Aug 17 '10 at 19:04











  • Is the red line an IPSEC VPN tunnel?

    – ITGuy24
    Aug 17 '10 at 20:44






  • 1





    I love the diagram.

    – Ricky Robinson
    Apr 10 '17 at 9:34
















3















I just can't wrap my head around it.



For example:



alt text



I want the left-most router to be able to ping my computers on the left and vice-versa.



Where would I set up ip route and to what address. I feel like I'm just guessing and don't really understand the concept.



Picture is from Cisco Packettracer.










share|improve this question


















  • 3





    nice computer names...

    – Chris S
    Aug 17 '10 at 19:04











  • Is the red line an IPSEC VPN tunnel?

    – ITGuy24
    Aug 17 '10 at 20:44






  • 1





    I love the diagram.

    – Ricky Robinson
    Apr 10 '17 at 9:34














3












3








3


7






I just can't wrap my head around it.



For example:



alt text



I want the left-most router to be able to ping my computers on the left and vice-versa.



Where would I set up ip route and to what address. I feel like I'm just guessing and don't really understand the concept.



Picture is from Cisco Packettracer.










share|improve this question














I just can't wrap my head around it.



For example:



alt text



I want the left-most router to be able to ping my computers on the left and vice-versa.



Where would I set up ip route and to what address. I feel like I'm just guessing and don't really understand the concept.



Picture is from Cisco Packettracer.







cisco router ip-routing






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 17 '10 at 18:43







Sergio Tapia















  • 3





    nice computer names...

    – Chris S
    Aug 17 '10 at 19:04











  • Is the red line an IPSEC VPN tunnel?

    – ITGuy24
    Aug 17 '10 at 20:44






  • 1





    I love the diagram.

    – Ricky Robinson
    Apr 10 '17 at 9:34














  • 3





    nice computer names...

    – Chris S
    Aug 17 '10 at 19:04











  • Is the red line an IPSEC VPN tunnel?

    – ITGuy24
    Aug 17 '10 at 20:44






  • 1





    I love the diagram.

    – Ricky Robinson
    Apr 10 '17 at 9:34








3




3





nice computer names...

– Chris S
Aug 17 '10 at 19:04





nice computer names...

– Chris S
Aug 17 '10 at 19:04













Is the red line an IPSEC VPN tunnel?

– ITGuy24
Aug 17 '10 at 20:44





Is the red line an IPSEC VPN tunnel?

– ITGuy24
Aug 17 '10 at 20:44




1




1





I love the diagram.

– Ricky Robinson
Apr 10 '17 at 9:34





I love the diagram.

– Ricky Robinson
Apr 10 '17 at 9:34










5 Answers
5






active

oldest

votes


















22














I made a diagram that may be helpful:



alt text



With regard to static routing, consider the above diagram. We have three separate networks: 192.168.1.0, 192.168.2.0, and 192.168.3.0. At first, network hosts (routers, computers, etc.) can only communicate with other hosts that are on their own network. For instance, the computer named James has a single interface on network 192.168.1.0, so that's the only network that it can 'see'. Initially, it will only be able to communicate with Router A.



Router A has network interfaces on the 192.168.1.0 and 192.168.2.0 networks, so those are the two networks that it can 'see'. These are the only networks Router A 'knows' about, so it can only communicate with hosts on the 192.168.1.0 and 192.168.2.0 networks. So Router A doesn't even 'know' that the 192.168.3.0 network exists. Similarly, Router B can 'see' networks 192.168.2.0 and 192.168.3.0. When you enter a route into the table, you're telling a host that there's a new network it can get to, and you're giving it the address of a gateway that it can use to get to the new network. So to be able to contact Jesus (or any other host on the 192.168.3.0 network) from Router A, you'd enter the command:



ip route 192.168.3.0 255.255.255.0 192.168.2.2
^ ^ ^
network mask gateway


This works because Router B can 'see' both Router A and Jesus. Thanks to this routing table entry when Router A wants to reach the 192.168.3.0 network, it knows it can get there via Router B at 192.168.2.2, so it sends the packet to Router B. Router B can see the 192.168.3.0 network directly, so it forwards the packet along to Jesus at 192.168.3.11.



So, now we know how to direct router A to the 192.168.3.0 network. But what if we want James to also be able to reach the 192.168.3.0 network? Well, Router A already knows how to get there, and James can already 'see' Router A, since they're both on network 192.168.1.0. So we can just tell James to use Router A as its gateway to the 192.168.3.0 network. If James were a router instead of a computer, we'd use the command:



ip route 192.168.3.0 255.255.255.0 192.168.1.1
^ ^ ^
network mask gateway


James would then be able to contact Jesus (or any host on the 192.168.3.0) network by forwarding the packet to 192.168.1.1 (Router A), which would then forward the packet to 192.168.2.2 (Router B) which would then forward the packet to its destination (Jesus in this case) via its directly connected interface.



Now, for Jesus to be able to respond to James, Jesus would need to have Router B set up as its gateway to the 192.168.1.0 network, and Router B would have to have Router A set up as its gateway to the 192.168.1.0 network. Then, any host on the 192.168.1.0 network would have a path to the 192.168.3.0 network and vice versa.



Hope that helps.






share|improve this answer





















  • 1





    Needs more upvotes +1

    – wolfgang
    Sep 22 '15 at 8:31











  • so clear that even this old dog learned something. Thanks for the great diagram and simple explanation.

    – Madivad
    Jun 23 '17 at 22:04



















5














ip route works like ip route <these destination IPS> (via) <this ip> (Don't actually include the word "via"). So the final IP in the command is the next hop those packets should take. This could also be an interface on the router itself instead of an IP of a neighboring router which is commonly used when you have point to point connections. Routers generally only worry about the next hop in their actually routing tables (this gets more complicated with routing protocols, but don't worry about that for now). I don't think I can help you too much without actually IPs. But assuming you mean the computers on the right and the left most router it would be something like:



ip route 192.168.1.0 255.255.255.0 10.10.10.1



If your computers were all in the 192.168.1.0/24 network and 10.10.10.1 was the ip address of the interface on the middle router connected to the left most router. The left most router would need an IP like 10.10.10.2. Then the middle router would probably have 192.168.1.1 on the interface connected to the switch.



Also a good thing to remember with these labs when you start out is not only do the packets need to be routed to the destination, but the replies must be routed back properly for a ping to work.



One more way to wrap your head around this is not to think about routers so much as interfaces and the IPs they have. Routers look at a destination IP address in the packet and forward it to the right interface. The only reason you don't need to specify ip route commands within a router for all the interfaces that exist on the router is that these are entered into the routing table automatically.






share|improve this answer


























  • Thanks for this post it's really good! One more question, so when I want a router to communicate with another subnet via the middle router, I need to give it the Network address of that subnet? (the first unusable ip address of the subnet) Also, how could I route back the replies? Since ip route is only for routers how can I use that command on each PC? :

    – Sergio Tapia
    Aug 17 '10 at 19:14













  • Routers aren't magic. They're just computers with a very specific purpose. Almost EVERY PC has the potential to route traffic. On Windows, OS X, and most other OSes, you can use the route command to set dedicated routes. It works similar to cisco's ip route, you tell it a potential subnet of destinations, and what IP the machine should send those packets to.

    – peelman
    Aug 17 '10 at 19:18











  • You give the network address and the network mask after it (i.e. the 255.255.255.0 in my example). Each PC will just send IPs to the default gateway if it doesn't exist in its subnet.

    – Kyle Brandt
    Aug 17 '10 at 19:25



















1














One way I look at routing is that to go inside I have to go in through a door. in this case James want to go into the 192.168.3.0 area. to get in there he must pass through the 192.168.2.2 door. So I must tell the driver(router a) where to go to get to the 192.168.3.0 area by going to the 192.168.2.2 door. Just like James, Johnny needs to find his way to 192.168.1.0 area so he must go through the 192.168.2.1 door and he must tell is driver (router B) to go there.
When you have more than two router then it can make more since if you use streets rather than doors. because you would have to include both doors and areas to get to the area that you want to go to. Kind of like you would have to first go to one toll booth and then the other to get to a area.






share|improve this answer































    0














    If your PINGs do not come back it can be one or more of:




    • netmask mismatch; a double-check of all the netmask settings of the host involved is not time wasted

    • default gateway; is the host that gets the packets that the sender does not how to deliver

    • return path; probably your packets reach the destination, but the destination does not have the correct information on how to deliver back the packets


    If you have different routings, apply them on the default gateway, not on the hosts. For instance if you have two offices (say 192.168.1.0/24 and 192.168.2.0/24) connected to the Internet AND with a leased line between them, you can just configure the route on the default gateways of the two LANs.



    Imagine that the default gateway on each LAN is x.x.x.254 and the communication equipment of the leased line (a router, but let's forget it) is x.x.x.253 on each LAN



    In the Office #1 you have 192.168.1.254 as default gateway on every PC of the LAN; in the default gateway you have a routing instruction like this: ip route 192.168.2.0 255.255.255.0 192.168.1.253 that means "forward all packets with the destination address starting with 192.168.2 to IP address 192.168.1.253 because he knows how to handle the packets"



    In the Office #2 you have 192.168.2.254 as default gateway on every PC of the LAN; in the default gateway you have a routing instruction like this: ip route 192.168.1.0 255.255.255.0 192.168.2.253






    share|improve this answer































      0














      To get a comprehensive, hands-on understanding of the ip route command, check out this material. The ip route command is explained in detail with hands-on configuration labs.



      https://www.connecteddots.online/courses/static-routes--in-depth-static-routing-on-cisco-routers





      share








      New contributor




      David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "2"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f171551%2fhelp-me-understand-the-ip-route-command-for-cisco-routers%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown
























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        22














        I made a diagram that may be helpful:



        alt text



        With regard to static routing, consider the above diagram. We have three separate networks: 192.168.1.0, 192.168.2.0, and 192.168.3.0. At first, network hosts (routers, computers, etc.) can only communicate with other hosts that are on their own network. For instance, the computer named James has a single interface on network 192.168.1.0, so that's the only network that it can 'see'. Initially, it will only be able to communicate with Router A.



        Router A has network interfaces on the 192.168.1.0 and 192.168.2.0 networks, so those are the two networks that it can 'see'. These are the only networks Router A 'knows' about, so it can only communicate with hosts on the 192.168.1.0 and 192.168.2.0 networks. So Router A doesn't even 'know' that the 192.168.3.0 network exists. Similarly, Router B can 'see' networks 192.168.2.0 and 192.168.3.0. When you enter a route into the table, you're telling a host that there's a new network it can get to, and you're giving it the address of a gateway that it can use to get to the new network. So to be able to contact Jesus (or any other host on the 192.168.3.0 network) from Router A, you'd enter the command:



        ip route 192.168.3.0 255.255.255.0 192.168.2.2
        ^ ^ ^
        network mask gateway


        This works because Router B can 'see' both Router A and Jesus. Thanks to this routing table entry when Router A wants to reach the 192.168.3.0 network, it knows it can get there via Router B at 192.168.2.2, so it sends the packet to Router B. Router B can see the 192.168.3.0 network directly, so it forwards the packet along to Jesus at 192.168.3.11.



        So, now we know how to direct router A to the 192.168.3.0 network. But what if we want James to also be able to reach the 192.168.3.0 network? Well, Router A already knows how to get there, and James can already 'see' Router A, since they're both on network 192.168.1.0. So we can just tell James to use Router A as its gateway to the 192.168.3.0 network. If James were a router instead of a computer, we'd use the command:



        ip route 192.168.3.0 255.255.255.0 192.168.1.1
        ^ ^ ^
        network mask gateway


        James would then be able to contact Jesus (or any host on the 192.168.3.0) network by forwarding the packet to 192.168.1.1 (Router A), which would then forward the packet to 192.168.2.2 (Router B) which would then forward the packet to its destination (Jesus in this case) via its directly connected interface.



        Now, for Jesus to be able to respond to James, Jesus would need to have Router B set up as its gateway to the 192.168.1.0 network, and Router B would have to have Router A set up as its gateway to the 192.168.1.0 network. Then, any host on the 192.168.1.0 network would have a path to the 192.168.3.0 network and vice versa.



        Hope that helps.






        share|improve this answer





















        • 1





          Needs more upvotes +1

          – wolfgang
          Sep 22 '15 at 8:31











        • so clear that even this old dog learned something. Thanks for the great diagram and simple explanation.

          – Madivad
          Jun 23 '17 at 22:04
















        22














        I made a diagram that may be helpful:



        alt text



        With regard to static routing, consider the above diagram. We have three separate networks: 192.168.1.0, 192.168.2.0, and 192.168.3.0. At first, network hosts (routers, computers, etc.) can only communicate with other hosts that are on their own network. For instance, the computer named James has a single interface on network 192.168.1.0, so that's the only network that it can 'see'. Initially, it will only be able to communicate with Router A.



        Router A has network interfaces on the 192.168.1.0 and 192.168.2.0 networks, so those are the two networks that it can 'see'. These are the only networks Router A 'knows' about, so it can only communicate with hosts on the 192.168.1.0 and 192.168.2.0 networks. So Router A doesn't even 'know' that the 192.168.3.0 network exists. Similarly, Router B can 'see' networks 192.168.2.0 and 192.168.3.0. When you enter a route into the table, you're telling a host that there's a new network it can get to, and you're giving it the address of a gateway that it can use to get to the new network. So to be able to contact Jesus (or any other host on the 192.168.3.0 network) from Router A, you'd enter the command:



        ip route 192.168.3.0 255.255.255.0 192.168.2.2
        ^ ^ ^
        network mask gateway


        This works because Router B can 'see' both Router A and Jesus. Thanks to this routing table entry when Router A wants to reach the 192.168.3.0 network, it knows it can get there via Router B at 192.168.2.2, so it sends the packet to Router B. Router B can see the 192.168.3.0 network directly, so it forwards the packet along to Jesus at 192.168.3.11.



        So, now we know how to direct router A to the 192.168.3.0 network. But what if we want James to also be able to reach the 192.168.3.0 network? Well, Router A already knows how to get there, and James can already 'see' Router A, since they're both on network 192.168.1.0. So we can just tell James to use Router A as its gateway to the 192.168.3.0 network. If James were a router instead of a computer, we'd use the command:



        ip route 192.168.3.0 255.255.255.0 192.168.1.1
        ^ ^ ^
        network mask gateway


        James would then be able to contact Jesus (or any host on the 192.168.3.0) network by forwarding the packet to 192.168.1.1 (Router A), which would then forward the packet to 192.168.2.2 (Router B) which would then forward the packet to its destination (Jesus in this case) via its directly connected interface.



        Now, for Jesus to be able to respond to James, Jesus would need to have Router B set up as its gateway to the 192.168.1.0 network, and Router B would have to have Router A set up as its gateway to the 192.168.1.0 network. Then, any host on the 192.168.1.0 network would have a path to the 192.168.3.0 network and vice versa.



        Hope that helps.






        share|improve this answer





















        • 1





          Needs more upvotes +1

          – wolfgang
          Sep 22 '15 at 8:31











        • so clear that even this old dog learned something. Thanks for the great diagram and simple explanation.

          – Madivad
          Jun 23 '17 at 22:04














        22












        22








        22







        I made a diagram that may be helpful:



        alt text



        With regard to static routing, consider the above diagram. We have three separate networks: 192.168.1.0, 192.168.2.0, and 192.168.3.0. At first, network hosts (routers, computers, etc.) can only communicate with other hosts that are on their own network. For instance, the computer named James has a single interface on network 192.168.1.0, so that's the only network that it can 'see'. Initially, it will only be able to communicate with Router A.



        Router A has network interfaces on the 192.168.1.0 and 192.168.2.0 networks, so those are the two networks that it can 'see'. These are the only networks Router A 'knows' about, so it can only communicate with hosts on the 192.168.1.0 and 192.168.2.0 networks. So Router A doesn't even 'know' that the 192.168.3.0 network exists. Similarly, Router B can 'see' networks 192.168.2.0 and 192.168.3.0. When you enter a route into the table, you're telling a host that there's a new network it can get to, and you're giving it the address of a gateway that it can use to get to the new network. So to be able to contact Jesus (or any other host on the 192.168.3.0 network) from Router A, you'd enter the command:



        ip route 192.168.3.0 255.255.255.0 192.168.2.2
        ^ ^ ^
        network mask gateway


        This works because Router B can 'see' both Router A and Jesus. Thanks to this routing table entry when Router A wants to reach the 192.168.3.0 network, it knows it can get there via Router B at 192.168.2.2, so it sends the packet to Router B. Router B can see the 192.168.3.0 network directly, so it forwards the packet along to Jesus at 192.168.3.11.



        So, now we know how to direct router A to the 192.168.3.0 network. But what if we want James to also be able to reach the 192.168.3.0 network? Well, Router A already knows how to get there, and James can already 'see' Router A, since they're both on network 192.168.1.0. So we can just tell James to use Router A as its gateway to the 192.168.3.0 network. If James were a router instead of a computer, we'd use the command:



        ip route 192.168.3.0 255.255.255.0 192.168.1.1
        ^ ^ ^
        network mask gateway


        James would then be able to contact Jesus (or any host on the 192.168.3.0) network by forwarding the packet to 192.168.1.1 (Router A), which would then forward the packet to 192.168.2.2 (Router B) which would then forward the packet to its destination (Jesus in this case) via its directly connected interface.



        Now, for Jesus to be able to respond to James, Jesus would need to have Router B set up as its gateway to the 192.168.1.0 network, and Router B would have to have Router A set up as its gateway to the 192.168.1.0 network. Then, any host on the 192.168.1.0 network would have a path to the 192.168.3.0 network and vice versa.



        Hope that helps.






        share|improve this answer















        I made a diagram that may be helpful:



        alt text



        With regard to static routing, consider the above diagram. We have three separate networks: 192.168.1.0, 192.168.2.0, and 192.168.3.0. At first, network hosts (routers, computers, etc.) can only communicate with other hosts that are on their own network. For instance, the computer named James has a single interface on network 192.168.1.0, so that's the only network that it can 'see'. Initially, it will only be able to communicate with Router A.



        Router A has network interfaces on the 192.168.1.0 and 192.168.2.0 networks, so those are the two networks that it can 'see'. These are the only networks Router A 'knows' about, so it can only communicate with hosts on the 192.168.1.0 and 192.168.2.0 networks. So Router A doesn't even 'know' that the 192.168.3.0 network exists. Similarly, Router B can 'see' networks 192.168.2.0 and 192.168.3.0. When you enter a route into the table, you're telling a host that there's a new network it can get to, and you're giving it the address of a gateway that it can use to get to the new network. So to be able to contact Jesus (or any other host on the 192.168.3.0 network) from Router A, you'd enter the command:



        ip route 192.168.3.0 255.255.255.0 192.168.2.2
        ^ ^ ^
        network mask gateway


        This works because Router B can 'see' both Router A and Jesus. Thanks to this routing table entry when Router A wants to reach the 192.168.3.0 network, it knows it can get there via Router B at 192.168.2.2, so it sends the packet to Router B. Router B can see the 192.168.3.0 network directly, so it forwards the packet along to Jesus at 192.168.3.11.



        So, now we know how to direct router A to the 192.168.3.0 network. But what if we want James to also be able to reach the 192.168.3.0 network? Well, Router A already knows how to get there, and James can already 'see' Router A, since they're both on network 192.168.1.0. So we can just tell James to use Router A as its gateway to the 192.168.3.0 network. If James were a router instead of a computer, we'd use the command:



        ip route 192.168.3.0 255.255.255.0 192.168.1.1
        ^ ^ ^
        network mask gateway


        James would then be able to contact Jesus (or any host on the 192.168.3.0) network by forwarding the packet to 192.168.1.1 (Router A), which would then forward the packet to 192.168.2.2 (Router B) which would then forward the packet to its destination (Jesus in this case) via its directly connected interface.



        Now, for Jesus to be able to respond to James, Jesus would need to have Router B set up as its gateway to the 192.168.1.0 network, and Router B would have to have Router A set up as its gateway to the 192.168.1.0 network. Then, any host on the 192.168.1.0 network would have a path to the 192.168.3.0 network and vice versa.



        Hope that helps.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Aug 17 '10 at 21:15

























        answered Aug 17 '10 at 18:56









        orange_aureliusorange_aurelius

        306136




        306136








        • 1





          Needs more upvotes +1

          – wolfgang
          Sep 22 '15 at 8:31











        • so clear that even this old dog learned something. Thanks for the great diagram and simple explanation.

          – Madivad
          Jun 23 '17 at 22:04














        • 1





          Needs more upvotes +1

          – wolfgang
          Sep 22 '15 at 8:31











        • so clear that even this old dog learned something. Thanks for the great diagram and simple explanation.

          – Madivad
          Jun 23 '17 at 22:04








        1




        1





        Needs more upvotes +1

        – wolfgang
        Sep 22 '15 at 8:31





        Needs more upvotes +1

        – wolfgang
        Sep 22 '15 at 8:31













        so clear that even this old dog learned something. Thanks for the great diagram and simple explanation.

        – Madivad
        Jun 23 '17 at 22:04





        so clear that even this old dog learned something. Thanks for the great diagram and simple explanation.

        – Madivad
        Jun 23 '17 at 22:04













        5














        ip route works like ip route <these destination IPS> (via) <this ip> (Don't actually include the word "via"). So the final IP in the command is the next hop those packets should take. This could also be an interface on the router itself instead of an IP of a neighboring router which is commonly used when you have point to point connections. Routers generally only worry about the next hop in their actually routing tables (this gets more complicated with routing protocols, but don't worry about that for now). I don't think I can help you too much without actually IPs. But assuming you mean the computers on the right and the left most router it would be something like:



        ip route 192.168.1.0 255.255.255.0 10.10.10.1



        If your computers were all in the 192.168.1.0/24 network and 10.10.10.1 was the ip address of the interface on the middle router connected to the left most router. The left most router would need an IP like 10.10.10.2. Then the middle router would probably have 192.168.1.1 on the interface connected to the switch.



        Also a good thing to remember with these labs when you start out is not only do the packets need to be routed to the destination, but the replies must be routed back properly for a ping to work.



        One more way to wrap your head around this is not to think about routers so much as interfaces and the IPs they have. Routers look at a destination IP address in the packet and forward it to the right interface. The only reason you don't need to specify ip route commands within a router for all the interfaces that exist on the router is that these are entered into the routing table automatically.






        share|improve this answer


























        • Thanks for this post it's really good! One more question, so when I want a router to communicate with another subnet via the middle router, I need to give it the Network address of that subnet? (the first unusable ip address of the subnet) Also, how could I route back the replies? Since ip route is only for routers how can I use that command on each PC? :

          – Sergio Tapia
          Aug 17 '10 at 19:14













        • Routers aren't magic. They're just computers with a very specific purpose. Almost EVERY PC has the potential to route traffic. On Windows, OS X, and most other OSes, you can use the route command to set dedicated routes. It works similar to cisco's ip route, you tell it a potential subnet of destinations, and what IP the machine should send those packets to.

          – peelman
          Aug 17 '10 at 19:18











        • You give the network address and the network mask after it (i.e. the 255.255.255.0 in my example). Each PC will just send IPs to the default gateway if it doesn't exist in its subnet.

          – Kyle Brandt
          Aug 17 '10 at 19:25
















        5














        ip route works like ip route <these destination IPS> (via) <this ip> (Don't actually include the word "via"). So the final IP in the command is the next hop those packets should take. This could also be an interface on the router itself instead of an IP of a neighboring router which is commonly used when you have point to point connections. Routers generally only worry about the next hop in their actually routing tables (this gets more complicated with routing protocols, but don't worry about that for now). I don't think I can help you too much without actually IPs. But assuming you mean the computers on the right and the left most router it would be something like:



        ip route 192.168.1.0 255.255.255.0 10.10.10.1



        If your computers were all in the 192.168.1.0/24 network and 10.10.10.1 was the ip address of the interface on the middle router connected to the left most router. The left most router would need an IP like 10.10.10.2. Then the middle router would probably have 192.168.1.1 on the interface connected to the switch.



        Also a good thing to remember with these labs when you start out is not only do the packets need to be routed to the destination, but the replies must be routed back properly for a ping to work.



        One more way to wrap your head around this is not to think about routers so much as interfaces and the IPs they have. Routers look at a destination IP address in the packet and forward it to the right interface. The only reason you don't need to specify ip route commands within a router for all the interfaces that exist on the router is that these are entered into the routing table automatically.






        share|improve this answer


























        • Thanks for this post it's really good! One more question, so when I want a router to communicate with another subnet via the middle router, I need to give it the Network address of that subnet? (the first unusable ip address of the subnet) Also, how could I route back the replies? Since ip route is only for routers how can I use that command on each PC? :

          – Sergio Tapia
          Aug 17 '10 at 19:14













        • Routers aren't magic. They're just computers with a very specific purpose. Almost EVERY PC has the potential to route traffic. On Windows, OS X, and most other OSes, you can use the route command to set dedicated routes. It works similar to cisco's ip route, you tell it a potential subnet of destinations, and what IP the machine should send those packets to.

          – peelman
          Aug 17 '10 at 19:18











        • You give the network address and the network mask after it (i.e. the 255.255.255.0 in my example). Each PC will just send IPs to the default gateway if it doesn't exist in its subnet.

          – Kyle Brandt
          Aug 17 '10 at 19:25














        5












        5








        5







        ip route works like ip route <these destination IPS> (via) <this ip> (Don't actually include the word "via"). So the final IP in the command is the next hop those packets should take. This could also be an interface on the router itself instead of an IP of a neighboring router which is commonly used when you have point to point connections. Routers generally only worry about the next hop in their actually routing tables (this gets more complicated with routing protocols, but don't worry about that for now). I don't think I can help you too much without actually IPs. But assuming you mean the computers on the right and the left most router it would be something like:



        ip route 192.168.1.0 255.255.255.0 10.10.10.1



        If your computers were all in the 192.168.1.0/24 network and 10.10.10.1 was the ip address of the interface on the middle router connected to the left most router. The left most router would need an IP like 10.10.10.2. Then the middle router would probably have 192.168.1.1 on the interface connected to the switch.



        Also a good thing to remember with these labs when you start out is not only do the packets need to be routed to the destination, but the replies must be routed back properly for a ping to work.



        One more way to wrap your head around this is not to think about routers so much as interfaces and the IPs they have. Routers look at a destination IP address in the packet and forward it to the right interface. The only reason you don't need to specify ip route commands within a router for all the interfaces that exist on the router is that these are entered into the routing table automatically.






        share|improve this answer















        ip route works like ip route <these destination IPS> (via) <this ip> (Don't actually include the word "via"). So the final IP in the command is the next hop those packets should take. This could also be an interface on the router itself instead of an IP of a neighboring router which is commonly used when you have point to point connections. Routers generally only worry about the next hop in their actually routing tables (this gets more complicated with routing protocols, but don't worry about that for now). I don't think I can help you too much without actually IPs. But assuming you mean the computers on the right and the left most router it would be something like:



        ip route 192.168.1.0 255.255.255.0 10.10.10.1



        If your computers were all in the 192.168.1.0/24 network and 10.10.10.1 was the ip address of the interface on the middle router connected to the left most router. The left most router would need an IP like 10.10.10.2. Then the middle router would probably have 192.168.1.1 on the interface connected to the switch.



        Also a good thing to remember with these labs when you start out is not only do the packets need to be routed to the destination, but the replies must be routed back properly for a ping to work.



        One more way to wrap your head around this is not to think about routers so much as interfaces and the IPs they have. Routers look at a destination IP address in the packet and forward it to the right interface. The only reason you don't need to specify ip route commands within a router for all the interfaces that exist on the router is that these are entered into the routing table automatically.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Aug 17 '10 at 19:02

























        answered Aug 17 '10 at 18:56









        Kyle BrandtKyle Brandt

        66.2k61263412




        66.2k61263412













        • Thanks for this post it's really good! One more question, so when I want a router to communicate with another subnet via the middle router, I need to give it the Network address of that subnet? (the first unusable ip address of the subnet) Also, how could I route back the replies? Since ip route is only for routers how can I use that command on each PC? :

          – Sergio Tapia
          Aug 17 '10 at 19:14













        • Routers aren't magic. They're just computers with a very specific purpose. Almost EVERY PC has the potential to route traffic. On Windows, OS X, and most other OSes, you can use the route command to set dedicated routes. It works similar to cisco's ip route, you tell it a potential subnet of destinations, and what IP the machine should send those packets to.

          – peelman
          Aug 17 '10 at 19:18











        • You give the network address and the network mask after it (i.e. the 255.255.255.0 in my example). Each PC will just send IPs to the default gateway if it doesn't exist in its subnet.

          – Kyle Brandt
          Aug 17 '10 at 19:25



















        • Thanks for this post it's really good! One more question, so when I want a router to communicate with another subnet via the middle router, I need to give it the Network address of that subnet? (the first unusable ip address of the subnet) Also, how could I route back the replies? Since ip route is only for routers how can I use that command on each PC? :

          – Sergio Tapia
          Aug 17 '10 at 19:14













        • Routers aren't magic. They're just computers with a very specific purpose. Almost EVERY PC has the potential to route traffic. On Windows, OS X, and most other OSes, you can use the route command to set dedicated routes. It works similar to cisco's ip route, you tell it a potential subnet of destinations, and what IP the machine should send those packets to.

          – peelman
          Aug 17 '10 at 19:18











        • You give the network address and the network mask after it (i.e. the 255.255.255.0 in my example). Each PC will just send IPs to the default gateway if it doesn't exist in its subnet.

          – Kyle Brandt
          Aug 17 '10 at 19:25

















        Thanks for this post it's really good! One more question, so when I want a router to communicate with another subnet via the middle router, I need to give it the Network address of that subnet? (the first unusable ip address of the subnet) Also, how could I route back the replies? Since ip route is only for routers how can I use that command on each PC? :

        – Sergio Tapia
        Aug 17 '10 at 19:14







        Thanks for this post it's really good! One more question, so when I want a router to communicate with another subnet via the middle router, I need to give it the Network address of that subnet? (the first unusable ip address of the subnet) Also, how could I route back the replies? Since ip route is only for routers how can I use that command on each PC? :

        – Sergio Tapia
        Aug 17 '10 at 19:14















        Routers aren't magic. They're just computers with a very specific purpose. Almost EVERY PC has the potential to route traffic. On Windows, OS X, and most other OSes, you can use the route command to set dedicated routes. It works similar to cisco's ip route, you tell it a potential subnet of destinations, and what IP the machine should send those packets to.

        – peelman
        Aug 17 '10 at 19:18





        Routers aren't magic. They're just computers with a very specific purpose. Almost EVERY PC has the potential to route traffic. On Windows, OS X, and most other OSes, you can use the route command to set dedicated routes. It works similar to cisco's ip route, you tell it a potential subnet of destinations, and what IP the machine should send those packets to.

        – peelman
        Aug 17 '10 at 19:18













        You give the network address and the network mask after it (i.e. the 255.255.255.0 in my example). Each PC will just send IPs to the default gateway if it doesn't exist in its subnet.

        – Kyle Brandt
        Aug 17 '10 at 19:25





        You give the network address and the network mask after it (i.e. the 255.255.255.0 in my example). Each PC will just send IPs to the default gateway if it doesn't exist in its subnet.

        – Kyle Brandt
        Aug 17 '10 at 19:25











        1














        One way I look at routing is that to go inside I have to go in through a door. in this case James want to go into the 192.168.3.0 area. to get in there he must pass through the 192.168.2.2 door. So I must tell the driver(router a) where to go to get to the 192.168.3.0 area by going to the 192.168.2.2 door. Just like James, Johnny needs to find his way to 192.168.1.0 area so he must go through the 192.168.2.1 door and he must tell is driver (router B) to go there.
        When you have more than two router then it can make more since if you use streets rather than doors. because you would have to include both doors and areas to get to the area that you want to go to. Kind of like you would have to first go to one toll booth and then the other to get to a area.






        share|improve this answer




























          1














          One way I look at routing is that to go inside I have to go in through a door. in this case James want to go into the 192.168.3.0 area. to get in there he must pass through the 192.168.2.2 door. So I must tell the driver(router a) where to go to get to the 192.168.3.0 area by going to the 192.168.2.2 door. Just like James, Johnny needs to find his way to 192.168.1.0 area so he must go through the 192.168.2.1 door and he must tell is driver (router B) to go there.
          When you have more than two router then it can make more since if you use streets rather than doors. because you would have to include both doors and areas to get to the area that you want to go to. Kind of like you would have to first go to one toll booth and then the other to get to a area.






          share|improve this answer


























            1












            1








            1







            One way I look at routing is that to go inside I have to go in through a door. in this case James want to go into the 192.168.3.0 area. to get in there he must pass through the 192.168.2.2 door. So I must tell the driver(router a) where to go to get to the 192.168.3.0 area by going to the 192.168.2.2 door. Just like James, Johnny needs to find his way to 192.168.1.0 area so he must go through the 192.168.2.1 door and he must tell is driver (router B) to go there.
            When you have more than two router then it can make more since if you use streets rather than doors. because you would have to include both doors and areas to get to the area that you want to go to. Kind of like you would have to first go to one toll booth and then the other to get to a area.






            share|improve this answer













            One way I look at routing is that to go inside I have to go in through a door. in this case James want to go into the 192.168.3.0 area. to get in there he must pass through the 192.168.2.2 door. So I must tell the driver(router a) where to go to get to the 192.168.3.0 area by going to the 192.168.2.2 door. Just like James, Johnny needs to find his way to 192.168.1.0 area so he must go through the 192.168.2.1 door and he must tell is driver (router B) to go there.
            When you have more than two router then it can make more since if you use streets rather than doors. because you would have to include both doors and areas to get to the area that you want to go to. Kind of like you would have to first go to one toll booth and then the other to get to a area.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 31 '11 at 0:58









            chlojachloja

            111




            111























                0














                If your PINGs do not come back it can be one or more of:




                • netmask mismatch; a double-check of all the netmask settings of the host involved is not time wasted

                • default gateway; is the host that gets the packets that the sender does not how to deliver

                • return path; probably your packets reach the destination, but the destination does not have the correct information on how to deliver back the packets


                If you have different routings, apply them on the default gateway, not on the hosts. For instance if you have two offices (say 192.168.1.0/24 and 192.168.2.0/24) connected to the Internet AND with a leased line between them, you can just configure the route on the default gateways of the two LANs.



                Imagine that the default gateway on each LAN is x.x.x.254 and the communication equipment of the leased line (a router, but let's forget it) is x.x.x.253 on each LAN



                In the Office #1 you have 192.168.1.254 as default gateway on every PC of the LAN; in the default gateway you have a routing instruction like this: ip route 192.168.2.0 255.255.255.0 192.168.1.253 that means "forward all packets with the destination address starting with 192.168.2 to IP address 192.168.1.253 because he knows how to handle the packets"



                In the Office #2 you have 192.168.2.254 as default gateway on every PC of the LAN; in the default gateway you have a routing instruction like this: ip route 192.168.1.0 255.255.255.0 192.168.2.253






                share|improve this answer




























                  0














                  If your PINGs do not come back it can be one or more of:




                  • netmask mismatch; a double-check of all the netmask settings of the host involved is not time wasted

                  • default gateway; is the host that gets the packets that the sender does not how to deliver

                  • return path; probably your packets reach the destination, but the destination does not have the correct information on how to deliver back the packets


                  If you have different routings, apply them on the default gateway, not on the hosts. For instance if you have two offices (say 192.168.1.0/24 and 192.168.2.0/24) connected to the Internet AND with a leased line between them, you can just configure the route on the default gateways of the two LANs.



                  Imagine that the default gateway on each LAN is x.x.x.254 and the communication equipment of the leased line (a router, but let's forget it) is x.x.x.253 on each LAN



                  In the Office #1 you have 192.168.1.254 as default gateway on every PC of the LAN; in the default gateway you have a routing instruction like this: ip route 192.168.2.0 255.255.255.0 192.168.1.253 that means "forward all packets with the destination address starting with 192.168.2 to IP address 192.168.1.253 because he knows how to handle the packets"



                  In the Office #2 you have 192.168.2.254 as default gateway on every PC of the LAN; in the default gateway you have a routing instruction like this: ip route 192.168.1.0 255.255.255.0 192.168.2.253






                  share|improve this answer


























                    0












                    0








                    0







                    If your PINGs do not come back it can be one or more of:




                    • netmask mismatch; a double-check of all the netmask settings of the host involved is not time wasted

                    • default gateway; is the host that gets the packets that the sender does not how to deliver

                    • return path; probably your packets reach the destination, but the destination does not have the correct information on how to deliver back the packets


                    If you have different routings, apply them on the default gateway, not on the hosts. For instance if you have two offices (say 192.168.1.0/24 and 192.168.2.0/24) connected to the Internet AND with a leased line between them, you can just configure the route on the default gateways of the two LANs.



                    Imagine that the default gateway on each LAN is x.x.x.254 and the communication equipment of the leased line (a router, but let's forget it) is x.x.x.253 on each LAN



                    In the Office #1 you have 192.168.1.254 as default gateway on every PC of the LAN; in the default gateway you have a routing instruction like this: ip route 192.168.2.0 255.255.255.0 192.168.1.253 that means "forward all packets with the destination address starting with 192.168.2 to IP address 192.168.1.253 because he knows how to handle the packets"



                    In the Office #2 you have 192.168.2.254 as default gateway on every PC of the LAN; in the default gateway you have a routing instruction like this: ip route 192.168.1.0 255.255.255.0 192.168.2.253






                    share|improve this answer













                    If your PINGs do not come back it can be one or more of:




                    • netmask mismatch; a double-check of all the netmask settings of the host involved is not time wasted

                    • default gateway; is the host that gets the packets that the sender does not how to deliver

                    • return path; probably your packets reach the destination, but the destination does not have the correct information on how to deliver back the packets


                    If you have different routings, apply them on the default gateway, not on the hosts. For instance if you have two offices (say 192.168.1.0/24 and 192.168.2.0/24) connected to the Internet AND with a leased line between them, you can just configure the route on the default gateways of the two LANs.



                    Imagine that the default gateway on each LAN is x.x.x.254 and the communication equipment of the leased line (a router, but let's forget it) is x.x.x.253 on each LAN



                    In the Office #1 you have 192.168.1.254 as default gateway on every PC of the LAN; in the default gateway you have a routing instruction like this: ip route 192.168.2.0 255.255.255.0 192.168.1.253 that means "forward all packets with the destination address starting with 192.168.2 to IP address 192.168.1.253 because he knows how to handle the packets"



                    In the Office #2 you have 192.168.2.254 as default gateway on every PC of the LAN; in the default gateway you have a routing instruction like this: ip route 192.168.1.0 255.255.255.0 192.168.2.253







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Aug 17 '10 at 19:32









                    lrosalrosa

                    1,5011315




                    1,5011315























                        0














                        To get a comprehensive, hands-on understanding of the ip route command, check out this material. The ip route command is explained in detail with hands-on configuration labs.



                        https://www.connecteddots.online/courses/static-routes--in-depth-static-routing-on-cisco-routers





                        share








                        New contributor




                        David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.

























                          0














                          To get a comprehensive, hands-on understanding of the ip route command, check out this material. The ip route command is explained in detail with hands-on configuration labs.



                          https://www.connecteddots.online/courses/static-routes--in-depth-static-routing-on-cisco-routers





                          share








                          New contributor




                          David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.























                            0












                            0








                            0







                            To get a comprehensive, hands-on understanding of the ip route command, check out this material. The ip route command is explained in detail with hands-on configuration labs.



                            https://www.connecteddots.online/courses/static-routes--in-depth-static-routing-on-cisco-routers





                            share








                            New contributor




                            David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.










                            To get a comprehensive, hands-on understanding of the ip route command, check out this material. The ip route command is explained in detail with hands-on configuration labs.



                            https://www.connecteddots.online/courses/static-routes--in-depth-static-routing-on-cisco-routers






                            share








                            New contributor




                            David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.








                            share


                            share






                            New contributor




                            David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.









                            answered 3 mins ago









                            DavidDavid

                            1




                            1




                            New contributor




                            David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.





                            New contributor





                            David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.






                            David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Server Fault!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f171551%2fhelp-me-understand-the-ip-route-command-for-cisco-routers%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

                                Список ссавців Італії Природоохоронні статуси | Список |...

                                Українські прізвища Зміст Історичні відомості |...