0

let's say that we have a router with address: 172.31.219.33/27 from this I can tell several things:

  1. Subnet mask: 255.255.255.224
  2. Broadcast address (here I am not sure if last digit should 64 or 65 - see later): 172.31.219.64
  3. Last host address (since we know broadcast address; also not sure if last digit should be 63 or 62): 172.31.219.63

We could also tell first host address (172.31.219.33) and network address (172.31.219.32).

I don't understand two things:

  1. Why is first host address X.X.X.33? It is like the router is already a host?
  2. Why is network address X.X.X.32? In other way, why it is not X.X.X.33 (from router address)?

EDIT: Could also anyone tell me why it is B-class address and not C-class (since mask for C-class is 255.255.255.0 - 255.255.255.254)?

Superian007
  • 395
  • 7
  • 25

3 Answers3

1

32 - 27 = 5 so mask low 5 bits to get network address 32. Broadcast usually has all subnet bits set so would be 63. Range will be 32 - 63, but lowest and highest are reserved so host addresses would be 33 - 62.

The B class has first octet 128 to 191.

stark
  • 12,615
  • 3
  • 33
  • 50
  • Couldn't I count it as: 255-224 = 31, 33+31 = 64? Also, lowest address is always network address and highest is always broadcast? – Superian007 Jan 04 '15 at 14:05
  • 255 - 224 doesn't make sense because they are two different things. – stark Jan 04 '15 at 14:08
  • I guess I still don't understand how 172.31.219.32 is network address, how should I count those 5 bits which I get from mask? – Superian007 Jan 04 '15 at 14:59
  • 1
    33 in binary is 00100001. 224 is 11100000. AND the two to give 00100000 which is 32. That's how the netmask works. – stark Jan 04 '15 at 15:31
1

For the pre-question assumptions you made:

  1. The subnet mask is 255.255.255.224
  2. Broadcast address is not 172.31.219.64 but 172.31.219.63
  3. Last host address is not 172.31.219.63 but 172.31.219.62

Now your questions:

  1. The first host address is 172.31.219.33 and yes, the router is a host. Router doesn't need to have the first IP address from the subnet and you can have multiple routers on the subnet, etc.
  2. Subnet address has nothing to do with the router's IP address, it's just a way of identifying the specific scope.
  3. It is not he C-class because you are not using classful but classless (CIDR) routing, so the mask is not an indicator of the class the address belongs to. You can see that I'm using the term subnet instead of network the whole time since 172.31.219.33/27 is the subnet of the 128.0.0.0/16 network - The class B network.

As stark explained in his comment all of the calculations are made by doing bitwise operations on the 32bit binary numbers that represent the IP and subnet mask, and if you really want to understand how all of this is calculated you should take a look at binary numbers not at the dot-decimal representations of them.

pajaja
  • 2,164
  • 4
  • 25
  • 33
1

The network address is NOT the router's address. The router is using an IP address from one of the host addresses in the subnet. For example, if you have a subnet of eight IP addresses (0 - 7), 0 will be the network address and 7 will be the broadcast address. The router may use one of the IP addresses from in between these two [1 - 6]. As another example, look at the picture below. Each of the router's interfaces(underlined in red) is using an IP address from one of the host IP addresses in the respective subnet.

Interface addresses and subnets

Answering your second question, the address you provided is from the CIDR notation. CIDR stands for Classless Inter-Domain Routing. CIDR addresses do not have classes. They replace the previous classful IP addresses, which to my knowledge aren't used anymore.

Dodu
  • 224
  • 1
  • 6
  • 1
    Routers frequently do not use any address in the subnet they are routing. They have a separate management port which can be on a completely different subnet. – stark Jan 04 '15 at 17:06
  • I didn't know that. Thank you! Also, routers can NOT use the network address, right? I want to read about this. Could you please give me a link or something? – Dodu Jan 04 '15 at 17:18
  • They don't use the network address, but some of the 'smarter' equipment will let you configure the interface with network/broadcast address when using /31 mask. – pajaja Jan 04 '15 at 17:31