0

I just recently learned about IPv4 and the different classes. Let's say I have a following arbritary IP address : 12.123.123.45

Now, the first octet is below 127 and thus, it tells me that this IPv4 address is a Class A address. A class A address is divided as follows enter image description here

From that, I deduce that the first octet (12) in my class is the network ID and the remaining 123.123.45 is the host ID. Now my question is, first of all,

Q1: is network ID (12) the same for everyone on my ISP?

Q2: Why do all devices on my home network share the same IPv4 address? Surely, the hostID part for each of them should change?

In essence, I'm asking what do these NetIDs and HostIDs actually repersent, is a part of the HostID meant to repersent my router? Which part does everyone on my ISP share?

AlfroJang80
  • 103
  • 2

1 Answers1

4

Welcome to network engineering! Classful addressing is hopelessly out of date, replaced by Classless InterDomain Routing since 1993. Since the premise of your question is wrong, it’s hard to give you a meaningful answer to your first question.

The answer to your second question is because we are running out of addresses, so a technique called Network Address Translation is used to have multiple devices appear to the Internet as one IP.

There is a lot of good information on CIDR and NAT just a quick Google search away, or you can look at previous questions on this site.

Ron Trunk
  • 67,450
  • 5
  • 65
  • 126
  • Ah. That makes so much more sense. Just about the Network Address Translation. If I say want to send a packet to my friends PC on his home network, and if his PC shares the same IP as other PCs on his network, then how would my packet know that it needs to go to his specific PC. I.e, what does my friends router do when it receives my packet? Is there like a device ID within the header of the packet ? – AlfroJang80 Nov 28 '18 at 20:06
  • Typically, the translation includes the port number. So for example if you send a packet to 1.2.3.4 port 80, the NAT device will translate that to 192.168.0.10 port 7777. The application on 192.168.0.10 is listening on that port. – Ron Trunk Nov 28 '18 at 20:11