15 May

Do connected interface ping?

And an interesting day full of bit frustrating drama. Today was “External viva” for Major Project at college. It went good with external teacher but “internal ones” tend to cause un-necessary issues. Quite a few people put personal egos and frustration on top priority to an extent that they violate their own points for which they are arguing. They go completely unethical in way they deal with world.
 

 
I am saying this with full responsibility for couple of teachers from my college who have completely lost some “fundamentals of life” as taught in childhood to most of us. Some key principles like staying cool & calm, being humble, making best possible use of time and just being good with everyone. In last 4 years they haven’t learn how to give respect & talk with sense and they expect students to be learning “technology” from them? What an absurd!
 
Anyways not much I can do about it. My own external viva went fine and that’s good enough to stay happy. 🙂
All this reminds of an old amazing poem by Former Prime Minister of India (find it embedded below):
 


 
 

Today’s post…

Personal frustration aside – An interesting topic for today. One of my friend came up with an interesting question. Are all connected routers supposed to be pinging?
It’s simply about two routers – say router A and router B which whose interfaces are connected by a cable. Should they ping? If yes then under what circumstances?
 
Answer is …..mmm…let’s first dive in a little before I gave plain answer.
 
 

Ping/ICMP

Ping works on ICMP protocol and that comes on layer 3 on OSI model.
ICMP simply sends a packet (in a form of “Hello there!”) to destination host machine and if everything is OK then host machine is expected to be replying back with “Hi!” to the source. Time taken in this is counted in round trips (because a non-round trip based counting is logically not possible). This provides with connectivity confirmation + roundtrip latency in the connection.
 
So what are conditions required for ICMP to work?
 
Going into fundamentals of TCP/IP networking, a packet can route only when it knows answer to three simple questions:

  1. Who I am?
  2. Where I need to go?
  3. How I will get there?

 
 
Answer to “Who I am?” comes from the unique IP address (on broadcast domain), “Where I need to go” comes from the user himself who is pinging destination machine IP and “How I will get there?” comes from routing table.
 
So #1 and #3 are important here.  There’s not really BGP, or any IGP protocol when two routers are connected directing on same broadcast (layer 2) and this is where other low level protocol ARP comes into picture. ARP is used in creating a simple table which keeps a reference between Mac address, IP address and interface.
 

How does ARP work?

ARP simply works using “broadcast address” we use while configuring IP address on a interface. E.g if I am putting IP as 10.0.0.1 coming from /29 subnet (or call it 255.255.255.248), it assumes last IP to be “broadcast IP”. A /29 here means 2^32-29 = 8 IPs. Starting from 10.0.0.1, it goes till 10.0.0.7. So last IP = 10.0.0.7 is broadcast IP. This is used by all machines under same broadcast domain to “announce/advertise” their IP address from their Mac address.
 
Let’s play around and connect three routers to a switch (same layer 2 broadcast, single VLAN).
We have router A, router B and router C.
I am putting A and B on 10.0.0.1 and 10.0.0.2 under same subnet (a /29) while router C will be on 10.0.0.100 coming from /24 subnet (for fun!).
 

Screen Shot 2013-05-15 at 6.51.34 PM

 
 

Router>
Router>en
Router>enable
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host
Router(config)#hostname A
A(config)#in
A(config)#interface F
A(config)#interface FastEthernet0/0
A(config-if)#ip add 10.0.0.1 255.255.255.248
A(config-if)#no shut
A(config-if)#no shutdown
A(config-if)#end
A#
00:11:44: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
00:11:45: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
00:11:46: %SYS-5-CONFIG_I: Configured from console by console
Building configuration…
[OK]
A#
A#

 
OK – let’s go on B:
 

Router>en
Router>enable
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host
Router(config)#hostname B
B(config)#int
B(config)#interface F
B(config)#interface FastEthernet0/0
B(config-if)#ip add 10.0.0.2 255.255.255.248
B(config-if)#no shutdown
B(config-if)#end
B#
00:16:06: %SYS-5-CONFIG_I: Configured from console by console
B#
B#
00:16:06: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
00:16:07: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
B#
B#write
Building configuration…
[OK]
B#

 
Now comes the “different one” i.e router C:

