Network classes, subnets and basics - !

rm69

Honorable
Jan 28, 2014
8
0
10,510
1. What is the advantage of having multiple networks in the same switch (say 3 nos of 16 port switch) like 192.168.1.x and 192.168.2.x with same mask 255.255.255.0, even though the network has only 40 0r 50 ip devices in the network? Broadcasts will travel everywhere, right?

2. 10.96.209.9 is essentially a class A address. But is is possible to have a su bnet mask of 255.255.255.224 here, and the 10.96.209.910 would ping with 9. But for a class A network, network mask must be 255.0.0.0 , right ?

3. If I have 2 devices 10.10.10.1 on a switch and 10.10.10.2 with masks = 255.255.255.0 then, they would ping. But for class A address, the subnetmask cannot be 255.255.2555.0 right?

3. Should classes and network be implemented only along the following rule?

CLASS A : 1.0.0.1 to 126.255.255.254
MASK : 255.0.0.0

CLASS B: 128.1.0.1 to 191.255.255.254
MASK 255.240.0.0

CLASS C: 192.0.1.1 to 223.255.254.254

MASK 255.255.0.0

etc? Can I have class A address range and class C mask? will it work? or rather why does it work? Without following any class rules, devices seem to be pinging to each other!

 
Solution
The switch does not know what devices are set to. To a point the layer3 switch will prevent you from setting its vlan interfaces incorrectly. It will watch for duplicate ip,overlapping subnet and stuff like trying assign the first or last ip of the subnet to the interface. It only makes sure there is nothing wrong in its own configuration.

End users devices are pretty much on their own. If they are misconfiguration then they may or may not work and it is likely they work to some blocks of IP. Many networks the users do not have a need to communicate directly only to the gateway for the subnet to get to some remote servers or maybe the internet. These type of network can tolerate some very misconfigured clients.

The main...

sg4rb0

Honorable
Dec 4, 2012
214
0
10,760
1. Different subnets = different broadcast domains, meaning less bandwidth across the network is used.
2.yes 10.96.209.9/255.255.255.224 is perfectly viable. 10.x.x.x/255.0.0.0 is a class A address, yes. BTW, 10.96.209.910 is not a viable address, so I don't get what u mean with that.
3.Kind of. You would say that 10.x.x.x/8 is the classful address, and that it has been subnetted down to a /24 (i.e. 255.255.255.0).


Right, it seems like you're stuck on the idea with different classful networks and where it becomes non-classful.

RFC documentation states:
"The first type of address, or class A, has a 7-bit network number
and a 24-bit local address. The highest-order bit is set to 0
This allows 128 class A networks."

So in English, that means the first octet will be any number from 0-127, with a mask of 255.0.0.0. If you break this standard, then the network becomes non-classful (or possibly a class b,c,d, or e address depending on what it is).

If I was to put it in a form that you used. this means
CLASS A - Host IP address range: 0.0.0.1 to 127.255.255.254
MASK : 255.0.0.0

This same standard is what's used for the class b and class c address. Let me know if u need any more info.
 

rm69

Honorable
Jan 28, 2014
8
0
10,510
Thanks for the answer.

1. Even though broadcasts are segmented into neworks, they do appear at the network port of each device, right? Or does the switch intelligently filter out signals into every port, the way router does? Does the switch know the macs of each ip/macs of each device and filter broadcasts?

2. I meant 10 would ping 9. Question was, 10.x.x.x series being a class A address, should have a 255.0.0.0 type mask. But, regardless of the class, I can have any subnet mask ie: the subnet mask of class c works fine for a class A ip address!

3. I understand the part where in class A, first byte is the network address, ANDed with the the MASK, and that is why the mask is 8 ones. This, I understand is the classful addressing, where each device has a an IP belonging to a specific class.
Now, what I do not understand is the breaking the law part. If I break the law, then I can technically mix up things as long as I can AND the mask and get different network part and host id part, and it works fine. Is that what you are saying? If this is the case, (which makes sense), then why have RFCs at all? why do we have class A, b etc, for local addresses? Ignore the RFCs regarding classes, and stil we are fine? My question is, unless the switch itself know the network, like a VLAN type, why wouldn't the switch get confused? One device with 10.10.10.10 with 255.255.255.0 and another device with IP address 10.10.10.10 and network mask 255.0.0.0 are different, and can be part of the same switch? When one arps who is 10.10.10.10, then there must be a context of network?
 
The concept of ip classes is now outdated. It is now mostly used as a short hand to represent how many ips you want. You can say for example I need 1/2 of a class b which means you need 32k contiguous ip addresses.

All the following represent valid blocks of 32k addresses

47.140.128.0/17
135.123.128.0/17
200.50.128.0/17

The one people try to say will not work is the last one because it is made up of multiple class C networks. This is where this whole concept of classful is out dated. It does work fine as long as all the old support for classful networks is disabled. Cisco and other vendors have been removing the classful concept for many years. Unfortunately there is still that odd device here and there that will burn you because it still has the classful stuff activated.

This was all done to try to reduce the number of ip prefixes in the routers in the internet. When this was all starting routers had way less memory and processing power than even cheap cell phones do today. They needed to run as few routes as possible. Last time I looked the internet routers where I work had more than 400,000 unique routes. For now the minimum size they now allow to be advertised is a /24 (ie class c) so all the larger blocks have been chopped up and spread to many different companies. So in effect all ip blocks are becoming varying size groups of class c blocks.

Although you COULD use 3 subnets and plug them all into a dumb switch. In that case all the broadcast from all the subnets WOULD go to all the ports even though they are in different subnets. The end devices would just ignore them. This is the why the concept of vlans and subnets always go together.


 

