4

So, I am new to these concepts so my question may be stupid. I know that there are 5 classes of public IP addresses and we use the 3 of them (Class A, B, C). I also know their range. But when it comes to private IPs I am a little confused. I know the ranges of these IPs too. So, if my puvlic IP is e.g 130.133.45.120 (Class B), does this mean that alla the private IPs in my house should be from 172.16.0.0 through 172.31.255.255 ?

Thank you

  • 2
    Forget about IP address classes, they died 24 years ago. – JFL Mar 17 '17 at 12:06
4

No, your private IP range is entirely separate from your public IP range. Your private range is determined by your own configuration on your router. You can choose whichever private range you'd like.

4
  1. Repeat after me: "Classful addressing is obsolete. Classful addressing is obsolete." Say that to yourself ten times.
  2. There is no relationship between public and private addresses. Your devices can have either public or private addresses -- it's up to you. But if private, they can't be routed over the Internet.
  3. There is nothing special about private addresses. Routers treat public and private addresses exactly the same way. The only difference is the Internet community has agreed not to route private addresses on the Internet.
  4. Network Address Translation (NAT) is used to translate private addresses into public ones so your PC with a private address can communicate over the Internet. There are lots of explanations on how NAT works just a quick Google search away.
  5. Since private addresses are local to networks under your control, you can use any address you want. Fun fact: some organizations actually "borrow" public addresses to use on their internal networks, and translate them to their assigned public addresses. This is poor practice, yet it's more common than you'd think.
3

I feel your original question may have many other questions embedded in it. I have therefore provided some background as well as helping you understand how you might choose your private IPs.

Public IPs are very tightly controlled resources that are in very short supply. Private IPs are used on internal networks and can be whatever you want, providing they are separated by a NAT boundary.

Different IP networks are connected together by network routers. Network routers are simply devices that know how to route your network traffic to its destination and how to route the reply back.

So for example, if you are using a laptop on a private network with an IP of 10.1.1.12 and you wanted to visit a website on 34.201.21.54. Your laptop would send it's requests to the router hoping the router knows a valid route to the target IP.

Public and private IPv4 networks are often separated by a Network Address Translation (NAT) boundary. A NAT boundary is simply a network device (often the router) that effectively hides the source IP. So in the case above the IP address the server at 34.201.21.54 would see is a NAT'd IP, not the original 10.1.1.12 IP.

You asked what your private IP should be. In order to determine what your IP should be you first need to determine what network address you would like to use and how many nodes you are going to need on that private network. Normally people do not bother with this process and simply go for an easy option. I will lay out both an easy option and a slightly more involved opportunity to learn below.

Easy option: Pick whatever network address you want, e.g. 192.168.0.0/24. This will allow you to use any private IP between 192.168.0.1 and 192.168.0.254. Give your router an IP of 192.168.0.1 and ensure everything on the network uses the subnet mask 255.255.255.0.

More difficult option: Pick whatever address you want, but increase the /24 value to reduce the number of available IP addresses to match what you actually need. For example if you chose 192.168.0.0/25, this would allow you to use any IP from 192.168.0.1 to 192.168.0.126. Give your router the same IP, but this time use a subnet mask of 255.255.255.128.

The above example uses CIDR blocks instead of classes. The class of a network is not that relevant as such. What is more relevant is the address range and subnet mask.

/24, /25 or other netmasks simply determine how many bits of an IP address are used for the network address. Thus leaving the remaining bits for host addresses. To understand this you simply need to convert the IP to its binary form, examples below:

11111111.11111111.11111111.00000000 = 255.255.255.0. This is /24 because there are 24 ones in the binary address.

11111111.11111111.11111111.10000000 = 255.255.255.128. This is /25 because there are 25 ones in the binary address.

The more ones you have for the network portion, the less digits you have free for host addresses. Thus the higher the netmask value, the fewer IPs you can have on your network. The network mask also determines how many networks you can have.....but I suggest we ignore that bit for now :).

  • That is a great insight. – 5A7335H Jun 21 '17 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.