In the previous example, the 192.168.1.0/24 network was subnetted to create two subnets:
In Figure 1, notice that router R1 has two LAN segments attached to its GigabitEthernet interfaces. The subnets will be used for the segments attached to these interfaces. To serve as the gateway for devices on the LAN, each of the router interfaces must be assigned an IP address within the range of valid addresses for the assigned subnet. It is common practice to use the first or last available address in a network range for the router interface address.
The first subnet, 192.168.1.0/25, is used for the network attached to GigabitEthernet 0/0 and the second subnet, 192.168.1.128/25, is used for the network attached to GigabitEthernet 0/1. To assign an IP address for each of these interfaces, it is necessary to determine the range of valid IP addresses for each subnet.
The following are guidelines for each of the subnets:
- Network address - All 0 bits in the host portion of the address.
- First host address - All 0 bits plus a right-most 1 bit in the host portion of the address.
- Last host address - All 1 bits plus a right-most 0 bit in the host portion of the address.
- Broadcast address - All 1 bits in the host portion of the address.
As shown in Figure 2, the first host address for the 192.168.1.0/25 network is 192.168.1.1, and the last host address is 192.168.1.126. Figure 3 shows that the first host address for the 192.168.1.128/25 network is 192.168.1.129, and the last host address is 192.168.1.254.
To assign the first host address in each subnet to the router interface for that subnet, use the ip address command in interface configuration mode as shown in Figure 4. Notice that each subnet uses the subnet mask of 255.255.255.128 to indicate that the network portion of the address is 25 bits.
A host configuration for the 192.168.1.128/25 network is shown in Figure 5. Notice that the gateway IP address is the address configured on the G0/1 interface of R1, 192.168.1.129, and the subnet mask is 255.255.255.128.