Applicable Version | All (Acad/Std/Pro) |
Applicable Release | v13 or later |
In this article, we explain:
- What is IP addressing?
- How do we configure class C IP addresses in NetSim?
- What is a subnet? How to configure class C subnets in NetSim? Example: Creating 4 class C subnets with 64 hosts using a single switch and using multiple switches
- How to set firewall rules based on subnets?
IP Addressing
The unique number ID is assigned to one host or interface in a network. An IP address is an address used in order to uniquely identify a device on an IP network. An IPv4 address is made up of 32 binary bits, which can be divisible into a network portion and a host portion with the help of a subnet mask. The 32 binary bits are broken into four octets (1 octet = 8 bits). Each octet is converted to decimal and separated by a period (dot). For this reason, an IP address is said to be expressed in dotted decimal format (for example, 192.168.0.100). The value in each octet ranges from 0 to 255 decimal, or 00000000 - 11111111 binary.
IP address classes
Class | Address Range | Subnet masking | Leading bits | Max number of networks | Application |
IP Class A | 1 to 126 | 255.0.0.0 | 8 | 128 | Used for a large number of hosts. |
IP Class B | 128 to 191 | 255.255.0.0 | 16 | 16384 | Used for medium-size networks. |
IP Class C | 192 to 223 | 255.255.255.0 | 24 | 2097157 | Used for local area network. |
IP Class D | 224 to 239 | NA | NA | NA | Reserve for multi-tasking. |
IP Class E | 240 to 254 | NA | NA | NA | This class is reserved for R&D |
Table 1: IP address class and its application
Configuring Class-C address in NetSim
The default IP addressing in NetSim is class A addressing. However, users can reconfigure (static) IP addresses with different classes. The IP settings are in the network layer of end nodes, routers, and L3 switches.
Example 1: In this example, we have created a simple LAN network and modified the IP address of the routers and the users in the LAN network. See Figure 1. We have used the IP address range 192.168.0.1-192.168.0.255 with a mask 255.255.255.0. Put differently, the IP is 192.168.0.0/24. More details and examples on IP and subnet mask configuration is discussed in the subnetting section.
Figure 1: IPv4 Class C IP addressing
Subnetting
Subnetting is the practice of dividing a network into two or smaller networks. It increases routing efficiency, enhances the security of the network, and reduces the size of the broadcast domain.
A subnet mask is used to divide an IP address into two parts. One part identifies the host (computer), and the other part identifies the network to which it belongs. To better understand how IP addresses and subnet masks work, look at an IP address and see how it's organized.
Subnet | 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256 |
Host | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Subnet Mask | /24 | /25 | /26 | /27 | /28 | /29 | /30 | /31 | /32 |
Table 2: Class-C Subnetting using the slash method
Network ID | Subnet Mask | Host ID Range | # of Usable Host | Broadcast ID |
192.168.4.0 | /26 | 192.168.4.1 -192.168.4.62 | 62 | 192.168.4.63 |
192.168.4.64 | /26 | 192.168.4.65 -192.168.4.126 | 62 | 192.168.4.127 |
192.168.4.128 | /26 | 192.168.4.129 -192.168.4.190 | 62 | 192.168.4.191 |
192.168.4.192 | /26 | 192.168.4.193 -192.168.4.254 | 62 | 192.168.4.255 |
Table 3: Using subnet mask 255.255.255.192 i.e., /26 creating 4 different subnets with 62 usable hosts
Configuring Class-C subnetting
Refer to Figure 3. The default subnetting used (by the auto-IP configuration module) in NetSim is Class-b i.e., 255.255.0.0 or /16. Note that users have the flexibility to configure custom subnets using a subnet mask in NetSim.
We provide two examples to explain Class C sets. The example shows how to create 4 Subnets with 64 Hosts using: (i) a single switch and (ii) multiple switches
- Subnets using single switch: Note that IP address and subnet masks are configured. The application (traffic) flow is configured for intra-subnet communications.
Configuring IP addresses and subnets in NetSim is as simple as configuring it in MS Operating System. The devices in NetSim are configurable via UI, to set the IP and subnet, users need to modify the Network Layer as shown below in Figure 3.
Figure 2: Pair of users communicating with each other belong to separate subnet per Table 3
Figure 3: Configuring IP address and subnet mask in network layer of device in NetSim
- Subnets using multiple switches: Here subnets have been configured using multiple switches. In the given example as shown in Figure 5, we have considered 4 departments in a university campus, by configuring subnets for CS, EC, ME, and Finance(Admin). Application (traffic flow) is set for both intra and inter-subnet communication.
Department Name | IP Address Range |
Computer Science (CS) | 192.168.2.1 - 192.168.2.62 |
Electronics and Communication (EC) | 192.168.2.65 - 192.168.2.126 |
Mechanical Engineering (ME) | 192.168.2.129 - 192.168.2.190 |
Finance (Admin) | 192.168.2.193 - 192.168.2.254 |
Table 4: 4 subnets in a university based on Table 3
Figure 4: All the users are communicating from different subnets using a router and switch by configuring. Class-c subnetting has been configured.
Firewall rules based on subnets
An important benefit of subnetting is security. Firewall/ACL rules can be configured at a subnet level. NetSim provides options for users to configure ACL/firewall rules i.e., to PERMIT or DENY traffic at a router based on (i) IP address/Network address (ii) Protocol (iii) Inbound / Outbound traffic.
Example: In this example, we have explained how users can set firewall rules to DENY traffic at a subnet level.
- The topology considered here is the university network as shown in Figure 4.
- The firewall/ACL rules are set in the Organization Router
- ACL Rules:
- For the CS-department UDP traffic is denied
- For the EC-department TCP traffic is denied
- For the Mechanical department, Video Traffic (Eg: Youtube, Netflix etc) is denied
- For the Finance department any outbound applications are denied
- These rules can be set in NetSim UI just by filling an ACL application of the router as shown below in Figure 5
Figure 5: Setting firewall rules in the organization router
Download Link
The configuration files (scenario, settings, and other related files) of the examples discussed in this article are available for users to import and run in NetSim.
Users can download the files from NetSim’s git repository.
Link: https://github.com/NetSim-TETCOS/Subnetting-in-NetSim_v13.2/archive/refs/heads/main.zip
- Click on the link given and download the folder
- Extract the zip folder. The extracted project folder consists of one NetSim Experiments file, namely Subnetting-in-NetSim_v13.2.netsimexp
- Import per steps given in section 4.9.1 in NetSim User Manual
- All the experiments can now be seen folder-wise within NetSim > Your Work.