May 6, 2011

Tunneling

    James is waiting at the San Francisco Airport for his plane to Chicago to watch the Bulls games. However, all of the planes are canceled due to a blizzard in San Francisco. James is going to miss the game, so he plans to watch the live commentary at www.nba.com instead. He turns on his computer and enters www.nba.com in the browser. "Welcome to the San Francisco Airport! Connect to the internet  ($1000 per minute), Press here." James is a huge fan of Chicago Bulls. He forgets to bring his credit card, but he brings his cell phone. So he decides to call his friend, Bob, the CS wiz, for help. After ten minutes of explaining his suggestion to James, the cell phone is running short on battery soon as the bar turns red.  Bob decides to explain the high-level concept about "Tunneling", which allows him to surf the net.
    Imagine that you bring your own food to cinema, which doesn't allow outside food. Then you would hide your food in your bag and bypass the ticker collector at the gate.  Your computer encapsulates your request to www.nba.com in a larger valid request(DNS request), which can bypass the SF airport router and connect to the internet.
    James thinks this is easy. So he asks Bob for a detailed explanation of how the whole thing works. Bob asks James to recall how he used to escape his parents' surveillance and sent letters to his girl friend, Natalie, who lived in Berkeley.

Tunneling James's old story
1 James tries to connect to www.nba.com. However, SF airport router won't allow any web traffic, except for DNS traffic.  Txt record , a kind of DNS records, is used here.  James wants to send letter to Natalie. However, his parents won’t allow James to leave the house. Luckily, James’s brother, Gil, can leave the house freely.
2 Then James has to encapsulate the request to www.nba.com into the DNS request(Txt record) and forward it to resolver, which sends the request to the corresponding name server on behalf of James’s computer. James puts his letter including Natalie’s address into a box, so his parents would only see a box when Gil sends the box for James . 
3 If the DNS request sends to a normal DNS name server, it won’t understand the encapsulated traffic, which means they don’t know that you are asking for www.nba.com. For a normal post office, they couldn’t figure it out who James wants to send to.
4 So James has to send the DNS request to a name server that can decapsulate the request. Then the server knows that you are going to www.nba.com. In this case, James owns the name server. Then the server will make another DNS request to locate www.nba.com IP’s address. As a result, the server sends a HTTP request for the website. So James has to compromise with a post office(e.g. SF post office). Whenever the post office receives a box from Gil, it opens the box and forwards the letter to Berkeley post office. Eventually, Natalie receives the letter.
5 Once the server receives the web page from www.nba.com. It has to encapsulate the webpage into DNS response and reply to the resolver via the SF Airport router. Onces SF post office receives Natalie's reply letter. The letter will be put in a box, which is destined for Gil. 
6 The resolver receives the DNS response, decapsulates it and forwards the html file to James. Gil opens the box and passes the letter to James.
7 James knows this is www.nba.com 's html fileand open it in a browser. James cries with happy tears because his Bulls wins the game. James knows this letter has to written by Natalie. He reads the letter in his room. He sobs because he finally receives Natalie's letter.
Key Terminology :
A system that translates human-readable name(www.nba.com) to IP's address (1.2.3.4, the quadruple), which the computer understands. Berkeley is the human-readable names; 94704, the zip code, symbolizes the IP address.
Whenever you want to connect to a website, the computer needs to know the website's IP address. Thus,a DNS request is exactly a query for the IP address.
DNS response:
Once the name server receives a request for the IP address. It will return the IP address.
txt record: Txt record is one type of DNS responses, which carries arbitrary text.
Name server: The server that responds to the DNS request for its domain.
Resolver:A utility program to initiate the DNS request.
HTTP request:A request for the a web page.


Actor list
Resolver................................... Gil
txt record.................................. Box
compromised name server......... SF post office
NBA name server...................... Berkeley post office
www.nba.com.......................... Natalie
SF airport route........................ James' parents
HTML request......................... James's letter
HTML response......................  Natalie's letter

Note: The tunneling concept is simplified.

No comments:

Like My Post