Complete newbie question:
Say for example the address: 8.8.8.8
How does the computer know that this address is on the internet, not the local network?
Could a device on the local network have the address 8.8.8.8
too?
Your computer knows that 8.8.8.8 is not on your local network, because that address is not part of the subnetwork that your computer interface card is configured for.
Let's say your PC has an ethernet adapter configured as 192.168.0.100 255.255.255.0. When your computer wants to forward a packet to 8.8.8.8, it looks in its routing table to see which interface it should use. The routing table lists all the networks your computer knows about. On a typical PC, you will have two entries in the routing table:
First, your computer applies the subnet mask of each entry in the routing table to see if the destination matches any of the networks. So it applies the mask 255.255.255.0 to 8.8.8.8 and gets the network 8.8.8.0. That doesn't match the first entry.
It also applies the mask from the default route 0.0.0.0, and gets the network 0.0.0.0. That does match the entry 0.0.0.0 so the computer looks to see where it should forward that packet. The entry lists a next-hop address (also called a default gateway), so your computer creates an ethernet packet with the following information:
It then forwards it to the default gateway, which forwards it on to its destination.
On a Windows PC, you can see your routing table by typing "route print" at a command prompt.
There is no real distinction between "the Internet" and your local network, other than 8.8.8.8 is not your directly connected network.
NAT (Network address translation) translates your local IP address from your private network(LAN) to a public IP address usually provided by your ISP to connect to the internet (WAN). Your private IP's are not routable IPs meaning they can't route through the internet to reach its destination network, while Public IPs are routable IPs that travel accross the internet through multiple WANs.