Skip to content

Repository files navigation

This project was created as part of the 42 curriculum by anacharp

NetPractice

Description

NetPractice is a practical exercise designed to introduce us to the fundamentals of computer networking. The goal is to learn how to configure IP addresses, connect devices through a router, and understand the role of a gateway within a network. To achieve this, we must configure small-scale networks simulated through a training interface, completing 10 levels in total.

Instructions

To launch the exercise, download the net_practice.tgz package and start the training interface with:

./net_practice.1.9/net_practice/run.sh

This will launch the web server. You can then choose between Training and Evaluation modes.

Training:

  • Complete the exercise
  • When ready, verify your work by clicking Check again
  • If the result is correct, click Get my config to save your configuration as a JSON file
  • Proceed to the next level by clicking Next level Evaluation:
  • Complete 3 random levels chosen from levels 6 to 10

Submission Details

To submit this project, you must export your configuration for all 10 levels using the Get my config button. Place these 10 exported configuration files (one per level) directly at the root of your Git repository.


Concepts

TCP/IP Addressing

TCP

TCP (Transmission Control Protocol) is a communication standard that allows applications and devices to exchange messages over a network. It sends packets across the Internet and ensures the reliable transmission of data. TCP is one of the foundational standards that define the rules of the Internet: it organizes data so that it can be transmitted between a server and a client, while guaranteeing the integrity of the data communicated over a network.

IP

IP (Internet Protocol) is used to send data between devices over the Internet. Every device has an IP address that identifies it and allows it to communicate and exchange data with other connected devices. Today, it is the standard for fast and secure communication.

IPv4 vs IPv6:

  • IPv4:

    • Internet Protocol version 4
    • Deployed in 1978
    • 32-bit address space
    • 4 numbers between 0 and 255
    • Supports over 4.3 billion unique addresses — no longer sufficient for today's needs
    • Example: 168.213.226.204
    • Configured via DHCP or manually
  • IPv6:

    • Internet Protocol version 6
    • Deployed in 1998
    • 128-bit address space
    • Written in hexadecimal
    • Supports 340 sextillion unique addresses
    • Example: 2001:0ab8:85a2:0000:0000:8a3e:0370:7334
    • Supports autoconfiguration Public IP vs Private IP:
  • Public: Accessible directly over the Internet. Assigned to your network router by your Internet Service Provider (ISP).

  • Private: Assigned by your router to devices within your local network. Each device on the network receives a unique private IP address. The following ranges are reserved for private use:

192.168.0.0 – 192.168.255.255
172.16.0.0  – 172.31.255.255
10.0.0.0    – 10.255.255.255

TCP vs IP

TCP and IP are separate protocols that work together to ensure reliable data transmission across a network. IP is responsible for identifying the address of the destination device, while TCP handles the transport and routing of data across the network, verifying that it is delivered to the correct device.

TCP/IP

Together, TCP and IP enable communication between devices over long distances, transferring data as efficiently as possible.

The TCP/IP model is organized into 4 layers:

Layer Name Role
4 Application What the user interacts with
3 Transport Provides reliable data transfer
2 Internet Handles routing and IP addressing
1 Network / Link Handles physical hardware connections

Subnet Masks

A subnet mask is a 32-bit number used in IPv4 networking to divide an IP address into two components: the network portion and the host portion.

Finding the network address:

IP address : 104.198.241.125
Mask       : 255.255.255.128

First, convert both the IP address and the mask to binary:

IP address : 01101000.11000110.11110001.01111101
Mask       : 11111111.11111111.11111111.10000000

Apply the mask to the IP address using a bitwise AND to find the network address:

Network address : 01101000.11000110.11110001.00000000
Network address = 104.198.241.0

Finding the range of host addresses:

The host portion is determined by the bits set to 0 in the mask — in this case, the last 7 bits:

BINARY  : 0000000 – 1111111
DECIMAL : 0 – 127

The valid host range is therefore: 104.198.241.1 – 104.198.241.126

  • 104.198.241.0 — Reserved as the network address
  • 104.198.241.127 — Reserved as the broadcast address, used to send packets to all hosts on the network

CIDR Notation

The subnet mask can also be expressed using CIDR (Classless Inter-Domain Routing) notation: a slash / followed by the number of bits used for the network portion.

CIDR Decimal Mask Total Addresses Max Usable Hosts
/8 255.0.0.0 16,777,216 16,777,214
/9 255.128.0.0 8,388,608 8,388,606
/10 255.192.0.0 4,194,304 4,194,302
/11 255.224.0.0 2,097,152 2,097,150
/12 255.240.0.0 1,048,576 1,048,574
/13 255.248.0.0 524,288 524,286
/14 255.252.0.0 262,144 262,142
/15 255.254.0.0 131,072 131,070
/16 255.255.0.0 65,536 65,534
/17 255.255.128.0 32,768 32,766
/18 255.255.192.0 16,384 16,382
/19 255.255.224.0 8,192 8,190
/20 255.255.240.0 4,096 4,094
/21 255.255.248.0 2,048 2,046
/22 255.255.252.0 1,024 1,022
/23 255.255.254.0 512 510
/24 255.255.255.0 256 254
/25 255.255.255.128 128 126
/26 255.255.255.192 64 62
/27 255.255.255.224 32 30
/28 255.255.255.240 16 14
/29 255.255.255.248 8 6
/30 255.255.255.252 4 2

Default Gateways

A default gateway is the node in a network — typically a router — responsible for forwarding traffic to other networks. When a device needs to send a packet to an IP address outside its own local subnet, it sends the packet to its default gateway.

Example: Your home internet box acts as the default gateway for your personal computer.


Routers

Routers guide and direct network data using packets, which can contain files, communications, or simple transmissions such as web requests. They determine the most efficient path to forward each packet toward its destination.


Routing Table

A routing table is a set of rules stored on a router (or other network device) that determines where network packets should be forwarded. Each entry typically specifies a destination network, a subnet mask, and the next hop or interface to use.


Switches

A switch connects multiple devices within a network (typically a LAN) and forwards data packets only to the specific intended recipient. Unlike a router, a switch does not route packets between different networks — it operates within a single network segment.


OSI Model

When data travels across a network, it follows a structured framework called the OSI Model (Open Systems Interconnection), which breaks down communication into 7 distinct layers.

Layer Name Role
7 Application The interface through which users interact with the network
6 Presentation Translates data into a usable format (encoding, encryption, compression)
5 Session Establishes, manages, and terminates communication sessions
4 Transport Ensures complete, ordered data delivery (TCP, UDP)
3 Network Determines routing between different networks
2 Data Link Handles local delivery within the same network segment using MAC addresses
1 Physical The actual hardware and transmission medium

Resources

Networking Basics

NetPractice

TCP/IP Addressing

Subnet Masks

Default Gateways

Routers

Switches

OSI Layers

AI Usage

  • Correction of my English in the README

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors