Hardware Reference
In-Depth Information
Private and Public IP Addresses
Not every object on the Internet can be addressed by every
other object. Sometimes, in order to support more objects,
a router hides the addresses of the objects attached to it,
sending all their outgoing messages to the rest of the net as
if they came from the router itself. There are special ranges
of addresses set aside in the IP addressing scheme for use
as private addresses. For example, all addresses in the range
192.168.xxx.xxx (as well as 10.xxx.xxx.xxx, and 172.16.xxx.
xxx-172.31.xxx.xxx) are to be used for private addressing
only. This address range is used commonly in home routers,
so if you have one, all the devices on your home network
probably show up with addresses in this range. When
they send messages to the outside world, though, those
messages show up as if they came from your router's public
IP address. Here's how it works:
My computer, with the address 192.168.1.45 on my home
network, makes a request for a web page on a remote
server. That request goes first to my home router. On my
home network, the router's address is 192.168.1.1, but to the
rest of the Internet, my router presents a public address,
66.187.145.75. The router passes on my message, sending
it from its public address, and requesting that any replies
come back to its public address. When it gets a reply, it
sends the reply to my computer. Thanks to private address-
ing and subnet masks, multiple devices can share a single
public IP address, which expands the total number of things
that can be attached to the Internet.
separate protocol, the Domain Name System (DNS) ,
for assigning names to the numbers. Machines on the
network called nameservers keep track of which names
are assigned to which numbers. In your computer's
network configuration, you'll notice a slot where you can
enter the DNS address. Most computers are configured
to obtain this address from a router using the Dynamic
Host Control Protocol (DHCP) , which also provides their
IP address, so you don't have to worry about configuring
DNS. In this chapter's project, you won't be going out to
the Internet at large, so your devices won't have names,
just numbers. When that happens, you'll need to know
their numerical addresses.
to its best capacity. On the Internet, this happens at the
transport layer . This is the layer of the network responsible
for making sure packets get to their destination. There are
two main protocols used to handle transport of packets
on the Internet: Transmission Control Protocol (TCP) , and
User Datagram Protocol (UDP) . You'll learn more about
these later. The main difference is that TCP provides more
error-checking from origin to destination, but is slower
than UDP. On the other hand, UDP trades off error-checking
in favor of speed.
Each router sends off the packets one at a time to the
routers to which it's connected. If it's attached to more
than one other router, it sends the packets to whichever
router is least busy. The packets may each take a different
route to the receiver, and they may take several hops
across several routers to get there. Once the packets
reach their destination, the receiver strips off the headers
and reassembles the message. This method of sending
messages in chunks across multiple paths is called
packet switching . It ensures that every path through the
network is used most efficiently, but sometimes packets
are dropped or lost. On the whole, though, the network
is reliable enough that you can forget about dropped
packets.
Packet Switching: How Messages
Travel the Net
So how does a message get from one machine to another?
Imagine the process as akin to mailing a bicycle. The
bike's too big to mail in one box, so first you break it into
box-sized pieces. On the network, this is initially done at
the Ethernet layer—also called the datalink layer —where
each message is broken into chunks of more or less the
same size, and given a header containing the packet
number. Next, you'd put the address (and the return
address) on the bike's boxes. This step is handled at the
IP layer, where the sending and receiving addresses are
attached to the message in another header. Finally, you
send it. Your courier might want to break up the shipment
among several trucks to make sure each truck is used
There's a command-line tool, ping , that can be useful in
determining whether your messages are getting through.It
sends a message to another object on the Net to say “Are
you there?”, and then waits for a reply.
Search WWH ::




Custom Search