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?
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.
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 220.127.116.11 go to 18.104.22.168 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.
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.
|show 5 more comments|