This project has been created as part of the 42 curriculum by aakritah.
A practical introduction to computer networking through hands-on IP configuration exercises. NetPractice teaches the fundamentals of TCP/IP addressing, subnetting, and network topology through 10 progressively challenging levels.
NetPractice is an interactive training platform designed to build foundational networking knowledge. Through a browser-based interface, you'll configure small-scale networks by setting IP addresses, subnet masks, and routing tables to make non-functioning networks operational.
The project covers essential networking concepts including IP addressing schemes, subnet calculations, gateway configuration, and understanding how devices communicate within and between networks. Each of the 10 levels presents a unique networking scenario that must be solved by correctly configuring the available network parameters.
Learning Objectives:
- Understand TCP/IP addressing and how it enables network communication
- Master subnet masks and network segmentation
- Configure routing between networks using gateways
- Distinguish between private and public IP ranges
- Learn the practical application of networking theory
- Download and extract the project files from the intranet
- Navigate to the extracted folder in your terminal
- Launch the interface by running:
This will start a local web server and open the training interface in your browser.
./run.sh
Alternative method (if run.sh doesn't work):
python3 -m http.server 49242Then navigate to http://localhost:49242 in your web browser.
Training Mode:
- Enter your 42 login in the designated field
- This loads your personal configuration and progress
- Complete all 10 levels in sequence
Evaluation Mode:
- Use the "evaluation" tab for random configurations
- Useful for practice and peer evaluations
For each level:
- Analyze the network diagram and identify what's broken
- Check objectives at the top of the screen
- Configure the unshaded fields (IP addresses, subnet masks, routes)
- Validate your solution using the
Check againbutton - Export your configuration with the
Get my configbutton - Save the exported file before moving to the next level
IP addresses uniquely identify devices on a network. In IPv4, they consist of 4 octets (32 bits total), written in decimal notation like 192.168.1.1.
IP Address Classes:
- Class A:
1.0.0.0to126.255.255.255(for very large networks) - Class B:
128.0.0.0to191.255.255.255(for medium-sized networks) - Class C:
192.0.0.0to223.255.255.255(for small networks)
Private IP Ranges (not routable on the internet):
10.0.0.0to10.255.255.255(Class A)172.16.0.0to172.31.255.255(Class B)192.168.0.0to192.168.255.255(Class C)127.0.0.0to127.255.255.255(Loopback)
A subnet mask determines which portion of an IP address represents the network and which represents the host.
Common subnet masks:
/24or255.255.255.0- 256 addresses (254 usable hosts)/25or255.255.255.128- 128 addresses (126 usable hosts)/26or255.255.255.192- 64 addresses (62 usable hosts)/27or255.255.255.224- 32 addresses (30 usable hosts)/28or255.255.255.240- 16 addresses (14 usable hosts)/30or255.255.255.252- 4 addresses (2 usable hosts, for point-to-point links)
CIDR Notation:
Instead of writing 255.255.255.0, we use /24 to indicate 24 network bits.
Calculating network ranges:
IP: 192.168.1.50
Subnet: 255.255.255.0 (/24)
Network: 192.168.1.0
Broadcast: 192.168.1.255
Usable IPs: 192.168.1.1 - 192.168.1.254
The gateway (or default gateway) is the router's IP address that connects your local network to other networks. Devices send traffic destined for other networks to this gateway.
Gateway requirements:
- Must be on the same subnet as the host
- Must be a valid IP within the network range
- Typically the router's interface IP on that network
Example:
Host IP: 192.168.1.10/24
Gateway: 192.168.1.1
Network: 192.168.1.0/24
This host can communicate with 192.168.1.x directly,
but needs the gateway (192.168.1.1) to reach 10.0.0.x
Routers connect different networks and forward packets between them. They have multiple interfaces, each with an IP address on a different network.
Routing tables tell routers where to send packets:
- Destination: Target network
- Next hop: Where to send packets for that destination
- Default route (
0.0.0.0/0): Where to send packets when no specific route matches
Switches connect devices within the same network. Unlike routers:
- They operate at Layer 2 (Data Link Layer)
- They don't route between different networks
- They forward frames based on MAC addresses
In NetPractice, switches are mostly transparent - devices connected to the same switch are on the same network segment.
Layer 3 - Network Layer:
- Handles IP addressing and routing
- Routers operate here
- Determines the path packets take across networks
Layer 2 - Data Link Layer:
- Handles MAC addressing and frame switching
- Switches operate here
- Manages direct node-to-node transfer
Layer 1 - Physical Layer:
- Physical cables and connections
- Actual transmission of raw bits
Why subnet?
- Divide large networks into smaller, manageable segments
- Improve security and performance
- Reduce broadcast traffic
Subnet calculation formula:
Number of hosts = 2^(32 - prefix_length) - 2
Examples:
/24 = 2^(32-24) - 2 = 2^8 - 2 = 254 hosts
/25 = 2^(32-25) - 2 = 2^7 - 2 = 126 hosts
/30 = 2^(32-30) - 2 = 2^2 - 2 = 2 hosts
We subtract 2 because:
- Network address (all host bits = 0) is reserved
- Broadcast address (all host bits = 1) is reserved
β IP and gateway on different subnets
IP: 192.168.1.10/24
Gateway: 192.168.2.1 β Wrong! Different network
β Correct configuration
IP: 192.168.1.10/24
Gateway: 192.168.1.1 β Same network
β Using network or broadcast address
Network: 192.168.1.0/24
IP assigned: 192.168.1.0 β Network address, invalid!
IP assigned: 192.168.1.255 β Broadcast address, invalid!
β Using valid host addresses
Network: 192.168.1.0/24
IP assigned: 192.168.1.1 to 192.168.1.254
β Overlapping subnets
Interface A: 192.168.1.0/24
Interface B: 192.168.1.128/25 β Overlaps with Interface A!
- Identify the network topology: How many networks? How are they connected?
- Check the objectives: What needs to communicate with what?
- Plan your subnets: Ensure no overlaps, appropriate sizes
- Configure IPs: Keep devices on the same network together
- Set gateways: Point to the router interface on the local network
- Configure routing: Ensure routers know how to reach all networks
- Validate: Use the checker and read error messages carefully
[ PC A ] --- [ Switch ] --- [ PC B ]
Requirements:
- PC A and PC B must communicate
- Both on the same network
Solution:
PC A: 192.168.1.10/24
PC B: 192.168.1.20/24
(No gateway needed - same network, direct communication)
[ PC A ] --- [ Router ] --- [ PC B ]
Interface1 Interface2
Requirements:
- PC A (left) must reach PC B (right)
Solution:
PC A: 10.0.0.10/24, Gateway: 10.0.0.1
Router Int1: 10.0.0.1/24
Router Int2: 192.168.1.1/24
PC B: 192.168.1.10/24, Gateway: 192.168.1.1
Network: 192.168.1.0/24
Need to create 4 subnets
Solution (/26 gives 4 subnets of 64 IPs each):
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)
- TCP/IP Guide - Comprehensive networking resource
- Subnet Calculator - For practice and verification
- RFC 791 - Internet Protocol - Official IP specification
- RFC 1918 - Private Address Allocation - Private IP ranges
- Subnetting Made Easy - Video tutorial on subnetting
- IP Addressing and Subnetting for New Users - Cisco guide
- Understanding TCP/IP - IBM documentation
- OSI Model: Understanding the 7 layers of networking
- Binary/Decimal Conversion: Essential for subnet calculations
- CIDR Notation: Modern method of IP addressing
- Routing Protocols: How routers share information (beyond this project's scope)
- Subnet calculators: For verifying your calculations
- Binary converters: Understanding IP addresses in binary
- Network simulators: Packet Tracer, GNS3 (for deeper learning)
After completing NetPractice, you will be able to:
- β Calculate subnet masks and determine usable IP ranges
- β Configure IP addresses for devices on the same and different networks
- β Set up routing between networks using gateways
- β Identify and fix common networking misconfigurations
- β Understand how packets flow through a network topology
- β Apply binary math to networking problems
- β Read and interpret network diagrams
- β Troubleshoot connectivity issues systematically
Networking might seem abstract at first, but NetPractice makes it tangible. Each level solved deepens your understanding of how the internet actually works. Take your time, understand the concepts, and the solutions will follow naturally.
Good luck! π