Router>
Router>en
Router>enable
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#rou
Router(config)#host
Router(config)#hostname C
C(config)#int
C(config)#interface F
C(config)#interface FastEthernet0/0
C(config-if)#ip add 10.0.0.100 255.255.255.0
C(config-if)#no shu
C(config-if)#no shutdown
C(config-if)#write
00:01:38: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
00:01:39: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state
C(config-if)#
C(config-if)#end
C#wr
00:01:44: %SYS-5-CONFIG_I: Configured from console by consoleite
Building configuration…
[OK]
C#

 
 
OK – now we have three routers with two on same /29 subnet and third one on a /24 subnet. Let’s try to ping:

A#ping 10.0.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/21/24 ms

 
Worked. OK – let’s try C now:
 

A#ping 10.0.0.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.100, timeout is 2 seconds:
…..
Success rate is 0 percent (0/5)
A#

 
Failed.
 
Let’s look at routing table on A:

A#sh ip route connected
10.0.0.0/29 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, FastEthernet0/0
A#

 
OK – so only one entry for 10.0.0.0/29 which is connected directly to Ethernet interface 0/0.
 
If we look at ARP table, we get:

A#
A#sh ip arp
A#sh ip arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 10.0.0.2 12 ca03.35dc.0008 ARPA FastEthernet0/0
Internet 10.0.0.1 – ca02.35dc.0008 ARPA FastEthernet0/0
A#

 
This answers the question completely. 🙂
We have only A and B it ARP table of A. Both B and C are connected to same switch, same VLAN but C is not “visible” to A because C is on /24 subnet and that means last IP of 10.0.0.0/24 i.e 10.0.0.255 is acting as broadcast. C is sending it’s live updates for ARP on 10.0.0.255 while A and B are doing that on broadcast IP 10.0.0.7 (last IP from 10.0.0.0/29) and are not “hearing” on 10.0.0.255. Hence A and B are “hearing” on same broadcast and are updating ARP table while C even connected on same switch, same layer 2 is not connected on layer 3 and thus ICMP ping does not work.
 
It pretty much about those three fundamental questions. Again, third question was “How I will get there?” needs an answer from routing table. So let’s go ahead and tell A about lonely router C. 🙂
 

A(config)#ip route 10.0.0.0 255.255.255.0 F
A(config)#ip route 10.0.0.0 255.255.255.0 FastEthernet0/0
A(config)#end
A#writ
00:38:50: %SYS-5-CONFIG_I: Configured from console by consolee
Building configuration…
[OK]
A#
A#

 
Now there’s a static route entry on A which tells where it for subnet 10.0.0.0/24 and IP 10.0.0.100 belongs to that.
Let’s try pinging again:

A#ping 10.0.0.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/21/24 ms
A#

 
And A can now ping C.  What about C?

C#ping 10.0.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/21/24 ms

 

C#ping 10.0.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
…..
Success rate is 0 percent (0/5)
C#

 
So now C is able to reach A but not B because again B doesn’t knows where is C. If we look at ARP table of C now:

C#
C#sh ip arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 10.0.0.1 3 ca02.35dc.0008 ARPA FastEthernet0/0
Internet 10.0.0.100 – ca06.35dc.0008 ARPA FastEthernet0/0
C#

 
So 10.0.0.2 i.e B is still missing. Let’s tell B to “default” all traffic via A.
 

B>
B>en
B>enable
B#conf t
Enter configuration commands, one per line. End with CNTL/Z.
B(config)#ip ro
B(config)#ip route
B(config)#ip route 0.0.0.0 0.0.0.0 10.0.0.1
B(config)#end
B#write
Building configuration…
[OK]
B#

 
Checking again on B now:
 

C#ping 10.0.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/21/24 ms
C#

 
 
So that’s about it.
 

Summary

Ping works on ICMP and it is on layer 3. For it to work, layer 2 should be connected along with working logical layer 3 with entries in routing table. Unless two directly connected machines are on same subnet they won’t ping because different subnet will get them on different broadcast IP and thus different ARP tables all together.
And don’t miss that lot of firewalls block ICMP partially as well as completely because it tends to overload routers in processing those packets rather then doing normal switching operation.
 
Time for me to get back to work!
 
Note: My comments on college teachers are specifically for two teachers (and everyone around me knows whom I am referring too) and one should not make a general impression out from those. There are some very good teachers in dept. as well. 

09 May

Lost sense of "engineering"

