Good Evening,

I hope everyone is doing well this evening. Regarding the subject of subnetting in a LAN, please bear with me as I try to quantify the question in which I have. While the question did spawn from a homework assignment that I am attempting to complete for a project, it's not really the project per se but more of a query which spawned from the creation of a small network LAN diagram that I created which consists of a router, two switches, and two work stations for the assignment.

Assuming that the subnet on the router is 255.255.255.0, that will allow for 254 devices and the IP address of the router, or default gateway, is 192.168.1.1.
Now lets assume there are three switches and each switch needs 30 IP addresses. The subnet mask on each of these switches can be configured to a mask of 255.255.255.224.

My question is: how are the IP addresses split up?

Obviously, since the mask on the router only allows for 254 devices, we can't have more than that in total on the LAN. If we are giving 31 IP addresses to switch one, 31 IP addresses to switch two, and 31 IP addresses to switch three, do the need to be divided up in a certain way?
For example:
Switch 1: contains 192.168.1.2 through 192.168.1.33
Switch 2: contains 192.168.1.34 through 192.168.1.65
Switch 3: contains 192.168.1.66 through 192.168.1.97

Do the IP addresses need to be configured in a specific way such as the example above? If not, what's the best practice when configuring a network in this fashion?

Regards,
Ken Swartz

How are you going to assign subnets to the Layer 2 switches? If they are layer 3 switches, then keep the /24 subnet on the router and connected switchports, then assign any subnet you want behind each of the 3 switches.

## All 2 Replies

How are you going to assign subnets to the Layer 2 switches? If they are layer 3 switches, then keep the /24 subnet on the router and connected switchports, then assign any subnet you want behind each of the 3 switches.

Cimmerian,

I'm not sure I understand your question. The router would receive 254 usable IP addresses. The subnet on the router is 255.255.255.0. The router then assigns a subnet of 255.255.255.224 on G0/1, a subnet of 255.255.255.224 on G0/2, and a subnet of 255.255.255.224 on G0/3 effectivly giving each switch 30 IP addresses to play with.

I'm just not certain which IP addresses the switches each get or if it even matters.

Edit:
Specifically, this is the command used to assign subnets to a layer 2 switch from the router Gigabit Ethernet:

``````R1 (config) #interface gigabitethernet 0/1
R1 (config-if) #ip address 192.168.1.1 255.255.255.224
R1 (config-if) #exit
R1 (config) #interface gigibitethernet 0/2
R1 (config-if) #ip address 192.168.1.33 255.255.255.224
R1 (config-if) #exit
R1 (config) #interface gigibitethernet 0/2
R1 (config-if) #ip address 192.168.1.66 255.255.255.224
``````

I may have just answered my own question here in looking up the above commands.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.