๐ Netpractice ๐
Overview
Netpractice is a networking project from the 42 curriculum focused on understanding IP addressing and routing fundamentals. The project consists of solving a set of interactive exercises where the user must correctly configure network devices so that communication between hosts is possible.
The main goal is to develop a solid understanding of how devices communicate at OSI layers 1, 2, and 3, with emphasis on IPv4 addressing, subnet masks, routing tables, default gateways, routers, and switches.
Table of Contents
Requirements โ๏ธ
- Linux or macOS
- A modern web browser (Firefox, Chromium, Chrome, etc.)
tar utility
Installation ๐ง
To get started, first clone the repository and navigate to the project directory on your computer:
git clone https://github.com/alcarril/Net.Practice.git <name-of-your-choice>
cd <name-of-your-choice>
Extract the project archive provided in the repository.
Usage ๐
After extracting the files, open the interface using a web browser.
Modes of Operation
Once opened, the Netpractice interface will load. There are two modes available:
Training Mode
Training mode allows practice using a personalized configuration associated with the user login.
The objective is to ensure correct communication between all devices according to the given topology.

After completing a level:
- Check again validates the configuration.
- Get my config exports the configuration as a JSON file.
- Successfully validating a level unlocks the next level.

At the bottom of the interface, packet flow logs display how IP packets traverse the network. These logs are essential for debugging issues such as:
- Incorrect or missing default gateways
- Invalid IP addresses
- Wrong subnet masks

