3

I know that subnetting helps in dividing the internet part and physical address + host part.

Like, a class C prefix uses 3 octets for network part and one octet for the host part. I'm reading this book and they keep referring that subnets are used in the internet.

But how do the router happen to change the last part of the public IP address to send request for a particular host in the local network?

Does the router have control over the last octet to change it by itself? Or is the subnetting technology used for local network only?

And does the ISP have any control over how we use subnet? Like my public IP is 49.244.218.112. Does it change the last part 112 (if it were using Class C) for different hosts in a network?

5
  • 7
    There are no Class-A, B, C networks anymore. Haven't been for years. Forget about them. Fast!
    – user2084
    Jul 24, 2014 at 11:38
  • Ashish, it's not clear what you're asking. Do you mean: How can multiple computers on a local network use the same public IP address?
    – Ron Trunk
    Jul 24, 2014 at 12:47
  • I know that routers use something called NAT and PAT and how the same IP address is used to send and receive packets. But is the subnet used in local network or the public network? Jul 24, 2014 at 13:46
  • Assuming no NAT, there is no difference between 'public' networks and 'local' networks. I'm not sure what you mean by the router "using the subnet", or "changing the last octet."
    – Ron Trunk
    Jul 24, 2014 at 21:44
  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer.
    – Ron Maupin
    Dec 19, 2022 at 19:13

6 Answers 6

5

Just continue reading. Both global and local IP networks can be subneted. Network Address Translation (NAT) is used to translate local IP into public.

0
3

When talking about your specific address, you're talking about a /32. Your network might be in any subnet your ISP sees fit.

Example: 49.244.0.0/16 is the network as received by your ISP from its local IP authority. They might divide it further for different routers, CMTS, dslam or whatever your technology uses, so let's say you receive your 49.244.218.112 in the subnet /20. An internet router might have in his table the full network as 49.244.0.0/16 in its table, but then it need to forward packets to your address, a specific /32, so he thinks: if I take the first 16 bits of this address will it match this 49.244.0.0? If yes, it forwards your packet to "network 49.244.0.0". As the packet reach your ISP network, /16 is not enough anymore, so your ISP router looks for the network 49.244.208.0/20, which is the network address for the network your address is in.

It maches ones and zeros, from left to right, that's why 49.244.208.0 is the network address of 49.244.218.112/20, even if the third octet is not the same. Very confusing at first. Keep practicing and you'll get the hang of it.

1
  • Might help to add mention of inside local address, inside global address, outside global address, etc.
    – HAL
    Jul 24, 2014 at 19:01
2

A subnetwork or subnet is a logical subdivision of an IP network.

A router doesn't change anything in the IP adress. A router is only passing IP packets between subnets it is aware of (routing table).

A routing table is a data table stored in a router that lists the routes to particular network destinations (one or more subnets).

A router doesn't know if a subnet it has in the routing table is divided into smaller subnets.

And as a router is unaware if a subnet has been divided into smaller subnets, its is the same for an ISP.

0

Subnetting works both for public and private IP addresses. But in order to be able to access the Internet from a private address, NAT/NAPT (Network Address/Port Translation) is used.

Note that aside from NAT, a router does not change anything in an IP address. It just uses a routing table to know where to forward data across subnets.

1
  • "But in order to be able to access the Internet, NAT (Network Address Translation) is used." Only if you use private addressing inside your network. There are many companies that have public addressing inside their networks, and they do not use NAT for that. NAT should only be used where it is required (private<->public, or overlapping addressing).
    – Ron Maupin
    Dec 19, 2022 at 19:15
0

Your router is using something called Network Address Translation (NAT) . so your ISP is not in control of giving all the other device on your network IP the only thing you ISP gives you is your public IP address. Your router gives all the devices on your network IP using DHCP

0

Subnetting is a technique used to divide a network into smaller subnetworks, or subnets. This is often done to improve the organization and management of the network, and to optimize the use of network resources such as IP addresses.

In a local network, a router or other network device can use subnetting to divide the network into smaller subnets and assign a unique subnet mask to each subnet. The subnet mask is a string of numbers that specifies which portion of the IP address belongs to the network part and which part belongs to the host part. For example, in a Class C network with a subnet mask of 255.255.255.0, the first three octets (49.244.218) identify the network, and the last octet (112) identifies the host.

The router can use the subnet mask to determine which part of the IP address belongs to the network and which part belongs to the host, and can route traffic to the appropriate host on the local network based on this information.

ISPs (Internet Service Providers) do not generally have any control over how a customer uses subnetting on their own local network. However, the ISP may assign a public IP address to a customer's router, which is used to route traffic from the Internet to the local network. In this case, the ISP would typically assign a single public IP address to the customer's router, and the router would use NAT (Network Address Translation) to assign local IP addresses to devices on the local network.

So, to summarize: subnetting is a technique used to divide a network into smaller subnets, and a router can use the subnet mask to route traffic to the appropriate host on the local network. The ISP does not generally have any control over how a customer uses subnetting on their own local network, but may assign a public IP address to the customer's router which is used to route traffic from the Internet to the local network.

1
  • The mask (prefix length) doesn't need to be unique - it's the prefix that matters. Classful networking is long dead, obsoleted in 1993.
    – Zac67
    Dec 21, 2022 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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