Engineering

 
It’s late evening here in Radaur and I am sitting in my room with open door looking outside in dark. I wonder if darkness outside is more then darkness I see in our system. No, I am not referring to any routing glitch or bandwidth chock point but even more fundamental issue that is “Lost sense of Engineering” in current education age. It’s pretty hot weather out in my room. Here’s what room thermometer says.
I will start this blog post with two interesting real life experiences from last four years.

The guy in bus…

One day I was on way to home from college. It was 1st year, 1st semester at college and those were pretty green days. Everyone around was very energetic. There were numerous things to keep up excitement levels. Time was of end of year 2009 and by this time Indian economy was doing pretty decent (after US recession in 2008). I was on three seat bus sitting right in middle of two interesting men. The guy on right side was a young and village looking guy. He started chatting and told me about his job with Crime Branch in Haryana police. It caught my attention and for next 30 mins we had a deep discussion on how much politics impact their work, how much pressure they get and in what form from political as well as administrative bureaucrats. I learned quite a few interesting things. Next, he started asking me about my life. I told him about college and how things were moving along. By this time person on left got some interest in discussion – a relatively old guy with white hairs and this glasses. He spoke a couple of sentences blaming govt., blaming colleges, blaming the way everything is going etc. 
In his next line he said  to the gentlemen from crime branch – “Sir, I can tell you these kids have an awful future. You will see them haunting around this area in search for a low end job. There is nothing left in engineering line at all”. 
I was little stunned by his unexpected attack but yes at the same time I felt bit bad on the reflection of life of “Indian Engineers” I got from his eyes. And as I was expecting, next he started telling about his nephew’s college life, the expense they had and struggle with job part.
 
Before I come to any conclusions from story 1, let’s come to story number 2:
 

The old man in village…

It was a winter afternoon in Radaur on Sunday. I was out & roaming around. It was 2nd semester and I recently moved to my new rented room. I saw an old man sitting there. He greeted me and I replied to his greeting. He offered me to sit and we eventually got into a small chat. He asked general questions about my home, family, college etc and then came to “engineering” part. He asked me on how it feels like to be doing an engineering degree? I gave usual “neutral” replies and he asked me more about IT, computers etc. He was educated but wasn’t really from computer age and computers always looked like mystery to him with Internet being the biggest one. 🙂
He asked me with couple of interesting real life problems and asked if they can be solved with computers. By the end of talk I was surprised how much excited he was to see young folks like us doing “engineering”. Sad to say but old guy was better then most of people I encounter in day-to-day life. He told me that engineering is like magic – you understand things in fine details and implement them and make life better.
 

Conclusions:

  • Our system has forgotten the fundamental principles of engineering. At core we are supposed to be fixing real life problems with the use of technology which are supposed to be understanding. Not to point out any single one but in general from students to teachers, from parents to relatives – everyone is worried too much about grades, attendance, degree,  file work, formal dresses, ensuring rules are followed etc and there is close to 0% focus on doing anything real.
  • (From story 1) – A lot of people tend to generalize life of someone they see (old man’s nephew in this case) with life of anyone else going that path. This is one of biggest problems in the way we think. I am quite sure old man had no idea on how much serious his nephew was for life.
  • At the same time, I realized the bitter fact of life that I was in a place where anyone could attack me for wasting my parents money on education which will never give good returns. There was no point in arguing with “experienced” old man but I kept his words in mind for long time.
  • People who are from outside engineering/modern education domain like the old man from story 2 are way more energetic and enthusiastic about engineering domain as well as life in general. There was a sense of respect and “good luck in making world better” in eyes of that old man.
  • I cannot single out anyone let it be college administration, teachers, students or even parents and relatives. Surely it’s lack of focus from Govt. side specially with ultra slow bureaucracy at these State Universities. But that’s more of a Indian problem then education sector problem. We are lacking good leadership from quite sometime now & failing to address some very key issues including education, good roads, 24hrs electricity, infrastructure for disabled, acceptable quality of food & drinking water and lot more. This problem is not much different from old well written article on Indian talents caught in cowebs.
  • There are some very good teachers as well as students in college and there are some really awful ones. That’s no more different from world in general around us.

 

Story of state colleges in general…

