You know that the Internet is a packet-switched network. Packets contain a header and a data portion. Among other things the header contains the IP number of the destination machine. All the different networks that make up the Internet are connected to each other by routers, special computers that know how to forward packets along the next step of their path toward their destination.
Actually, routers don't know about IP numbers for particular computers, however they do know about subnets. A subnet is a network that is a portion of a larger subnet. Frequently all the machines on a subnet have similar IP numbers. This makes routing easier.
For example, here at Gordon College we currently use two sets of IP numbers. The first set, which we've had since we first got connected to the Internet in 1994 is, has 256 numbers and is
We also have a much larger set of numbers (2048 numbers) that are used for most of the computers on campus:
Routers on the Internet communicate information with each other so that they know how to route packets.
Packets starting with 38.192 are sent to a router at PSI (our Internet service provider).
PSI routes packets starting with 38.192.128 through 38.192.135 to Gordon College's router.
Our router forwards these packets onto our internal network.
The real situation is more complicated than this, but this should give you some idea of how the packets are forwarded to the correct host.