2.4 Public and private addresses
There are two major types of IP address: private addresses and public addresses. This part looks at the differences between these two types of address, and the different ways they are used.
Now watch the video below, which is about 6 minutes long.
Public and private IP addresses
IP addresses are either public or private, and in this part I want to look at the distinction between them.
Nearly all small local networks for homes and small businesses use private addresses. Here are some screenshots from the settings pages of some domestic gateways. These are all the default settings: I haven’t changed anything. What’s striking is how the same network addresses keep cropping up. These are very common numbers in home addresses. It’s very likely that your home network uses these numbers, and that your neighbour’s does too.
And yet data from your network doesn’t get mixed up with your neighbour’s, even though theoretically there’s a route from your network to theirs via the internet.
That’s because virtually all home network addresses belong to a class of IP addresses called ‘private addresses’. These addresses can only be used on private networks, which are self-contained networks found in homes, offices, businesses, schools, colleges, and so on. Private network addresses can’t be used on the public internet. And by ‘public internet’ I mean what’s usually just referred to as ‘the internet’. Trying to use a private address on the public internet would be like dropping into the post a letter addressed to ‘Jane Smith, Office 207, Administration Building’. But in the right context, such as a business or a campus, this address could well work.
It’s common for private networks to have a gateway to the public internet. The gateway allows data traffic from the private network to travel over the public internet to its destination. And it’s quite likely that its destination is itself on another private network. Within the gateway, a process called network address translation is used to replace a private address with a public one for traffic passing through the gateway on to the public internet.
These are the official private IP address ranges. It’s not worth remembering these, but it’s useful to know that addresses beginning 192.168 are always private addresses.
So, to summarise, private addresses are only unique on the network they are used on. Exactly the same addresses can be used on another private network, and often are.
It’s a different story on the public internet, or the global internet, where IP addresses must be unique. Addresses on the public internet, incidentally, consist of four numbers separated by dots, just as on private networks.
Looking again at the IP address ranges, you can see the number 255 cropping up a lot as the highest number in each range. 255 is the biggest number you can have as a number in an IP address. That’s true whether it’s a private IP address or a public IP address. The smallest number you can have in an IP address is 0. So on a typical home network, the range of possible IP addresses is 192.168.1.0 to 192.168.1.255.
In any IP network, neither the lowest nor the highest address can be allocated to a device. So on a home network no device could have the address 192.168.1.0. In fact, this is referred to as the network address. So, although the network part of the address is the three numbers 192.168.1, it’s usual to say that the address of the network (as opposed to a device) is 192.168.1.0. And no device could have the address 192.168.1.255. This highest address is used for broadcasting data to all devices on the network, and you’ve seen examples of this in earlier parts of this session.
The lowest address that can be given to a device on a typical home network is 192.168.1.1. It makes sense to use this address for the gateway, but the gateway doesn’t have to have this address. The highest usable address is 192.168.1.254, and this is quite often used for the gateway address.
So all that’s consistent with this router’s settings that we saw earlier. The gateway has an address of 192.168.1.1, and allocated IP addresses are in the range from 192.168.1.2 to 192.168.1.254.
Sometimes, though, the range of allocated IP addresses is restricted, as with this one we saw earlier. Here the gateway has an address of 192.168.1.1, but other devices are allocated addresses in this range, where the last number goes from 100 to 200.
This restricted range of IP addresses is connected with this thing here, DHCP or Dynamic Host Configuration Protocol, which you’ll be looking at in a later session. This restriction on IP addresses doesn’t mean that a network address such as 192.168.1.5 won’t work on this gateway: it’s just that this address won’t be allocated by the gateway to a device
Now try to answer the questions below.
Activity 4 Test yourself
These questions are about network addresses.
1. On a private network, two devices have these IP addresses: 192.168.3.2 and 192.168.3.1. Could these be expected to work?
Yes, both these IP addresses would work.
2. A data packet with a destination address of 172.16.25.16 is launched on to the public internet. Could it be expected to reach its destination?
No. This is a private network address.
3. If someone setting up their home network were advised to give the gateway an address of 192.168.4.255, would this be good advice? If it is bad advice, suggest some good advice.
No. This is a broadcast address and cannot be allocated to a device. 192.168.4.254 would be suitable.
4. If someone setting up their home network were advised to give the gateway an address of 192.168.1.284, would this be good advice? If it is bad advice, suggest some good advice.
No. 284 exceeds the largest possible number as part of an IP address. The largest possible number is 255, but that can’t be used as it’s a broadcast address. Better advice would be to use 192.168.1.254 or 192.168.1.1.