Evaluation Mode
Evaluation mode generates a randomized network configuration, intended for assessments.
- Exercises are selected randomly.
- Focuses mainly on levels 6 and above, where routing complexity increases.
Resources and Concepts ๐
What is a Network?
A network is a set of interconnected devices that can communicate and share resources and information (data packets) with each other (data transfer). It consists of a physical part (hardware such as cables, routers, and servers) and a logical part (protocols that dictate how data is transmitted).
Private Networks
- Private networks are restricted to specific users or organizations and are not accessible to the general public.
- Commonly used in homes, offices, or enterprises to share resources like printers, servers, and databases.
- More secure because they are isolated from public access and often include additional security measures such as firewalls and encryption.
- Examples: Home Wi-Fi networks and corporate intranets.
Public Networks
- Public networks are open to anyone and are used for global communication and information sharing.
- Commonly used to access the Internet or public Wi-Fi in places like cafes, airports, or libraries.
- Less secure due to their open nature, so additional protections like VPNs or encryption are often necessary.
- Examples: The Internet and free Wi-Fi hotspots.
What is a communication Protocol ?
Protocols are, in fact, the set of standardized rules that define how data should be formatted, transmitted, received, and interpreted between devices. Without them, communication would be chaotic.
OSI Model
The OSI (Open Systems Interconnection) model is a conceptual framework used to understand and standardize how different networking protocols interact. It divides the communication process into seven distinct layers, each with specific functions and responsibilities. These layers are:
- Physical Layer: Handles the transmission of raw data bits over a physical medium, such as cables or wireless signals.
- Data Link Layer: Ensures reliable data transfer between devices on the same network, managing error detection and correction.
- Network Layer: Responsible for routing and forwarding data packets between different networks.
- Transport Layer: Provides end-to-end communication control, ensuring data is delivered reliably and in the correct order.
- Session Layer: Manages and controls the connections between devices, including establishing, maintaining, and terminating sessions.
- Presentation Layer: Translates data between the application layer and the network, handling encryption, compression, and data formatting.
- Application Layer: Provides network services directly to end-user applications, such as web browsers and email clients.
The OSI model helps developers and engineers design and troubleshoot network systems by providing a clear structure for understanding how data flows through a network.
TCP/IP Protocol
The Internet Protocol (IP) is responsible for logical addressing and routing. It uses IP addresses, which are logical identifiers assigned to devices within a network. Depending on whether the network is private or public, IP addresses can be private or public, and this is where the Network Address Translation (NAT) mechanism comes into play, allowing private addresses to be translated into public ones for communication over the Internet.
In addition to addressing, IP is also responsible for routing packets across networks. When a computer sends data to another computer, the data is first transmitted over a local network, such as Ethernet or Wi-Fi, and then reaches a router. Routers forward packets based on their routing tables, sending them to the next hop router until the packets reach the destination network.
IP follows a best-effort delivery model, meaning it attempts to deliver packets using the most efficient available path, but it does not guarantee delivery, order, or integrity.
On the other hand, Transmission Control Protocol (TCP) provides reliable communication. TCP ensures that all transmitted data is correctly received by segmenting the data stream, tracking segments with sequence numbers, and confirming reception through acknowledgements (ACKs). If some segments are lost during transmission, TCP detects the loss and requests retransmission from the sender, ensuring complete and accurate data delivery.
IP Addressing
An IP address is a unique identifier that allows devices to communicate on a network. Depending on the number of bits, it can be IPv4 (32 bits) or IPv6 (128 bits). For example, a typical IPv4 address is:
192.168.1.10 โ 11000000.10101000.00000001.00001010
A subnet mask defines which part of the IP address corresponds to the network and which part corresponds to the host. For example, the mask in binary is:
255.255.255.0 โ 11111111.11111111.11111111.00000000
Note: Subnet masks can be written in dotted decimal notation (255.255.255.0) or in CIDR notation (/24).
To obtain the network address, a bitwise AND operation is performed between the IP and the mask:
IP: 11000000.10101000.00000001.00001010 (192.168.1.10)
Mask: 11111111.11111111.11111111.00000000 (255.255.255.0)
---------------------------------------------------
Network: 11000000.10101000.00000001.00000000 โ 192.168.1.0
The host addresses range from the first valid device to the broadcast address of the network:
- Valid hosts: 192.168.1.1 โ 192.168.1.254
- Broadcast: 192.168.1.255
CIDR Subnet Mask Summary
| CIDR |
Subnet Mask |
Wildcard Mask |
# of IP Addresses |
# of Usable IP Addresses |
| /32 |
255.255.255.255 |
0.0.0.0 |
1 |
1 |
| /31 |
255.255.255.254 |
0.0.0.1 |
2 |
2 |
| /30 |
255.255.255.252 |
0.0.0.3 |
4 |
2 |
| /29 |
255.255.255.248 |
0.0.0.7 |
8 |
6 |
| /28 |
255.255.255.240 |
0.0.0.15 |
16 |
14 |
| /27 |
255.255.255.224 |
0.0.0.31 |
32 |
30 |
| /26 |
255.255.255.192 |
0.0.0.63 |
64 |
62 |
| /25 |
255.255.255.128 |
0.0.0.127 |
128 |
126 |
| /24 |
255.255.255.0 |
0.0.0.255 |
256 |
254 |
| /23 |
255.255.254.0 |
0.0.1.255 |
512 |
510 |
| /22 |
255.255.252.0 |
0.0.3.255 |
1,024 |
1,022 |
| /21 |
255.255.248.0 |
0.0.7.255 |
2,048 |
2,046 |
| /20 |
255.255.240.0 |
0.0.15.255 |
4,096 |
4,094 |
| /19 |
255.255.224.0 |
0.0.31.255 |
8,192 |
8,190 |
| /18 |
255.255.192.0 |
0.0.63.255 |
16,384 |
16,382 |
| /17 |
255.255.128.0 |
0.0.127.255 |
32,768 |
32,766 |
| /16 |
255.255.0.0 |
0.0.255.255 |
65,536 |
65,534 |
| /15 |
255.254.0.0 |
0.1.255.255 |
131,072 |
131,070 |
| /14 |
255.252.0.0 |
0.3.255.255 |
262,144 |
262,142 |
| /13 |
255.248.0.0 |
0.7.255.255 |
524,288 |
524,286 |
| /12 |
255.240.0.0 |
0.15.255.255 |
1,048,576 |
1,048,574 |
| /11 |
255.224.0.0 |
0.31.255.255 |
2,097,152 |
2,097,150 |
| /10 |
255.192.0.0 |
0.63.255.255 |
4,194,304 |
4,194,302 |
| /9 |
255.128.0.0 |
0.127.255.255 |
8,388,608 |
8,388,606 |
| /8 |
255.0.0.0 |
0.255.255.255 |
16,777,216 |
16,777,214 |
| /7 |
254.0.0.0 |
1.255.255.255 |
33,554,432 |
33,554,430 |
| /6 |
252.0.0.0 |
3.255.255.255 |
67,108,864 |
67,108,862 |
| /5 |
248.0.0.0 |
7.255.255.255 |
134,217,728 |
134,217,726 |
| /4 |
240.0.0.0 |
15.255.255.255 |
268,435,456 |
268,435,454 |
| /3 |
224.0.0.0 |
31.255.255.255 |
536,870,912 |
536,870,910 |
| /2 |
192.0.0.0 |
63.255.255.255 |
1,073,741,824 |
1,073,741,822 |
| /1 |
128.0.0.0 |
127.255.255.255 |
2,147,483,648 |
2,147,483,646 |
| /0 |
0.0.0.0 |
255.255.255.255 |
4,294,967,296 |
4,294,967,294 |
Routing
Routing is responsible for connecting different networks and ensuring that packets reach their destination even if it is outside the source network. Both hosts and routers communicate through their network interfaces, which are physical or virtual connection points with their own network interface card (NIC) and MAC address, and can also have an assigned IP address.
LAN - LAN Communication
When a host sends a packet to a destination within the same network, the packet is delivered directly through a switch, which forwards the data using the MAC addresses of the devices' interfaces. It can also send by the router "integrated switch" if available or wifi access point.
What is a switch?
A switch is a networking device that operates at the Data Link Layer (Layer 2) of the OSI model. Its primary function is to connect multiple devices within a local area network (LAN) and facilitate communication between them by forwarding data packets based on their MAC addresses.