What all triggered this 1st year thought was today’s heavy argument with a senior teacher. I didn’t slept last night and today went to college in noon time walking 3Kms in hot 43C. Next two hours went plane and wasted. Later as I was able to catch up with senior teacher about “Internal viva” and “Major Project” updates and he started with meaningless personal attacks. I would not go into details of my specific case but in general everyone is worried.
Worried about technology? No
Worried about life? No
Worried about Indian political system? No 🙂
Worried about energy crisis? No
 
Well there are lot more “important things” for kids in our college to worry about like:

  • Pending file for major project
  • “Comprehensive viva” where (according to kids) teacher tend to bite for no reason!
  • Giving “seminar” (or simply some presentation students tend to grab from web and read it!)
  • Expense on getting a file re-printed due to some minor font mistakes
  • Non-working project (which they copied from somewhere)
  • Worried about upcoming result for last semester
  • and lot more…

 
I am sure old man (from story 2) will laugh if I go with him with these problems. 🙂
Or may be he will loose confidence in engineering like most of people around me. A lot of these problems are simply because there is just no motivation to solve a “real problem” and that is why people tend to worry about things which do not matter in long term. The same is true in usual family get-to-gathers I attend. People ask me about future plans, idea of studying further or job, which company is hot for job, who pays what and all. No one bothers discussing any real world problem from technical issues to political issues country is facing.
 
 
 

sleep-helps-you-study.jpg

The Paper obsession…

Some of problems are from University like stupid requirement of excessive paper work like files, projects etc. One could simply use softcopy and save lot of money & trees.
For example in last semester for minor project students paid around 200-300Rs i.e $5 or so for each file. There are around 65 students in my class and few went for multiple copies too (for their “records”). So on an average there were around 100 files printed with average of 100 papers. There’s even wastage of papers in so called “pre-reports” i.e printed papers on spiral binding. So I can guess a combined expense of around $600 from our class alone in 7th semester. And so will happen now in 8th semester too till some expense. So we are looking at a figure of $1000 worth of expense on “paper work” by each department in final year. Leaving alone rest of hand written as well as printed files in first three years. Not kidding, but the amount of money we (Indians) waste here on un-necessary things is really surprising. One of my American friend once asked me about it on how price conscious Indian society go for awful wastage of resources in such manner. Answer to that is “system”. If we look at chain – money often comes from parents pockets who feel pride in bearing expenses for education (whether or not there’s a real value in it), kids often pay because they don’t care much for such flow of money between hands, teachers/college stay hard on such rules to ensure they “follow University rules” no matter how dumb such activities look like and administrators at university don’t care because there’s a lot to worry about then just changing a simple rule. And then we hear Sam Pitroda telling how new fiber optic network deployment in rural area in help in pushing e-governance!  There are lot more examples like the paper obsession but putting all that will make this blog post too long.  🙂
Once a friend asked me about possible “real life problems” which we can solve. We were standing at bus stop and there was a huge rush of students. There isn’t a serious shortage of buses in Haryana or specifically on Yamunagar – Kurukushtra and Yamunagar – Karnal – Delhi route but still there is a mad rush for buses during morning and evening. One of strong reasons for this is the fact that bus schedule is often not followed due to Indian roads, jams and number of other issues. This tends of unexpected load on buses which are available e.g lot of people tend to go on buses which are available because they have no idea when is next direct bus. This problem can be very easily solved by a bunch of engineering students. One can easily create a simple GPS tracking system integrated with sms triggers. I am sure one can develop a simple system based out of cheap hardware with basic integrated backend software. One can push this with some installations in couple of routes and easily give a direction to (less tech. savy) staff on Haryana roadways in solving this problem. 
 
There are number of other real world problems on which engineering students can work – like efficient cooling in ultra hot summer weather to heating of water in cold weathers. The way in which high voltage power lines are deployed in India – a solution for fixing them itself can be a interesting case or simply looking at problem of bit low quality drinking water or even fixing slow & expensive internet in India! 🙂
The list is endless and I wish students come out and do something which matters rather then hitting head on stuff like paper obsession or next degree or certificate or any other low hanging fruit. Conventional wisdom tells More Certificates -> Better job -> More money -> Happy life. Entire chain is wrong at each point!
 
That’s all being said – I did called senior teacher late evening and apologised for my hard words coming out of frustration but stayed on my stand on fact that we have just lost focus. It’s not about me, him or college …it’s just everyone of us. 
 
Back to some “real work”…! 🙂