rm69

Honorable
Jan 28, 2014
8
0
10,510
Thank you. So,it is clear that if there is no VLAN, subnets don't make much sense. Please let me know if the following statements are true. 2 and 3 are similar.

1. A device connected to a switch uses its subnet mask only to decide if destination IP is in the net or or outside the router/VLAN. Otherwise,it doesn't advertise its mask at all.

2. A device connected to a switch will not know the mask of other devices in the same switch. If it arps, and if it gets a reply, it would assume that the reply is from a device with same mask.

3. Devices on a switch will not b able to find out whether the target device is in the same network, only from its IP address, since it would not know the subnet mask of another device on the same network. ie: If one device is 10.10.10.10 (mask=255.255.252.0) and if there is another device 10.10.10.11 (mask 255.255.254.0), and if the first device has to send a udp packet to second, it would arp who is '10.10.10.11' and the second one, even though it has a different mask, would reply that 'it is me', since it wouldn't know that the first one has a different MASK. Right or wrong.

4. In a case where there are two devices on a switch namely A= 10.10.10.10 (mask=255.255.252.0) and B= 10.10.10.11 (mask=255.255.252.0). It is connected to a router gateway of 10.10.10.1 (mask=255.255.252.0). Other end of router is another network/switch, where there is a device C =10.10.10.11 (mask=255.255.254.0). If A has to send a UDP packet to C ie : 10.10.10.11 in the next work (255.255.254.0), then how does it know how to send it? Will it send the packet to B in the same network, or C in the other network through the gateway ? (In classful addressing it would simply know from the IP address itself!)
 
1. mask is never advertised. The difference is if it is inside the subnet I send to the machine mac address. If it is outside I send to the gateway mac.
2. yes if it is miconfigured it would assume it is in the same network.
3. yes that is how arp works. outbound is sent to the broadcast mac and the response is sent directly back to the senders mac address.

First a router will not let you configure overlapping masks you will get a warning...at least on most commercial routers. It knows the mask is inconsistent. It takes some doing to actually get the router to allow you to misconfigure this.

Instead lets assume it learns the route for the 10.10.10.0 255.255.254.0 network via a routing protocol. It now has 2 routes 10.10.8.0 255.255.252.0 connected to a interface and 10.10.10.0 going to another remote location. Because the 10.10.10.0/23 is more specific it will send the traffic to the remote location. On a cisco commercial router it will even send attempt to send the traffic for its own interface 10.10.10.1 out to remote location. So lets change the gateway to 10.10.8.1 for the network with 255.255.252.0 just so the router will work.

Now assume we have machines 10.10.8.2 and 10.10.10.10 in the local location and 10.10.10.11 in the remote location.

10.10.8.2 can talk to 10.10.10.10 since it is all in the same subnet and 10.10.8.2 can talk to say the internet since it will send it to 10.10.8.1

Now lets say 10.10.10.10 want to talk to the internet. It will send the traffic to 10.10.8.1 which will send to the internet but the returning traffic will be sent to the remote location since it is more specific.

If 10.10.10.11 wants to talk to 10.10.10.10 it will ARP and fail
If 10.10.10.11 wants to talk to 10.10.8.2 it will send the traffic to 10.10.10.1 which will eventually deliver the traffic to 10.10.8.2 but 10.10.8.2 will attempt to send the return traffic via ARP. Normally 10.10.8.2 will arp 10.10.10.11 and it will fail...most the time...there is a feature that actually makes this work called proxy arp which is on by default on many commercial routers.









 

rm69

Honorable
Jan 28, 2014
8
0
10,510
One more question

So, in a managed switchrouter with VLAN/multiple networks, it is difficult to set wrong subnet mask to a device? But how does the switch know what sunet mask is set inside, id subnet mask is totally personal to the device, unknown to external devices? Does it also mean that, specific ports must be connected to specific devices and this data must be conifured into router/switch?
 
The switch does not know what devices are set to. To a point the layer3 switch will prevent you from setting its vlan interfaces incorrectly. It will watch for duplicate ip,overlapping subnet and stuff like trying assign the first or last ip of the subnet to the interface. It only makes sure there is nothing wrong in its own configuration.

End users devices are pretty much on their own. If they are misconfiguration then they may or may not work and it is likely they work to some blocks of IP. Many networks the users do not have a need to communicate directly only to the gateway for the subnet to get to some remote servers or maybe the internet. These type of network can tolerate some very misconfigured clients.

The main reason most companies use a centralized DHCP server is to make sure the end user devices have correct subnets. Then as long as the person doing the DHCP server knows what he is doing there won't be a problem. There are switches that use a feature called dhcp snooping to try to prevent users from spoofing IP addresses. A byproduct of this feature is it will check the DHCP message sent to the user and issue a message if the mask is inconstant with its mask for that subnet. So this will in effect double check the guy who configures the dhcp server

There are lots of messy thing that work and don't work and vary from OS and vendors or equipment. There are a number of things you can get to work for the wrong reasons. If I have a windows machine and a cisco router that has the proxy arp turned on i can set the mask to 255.255.255.255. What windows does is ARP every single address and the cisco will wait a bit and if no machine responds it will send it mac as the owner if it has a route to the device even if it is in a different country, as long as the router thinks it can deliver the packet it will respond. But just because you can configure strange stuff does not mean you should.
 
Solution

sg4rb0

Honorable
Dec 4, 2012
214
0
10,760


Do you know what. That's a really good question. The TCP/IP header doesn't contain a subnet mask field. I'm gonna try find out.