`
As network infrastructures grow in size and complexity, the need for effective IP address management and efficient routing becomes critical. Subnets play a vital role in dividing larger networks into smaller, more manageable segments, while routing ensures that traffic is correctly directed between these subnets. Understanding how to create subnets and configure routing is essential for maintaining an organized, scalable, and secure network.
A subnet (short for subnetwork) is a logically defined portion of an IP network. Subnets allow you to break down a large network into smaller, more manageable parts. This not only improves network performance but also enhances security and simplifies network management. Subnetting helps in organizing networks based on departments, geographical locations, or other logical groupings.
Each subnet has its own IP range and is distinguished by a unique subnet mask, which defines the size of the subnet and its address range.
Subnetting offers several benefits, including:
Dividing a large network into smaller subnets ensures that IP addresses are used more efficiently, avoiding address exhaustion.
By segmenting traffic within subnets, congestion and latency are reduced, leading to better overall network performance.
Subnets can be isolated from each other, allowing for more control over access and traffic flow between different parts of the network.
Issues within a specific subnet can be more easily identified and resolved.
Before creating a subnet, you must determine how many hosts will be within each subnet and how many subnets you need. The size of each subnet is based on the number of IP addresses it will contain, which is defined by the subnet mask.
Subnets are often defined using CIDR (Classless Inter-Domain Routing) notation, which specifies the number of bits used for the network portion of the IP address. For example, a subnet defined as 192.168.1.0/24 uses 24 bits for the network portion, leaving 8 bits for host addresses (allowing for 254 usable IP addresses).
The subnet mask determines how many bits are allocated for the network and how many are available for host addresses. The more bits assigned to the network portion, the smaller the number of available host addresses.
Here’s how to calculate subnets based on requirements:
Subnet Mask | CIDR Notation | Available Hosts |
255.255.255.0 | /24 | 254 |
255.255.255.128 | /25 | 126 |
255.255.255.192 | /26 | 62 |
255.255.255.224 | /27 | 30 |
To create a subnet, you’ll need to determine how many IP addresses are required for each subnet and then select an appropriate subnet mask. For instance, if you need 30 IP addresses per subnet, you could choose a /27 subnet mask, which allows for 30 hosts.
Once you’ve calculated the appropriate subnet size, assign IP ranges to each subnet. Here’s an example of dividing the 192.168.1.0/24 network into smaller subnets:
Subnet | Range | Usable IP Addresses |
Subnet 1 | 192.168.1.0/26 | 192.168.1.1 – 192.168.1.62 |
Subnet 2 | 192.168.1.64/26 | 192.168.1.65 – 192.168.1.126 |
Subnet 3 | 192.168.1.128/26 | 192.168.1.129 – 192.168.1.190 |
Subnet 4 | 192.168.1.192/26 | 192.168.1.193 – 192.168.1.254 |
Each subnet has its own range of usable IP addresses, reserved for devices within that network segment.
After creating subnets, you need to configure routing to allow traffic between these subnets. Without routing, devices in different subnets won’t be able to communicate with each other.
Routing is the process of forwarding data packets between networks or subnets. A router or layer 3 switch is responsible for making decisions about where to send packets based on their destination IP addresses.
A method where routes are manually added to the routing table.
Uses protocols like OSPF or RIP to automatically update routing tables.
If your network is relatively simple, static routing can be used. Here’s how to add a static route on Linux:
Open the terminal and use the following command to add a route:
sudo ip route add <destination network> via <gateway IP> dev <interface>
For example:
sudo ip route add 192.168.2.0/24 via 192.168.1.1 dev eth0
Verify that the route has been added:
ip route show
On Windows, static routes can be added using the route command:
route add <destination network> mask <subnet mask> <gateway IP>
For example:
route add 192.168.2.0 mask 255.255.255.0 192.168.1.1
For larger networks with multiple subnets and routers, dynamic routing is more efficient. Protocols like OSPF (Open Shortest Path First) and RIP (Routing Information Protocol) can automatically manage routes.
To enable OSPF on a Cisco router, for example:
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
network 192.168.2.0 0.0.0.255 area 0
This will automatically route traffic between the two subnets.
In cloud environments like AWS, routing between subnets is configured through the VPC (Virtual Private Cloud) console.
For example, to route traffic between two subnets:
Feature | Static Routing | Dynamic Routing |
Configuration | Manually configured routes | Automatically updated by protocols |
Best For | Small networks with limited subnets | Large, complex networks with many subnets |
Protocols Used | None | OSPF, RIP, EIGRP |
Scalability | Limited | Highly scalable |
Management Overhead | High (requires manual changes) | Low (automatically updates routes) |
Define subnets based on the number of hosts, geographical location, or departments.
In complex environments, dynamic routing protocols like OSPF simplify routing management.
Regularly monitor the performance of routing configurations to identify and resolve bottlenecks.
Implement access control lists (ACLs) and firewalls to secure traffic between subnets.
Creating subnets and configuring routing are essential skills for any network administrator. By properly segmenting your network into subnets, you can improve performance, enhance security, and make network management more efficient. Understanding the different routing options, whether static or dynamic, allows you to choose the best approach based on your network’s size and complexity.
Alexander Timokhin
CCO
Alexander Timokhin
CCO