Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

If my machine has a public ip address, then any one from any corner of the world can access this ip address. How does this happen? I mean where is my ip address updated or where does the requester see if my ip address is a valid one or not?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

IP Addresses are like telephone numbers, and the Internet routers like telephone exchanges.

Let's assume my phone number is 333-1234. The "333" part is the exchange ID. If I dial 333-4567, the exchange knows that I am trying to reach another phone on the same exchange. It will do a lookup of all subscriber numbers listed in its database, and connect me (assuming the destination number is listed and not busy).

If say I dial 444-2378, my local exchange knows that the number is listed in a different exchange. Depending on the routing table of the local exchange, it will either route the call directly to exchange 444, or employ the help of a 'tandem exchange'.

Let's say my complete phone number is +62-21-333-1234, and I am dialling +1-412-678-4466. My local exchange sees that the destination number is located on a different country. It doesn't have to have a routing table to the USA, but it knows by default it must route the call to the tandem exchange. The tandem exchange also doesn't have a routing table for the USA, so it will route the call to the International exchange. The International exchange does know how to route the call to "+1", but that's it. So, the International exchange sends the call to the 'nearest' International exchange in the USA. The International exchange in the USA has a routing table containing the area codes, and routes the call to the tandem exchange serving the area code. The tandem exchange looks up the route for the local exchange having the ID of 678, and transfers the call there. Finally, the '678' exchange checks for the existence of subscriber number 4466, and attempts to connect the call.

The Internet is similar : your default gateway doesn't have to know how to reach the whole Internet. If it happens upon an address that it doesn't recognize, it will send the packet to a higher-tier router. At the highest tier -- the so-called 'backbone' -- the routers know how to route to all the Internet, but only the leftmost octet of the IP address ("the zone"). Upon entering a zone, the packet gets handled by a router in the zone that knows the route to a part of the zone, and so on, hop by hop the packet gets transferred to a router with smaller 'coverage', but more detailed knowledge, similar to how telephone exchanges work.

share|improve this answer

Public IP addresses are like phone numbers. With IPv4 addresses like aa.bb.cc.dd, anyone can start to try to knock on the door of each of these and see what services might be available. They can start at 1.1.1.1 go to 1.1.1.2 and so on. Like phone numbers, they can be dialed at anytime and like phone numbers you can determine approximately where in the world the IP address is.

However, if you have a specific IP address for your system and you don't make that IP address known, then if someone who knew you and they wanted to try to find your machine, they'd have to go through all the IP addresses that are out there and have to be able to identify your machine by some service it might be running. A difficult task to say the least. They can shorten the list by know who your ISP provider is, but they still would not be able to easily determine what public IP address is assigned to your computer.

Typically you protect yourself behind a firewall using NAT and this in turn can provide a first layer of protection from direct probing and is usually the standard method used to connect systems to the internet.

Regarding your question about how anyone in the world can get to your IP address, that is the work of routers and your IP address. If we go back to the first example where IP addresses are in the format of aa.bb.cc.dd, I can give this a try to simplfy the explanation, steering clear of the nitty gritty details.

  1. First there is a layer of routers at "aa". Think of each router as assigned to a network number, being 1-254. So there are 254 of these routers at the top level and these routers only care about the first number.
  2. When the first router for network "aa" is found, the process repeats at step 1 for "bb", and "cc". "dd" is now only a network of 254 nodes/hosts/computers so that is how a computer in Hong Kong can get to a computer directly in the US.

It can become more complicated than this with lots of nuts and bolts, but it seemed easiest to try to explain it like this.

Hope that helps.

share|improve this answer
    
thank you for answering:) When I give the destination ip address as aa.bb.cc.dd, then where does this request go first(I am using a net card i.e connected to the internet through a usb kind of device. So there is no default gateway also) or how does it know where to go? –  Ashwin May 13 '12 at 3:01
    
There is always a default gateway or otherwise you'd never be able to communicate beyond your subnet. –  EEAA May 13 '12 at 3:42
    
@ErikA : but when I do ipconfig, only the ipv4 address is displayed and the default gateway section is 0.0.0.0 . –  Ashwin May 13 '12 at 4:42
2  
The number of networks in any given class has nothing to do with a particular number of routers. Routers can advertise that they are handling any number of networks. Please edit. –  Rapzid May 13 '12 at 6:12
1  
I agree with Rapzid. The last part of the answer is needlessly complicated and generally incorrect. A simpler explanation is this: Routers close to you have routes "up" towards routers with more information about the Internet (a typical home user, for example, gets the packet 'up' to their provider). At some point, you reach a router that knows a route towards the destination's network (core routers exchange this information with each other). The packet eventually reaches a router close to the destination that has a route "down" to the destination. –  David Schwartz May 13 '12 at 7:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.