` How to Create a Subnet and Configure Routing - Interlir networks marketplace
bgunderlay bgunderlay bgunderlay

How to Create a Subnet and Configure Routing

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.

What is a Subnet?

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.

Why is Subnetting Important?

Subnetting offers several benefits, including:

  1. Efficient IP Address Management

Dividing a large network into smaller subnets ensures that IP addresses are used more efficiently, avoiding address exhaustion.

  1. Improved Network Performance

By segmenting traffic within subnets, congestion and latency are reduced, leading to better overall network performance.

  1. Enhanced Security

Subnets can be isolated from each other, allowing for more control over access and traffic flow between different parts of the network.

  1. Simplified Troubleshooting

Issues within a specific subnet can be more easily identified and resolved.

How to Create a Subnet

Step 1: Define the Network Size and Requirements

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.

  • CIDR Notation

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).

Step 2: Calculate Subnet Mask

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 MaskCIDR NotationAvailable Hosts
255.255.255.0/24254
255.255.255.128/25126
255.255.255.192/2662
255.255.255.224/2730

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.

Step 3: Assign Subnet Addresses

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:

SubnetRangeUsable IP Addresses
Subnet 1192.168.1.0/26192.168.1.1 – 192.168.1.62
Subnet 2192.168.1.64/26192.168.1.65 – 192.168.1.126
Subnet 3192.168.1.128/26192.168.1.129 – 192.168.1.190
Subnet 4192.168.1.192/26192.168.1.193 – 192.168.1.254

Each subnet has its own range of usable IP addresses, reserved for devices within that network segment.

How to Configure Routing Between Subnets

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.

Step 1: Understand Routing Basics

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.

  • Static Routing

A method where routes are manually added to the routing table.

  • Dynamic Routing

Uses protocols like OSPF or RIP to automatically update routing tables.

Step 2: Configure Static Routing

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

Step 3: Dynamic Routing Configuration

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.

Configuring Routing in Cloud Environments

In cloud environments like AWS, routing between subnets is configured through the VPC (Virtual Private Cloud) console.

Step 1: Create Subnets in AWS

  1. Navigate to the VPC dashboard in AWS.
  2. Select Create Subnet and specify the CIDR block (IP range) for each subnet.
  3. Assign the subnet to an availability zone.

Step 2: Configure Route Tables

  1. In the Route Tables section of the VPC dashboard, create a new route table.
  2. Add routes that specify which subnets traffic should be routed to and via which gateways (such as Internet Gateway or NAT Gateway).

For example, to route traffic between two subnets:

  • Destination: 192.168.2.0/24
  • Target: Local

Subnetting and Routing

FeatureStatic RoutingDynamic Routing
ConfigurationManually configured routesAutomatically updated by protocols
Best ForSmall networks with limited subnetsLarge, complex networks with many subnets
Protocols UsedNoneOSPF, RIP, EIGRP
ScalabilityLimitedHighly scalable
Management OverheadHigh (requires manual changes)Low (automatically updates routes)

Best Practices for Subnetting and Routing

  • Plan Subnets Based on Requirements

Define subnets based on the number of hosts, geographical location, or departments.

  • Use Dynamic Routing for Large Networks

In complex environments, dynamic routing protocols like OSPF simplify routing management.

  • Monitor Network Performance

Regularly monitor the performance of routing configurations to identify and resolve bottlenecks.

  • Secure Subnet Communications

Implement access control lists (ACLs) and firewalls to secure traffic between subnets.

Conclusion

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

    Ready to get started?

    Articles
    Renting/leasing/purchasing
    Renting/leasing/purchasing

    Having a clear understanding of the different types and purposes of IP addresses

    More
    How to do IP address abuse management in 2024
    How to do IP address abuse management in 2024

    the rights to manage blocks of IP addresses are constantly faced with a dilemma.

    More
    European IPv4 addresses marketplace
    European IPv4 addresses marketplace

    In 2011, RIPE announced the depletion of IPv4 addresses. IPv4 addresses continue

    More
    Digital future and IPv4 address
    Digital future and IPv4 address

    addresses are trite. The allocation from the Primary IPv4 Registry, begun by John

    More
    What is an IPv4 address?
    What is an IPv4 address?

    unique identifier that points to each device on the internet and allows them to communicate

    More
    The great IP space redistribution
    The great IP space redistribution

    One of the possible ways to support the development of the IT sector is the effective

    More
    How to Monetize IP Network
    How to Monetize IP Network

    Even if you don’t plan to sell your IPv4 network, there are still ways to make

    More
    INTERLIR: IPv4 Address Broker and Networks Marketplace
    INTERLIR: IPv4 Address Broker and Networks Marketplace

    InterLIR GmbH is a marketplace solution that aims to solve network availability problems

    More
    Managing IPv4 Scarcity Through IP Lease
    Managing IPv4 Scarcity Through IP Lease

    l IPv4, where is possible only 4,3 billion combination of the numbers.

    More
    Sell IPv4 Addresses
    Sell IPv4 Addresses

    The increasing demand for IP blocks has driven up prices and transformed overused

    More