2

Topology:

C1 --192.168.111.0/24 -- R1 -- 172.30.0.0/24 -- Switch -- C6
                                                  |-- R2 -- 172.30.10.0/23 -- C5

I am a newbie in networking and I have a question about routing through subnets.

I want to ping computer C5 from computer C1 (see below). If I want to do so, I have to define a static route on R1, because R1 knows only its direct connected subnets and not the other ones. Without a static route on R1, C5 is unreachable from C1.

Static route on R1: 
Destination: 172.30.10.0 Subnetmask: 255.255.254.0 Gateway: 172.30.0.2

With this static route I still can't ping computer C5, but I have a timeout, that means that C5 is reachable. Why is this?

When I go further and define a static route on R2.

Static route on R2
Destination: 192.168.111.0 Subnetmask: 255.255.255.0 Gateway: 172.30.0.1 

then the ping works.

I think its because: Without static route on R2: The ping goes until C5, but it can't find the way back. With the static route on R2, the way back is defined. Is this explanation right?

But, why does it work, without static routes on R1 and R2, when I ping C6 from C1 (the default gateway on C6 is R2)? How does the ping find the way back, when the default gateway on C6 is R2.

(C6 and R2 are connected to the Switch)

C1
IP: 192.168.111.11/24
default gateway: R1

C5
IP: 172.30.10.15/23
default gateway: R2

C6
IP: 172.30.0.11/24
default gateway: R2

R1
IP int.: 192.168.111.1
IP ext.: 172.30.0.1

R2
IP int.: 172.30.0.2
IP ext.: 172.30.10.2
9
  • 1
    This is not an answer to your question but a suggestion: If you enable a routing protocol on R1 and R2 (like RIP or OSPF) and advertise the networks that each router is connected to then you wouldn't need static routes at all, unless this configuration is strictly being used for educational purposes.
    – joeqwerty
    Sep 28, 2012 at 17:43
  • What's the Default Gateway on R2?
    – joeqwerty
    Sep 28, 2012 at 17:49
  • Thank you guys for your fast answers, your awsome! This is just an example I crated. I think C1 can ping C6 because the packet is not only send back to the default gateway of C6, R2, but to R1 too and R1 knows where to send it. Could this be? On C6 a default route is not configured. @ joequerty: R2 is the Router and I am not sure if I can define a default gateway on a router? Is it always posible to enable routing protocols? The given network could be for example an industrial network where the computers could be programmable control station. So I am not sure if routing protovols would work.
    – reneton
    Sep 28, 2012 at 19:15
  • A router needs a default gateway in order to route packets for networks/hosts for which it doesn't have an explicit route. It's not required to have a DG, but that would seriously impede it's ability to function as a router, except for routing to networks and hosts that it has explicitly defined route for. If it's a "real" router then it should have the ability to implement routing protocols. Can you check the routing table on R2 and post it here.
    – joeqwerty
    Sep 28, 2012 at 19:20
  • "I think C1 can ping C6 because the packet is not only send back to the default gateway of C6, R2, but to R1 too and R1 knows where to send it. Could this be?" No, that cannot be. The explanation is something else, possibly ICMP redirects or NAT. Sep 28, 2012 at 21:43

2 Answers 2

1

Your answer is essentially correct. Just because the internet knows how to get a packet to a destination is no reason to assume that the internet knows how to get a packet back from that destination to you. The routes have to be actively constructed in both directions.

Given your information, I can't explain why C6 can ping C1. I would check C6 to see if it has a route for 192.168.111 set on it.

-1

With this static route I still can't ping computer C5, but I have a timeout, that means that C5 is reachable. Why is this?

I think its because: Without static route on R2: The ping goes until C5, but it can't find the way back. With the static route on R2, the way back is defined. Is this explanation right?

Yes. A ping sends information to the destination and the destination has to respond. The destination computer needs to know the path to send the information back along.

But, why does it work, without static routes on R1 and R2, when I ping C6 from C1 (the default gateway on C6 is R2)? How does the ping find the way back, when the default gateway on C6 is R2.

I think this is where your misunderstanding is. Your set-up for pinging C6 from C1 essentially equals C1---R1---C6
From C1 to C5 it is C1---R1---R2---C5.
This is a routing question and the switch can basically be thought of as transparent for this explanation.

C6 is connected to the switch and knows that the ping came from R1. Therefore, the response is sent back to the switch, which sends the information out the switch port connected to R1 and never talks to R2 at all even if that is the default gateway. C6 knows the ping came from R1 and sends its information back to it whereas C5 sends its response back to R2 (where the packet came from) which needs to know how to get to R1. The default gateway is only used if the computer does not know a route to the IP address. In the C1 to C6 instance the computer knows the route to C1 because the request came from R1 which is the route back to C1.

21
  • DV, please elaborate on what is wrong with this answer and provide a better one.
    – user142485
    Sep 28, 2012 at 19:28
  • This isn't right. Routing ocurrs at layer 3, not layer 2. C6 knows that the ping came from 192.168.111.11 (which is C1 not R1) and responds in one of two ways: 1. C6 has an explicit route to 192.168.111.0 or to 192.168.111.11 and sends the response via one of those routes... or 2. C6 doesn't have an explicit route for 192.168.111.0 or 192.168.111.11 and sends the response back to it's DG (which is R2)... which does have an explicit route for the destination network or host... or sends it to it's DG, which by my guess is R1.
    – joeqwerty
    Sep 28, 2012 at 19:33
  • C6 has no explicite route on it. It's default gateway is R2. R2 contains the following in its routing tabel: 172.30.0.0/24 directly connected to f0/0 172.30.10.0/23 directly connected to f0/1 My network is not a physical network, I simulate the network with gns3
    – reneton
    Sep 28, 2012 at 20:25
  • Run a packet capture on C6 and ping it from C1. Then look at the ICMP packets in the capture and see where the ping comes from and where C6 is sending it's response.
    – joeqwerty
    Sep 28, 2012 at 20:42
  • 1
    C6 cannot ping C1 because the default gateway on C6 is R2 but C1 can ping C6. When I capture the traffic I can see: ping reguest: src IP: C1, dst IP: C6, src MAC: R1, dst MAC: C6 ping reply: src IP: C6, dst IP: C1, src MAC: C6, dst MAC: R1
    – reneton
    Sep 29, 2012 at 6:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .