Skip to content

mohammadalhindi1/Net_Practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NetPractice

NetPractice Final Level Preview

42 NetPractice Networking Completed

About

This repository contains my solutions and explanations for the NetPractice project from the 42 curriculum.

NetPractice is a networking project focused on configuring IPv4 addresses, subnet masks, gateways, and routing tables to make different hosts communicate correctly.

The purpose of this repository is not just to store the final answers, but to document the way I think through each level, how I split the network, how I choose valid subnets, and how I debug routing errors.

This guide is written as a study reference for myself and for anyone learning the basics of networking through NetPractice.


Contents


Repository Structure

.
├── README.md
├── img/
│   ├── level1.png
│   ├── level2.png
│   ├── level3.png
│   ├── level4.png
│   ├── level5.png
│   ├── level6.png
│   ├── level7.png
│   ├── level8.png
│   ├── level9.png
│   └── level10.png
└── solution/
    ├── level1.json
    ├── level2.json
    ├── level3.json
    ├── level4.json
    ├── level5.json
    ├── level6.json
    ├── level7.json
    ├── level8.json
    ├── level9.json
    └── level10.json
Folder Description
img/ Contains screenshots for every solved level
solution/ Contains the exported NetPractice JSON configuration files
README.md Contains the explanation, concepts, and level walkthroughs

How to Use NetPractice

When you open NetPractice, you will see two modes:

Training
Evaluation

Training Mode

Training mode is used for practice.

In this mode, you can solve the levels one by one and move between them freely.

After solving a level, click:

Get my config

to export the configuration as a .json file.

This is the file saved in this repository under:

solution/

Example:

solution/level1.json

Evaluation Mode

Evaluation mode is the real project validation mode.

In the 42 evaluation, you usually need to solve the levels within a limited time.

A good target is:

Less than 15 minutes

To be ready for evaluation, practice until you can:

  • Read the topology quickly.
  • Identify subnets without guessing.
  • Configure gateways correctly.
  • Add router routes without creating loops.
  • Fix errors by reading the logs.

Recommended Practice Method

Before going to evaluation mode, solve the levels in order:

Level 1 -> Level 2 -> Level 3 -> ... -> Level 10

Do not jump directly to the final levels.

The levels build on each other:

  • Early levels teach direct communication and subnet masks.
  • Middle levels introduce gateways and routers.
  • Later levels combine routing tables, reverse paths, Internet routes, and troubleshooting.

During Evaluation

My strategy during evaluation is:

  1. Start with the easiest directly connected networks.
  2. Configure host IPs and masks first.
  3. Configure gateways only after the local networks are correct.
  4. Configure router routes.
  5. Configure Internet reverse routes.
  6. Press Check again.
  7. Read the first real error in the log.
  8. Fix one problem at a time.

Do not randomly change values.

Most mistakes come from:

Wrong subnet
Wrong gateway
Missing reverse route
Network or broadcast address used as host IP
Routing loop

Using the Logs

The logs are very useful because they show the exact path of the packet.

Example:

Forward way: A -> B
on A: packet accepted
on A: send to A1
on B: packet accepted
on B: destination IP reached

This means the forward path worked.

For a complete success, the reverse path must also work:

Reverse way: B -> A
on B: packet accepted
on B: send to B1
on A: packet accepted
on A: destination IP reached

If the forward path works but the reverse path fails, the problem is usually a missing return route.

If the log says:

loop detected

then traffic is probably being sent back to a device it already passed through.

If the log says:

invalid route

then the gateway is probably not directly reachable.

If the log says:

destination does not match any route

then a route is missing.


back to contents

Basics

For this project, we only deal with IPv4.

An IPv4 address is a 32-bit number divided into four blocks. Each block is 8 bits.

Example:

192.168.100.1

In binary:

11000000.10101000.01100100.00000001

Each block can have a value from:

0 to 255

The same binary logic applies to subnet masks.

Example:

255.255.255.0

In binary:

11111111.11111111.11111111.00000000

After a bit becomes 0 in a subnet mask, there cannot be any 1 bits after it.

That is why these values are valid inside masks:

255 = 11111111
254 = 11111110
252 = 11111100
248 = 11111000
240 = 11110000
224 = 11100000
192 = 11000000
128 = 10000000
0   = 00000000

So this is a valid mask:

255.255.255.0

But this is not a valid mask:

255.255.128.128

because after the mask starts using 0 bits, it cannot go back to 1 bits.


IPv4 Addresses

An IP address identifies an interface inside a network.

In NetPractice, we do not configure devices directly. We configure their interfaces.

Example:

interface A1
IP:   192.168.1.2
Mask: 255.255.255.0

This means interface A1 belongs to the network:

192.168.1.0/24

Two devices can communicate directly only if they are in the same network, or if there is a router between their networks.


Special IP Ranges

Some IP ranges are reserved for private networks.

These private ranges are:

10.0.0.0      - 10.255.255.255
172.16.0.0    - 172.31.255.255
192.168.0.0   - 192.168.255.255

The loopback range is:

127.0.0.0 - 127.255.255.255

For NetPractice, the most important thing is not whether an IP is public or private. The most important thing is whether the IP belongs to the correct subnet.


Masks

A subnet mask decides which IP addresses are part of the same network.

There are two common ways to write a subnet mask:

Dot-decimal notation: 255.255.255.0
CIDR notation:        /24

Example:

192.168.1.10/24

means:

IP:   192.168.1.10
Mask: 255.255.255.0

The first address in a subnet is the network address.

The last address in a subnet is the broadcast address.

Both cannot be assigned to devices.


Subnet Cheat Sheet

CIDR Dot-decimal Mask Total IPs Usable IPs
/32 255.255.255.255 1 0
/31 255.255.255.254 2 0
/30 255.255.255.252 4 2
/29 255.255.255.248 8 6
/28 255.255.255.240 16 14
/27 255.255.255.224 32 30
/26 255.255.255.192 64 62
/25 255.255.255.128 128 126
/24 255.255.255.0 256 254
/16 255.255.0.0 65536 65534

Example with /30:

Network:   190.3.2.252
Usable:    190.3.2.253
Usable:    190.3.2.254
Broadcast: 190.3.2.255

Only the usable IP addresses can be assigned to interfaces.


Switches

A switch connects multiple devices inside the same network.

A switch does not separate networks.

If several devices are connected to the same switch, they usually need to be in the same subnet.

Example:

Host A
Host B
Router interface

If all of them are connected to the same switch, they should share the same network.


Routers

A router connects different networks.

A router can have multiple interfaces, and each interface usually belongs to a different subnet.

Example:

R1 interface 1 -> Network A
R1 interface 2 -> Network B

The router can forward packets between these networks only if the routes are correct.

A router does not magically know every network. It only knows:

  1. Networks directly connected to its own interfaces.
  2. Networks manually added in its routing table.

Routing Tables

A routing table tells a host or router where to send packets.

In NetPractice, a route has two parts:

Destination => Next hop

Example:

192.168.2.0/24 => 192.168.1.1

Meaning:

To reach 192.168.2.0/24, send the packet to 192.168.1.1.

The left side is the destination network.

The right side is the next hop or gateway.

Important rule:

The gateway must be directly reachable.

That means the gateway must be in the same subnet as one of the sender's interfaces.


Default Route

A default route is used when no more specific route matches.

It can be written as:

default

or:

0.0.0.0/0

Both mean:

Any destination.

Example:

0.0.0.0/0 => 192.168.1.1

This means:

Send all unknown traffic to 192.168.1.1.

Network Logic

To know whether two devices are part of the same network, combine the IP address with the subnet mask.

This is done using a bit-by-bit AND operation.

Example:

IP:   192.168.100.1
Mask: 255.255.255.0

Binary:

IP:   11000000.10101000.01100100.00000001
Mask: 11111111.11111111.11111111.00000000

Result:

11000000.10101000.01100100.00000000

In dot-decimal:

192.168.100.0

So the network is:

192.168.100.0/24

If two devices have the same network address, they are in the same network.

If they are not in the same network, they need a router to communicate.


How I Approach NetPractice

My solving process:

  1. Read the goal.
  2. Identify which hosts need to communicate.
  3. Split the topology into separate networks.
  4. Check all directly connected interfaces.
  5. Make sure devices on the same link are in the same subnet.
  6. Avoid network and broadcast addresses.
  7. Set host gateways to the nearest router.
  8. Add routes on routers for remote networks.
  9. Add reverse routes when the Internet is involved.
  10. Read the logs and fix the first real error.

The most important rule:

Do not solve the whole diagram at once.
Split it into small networks first.

Common Errors

Error Meaning Fix
invalid IP address The IP is a network or broadcast address Choose a usable IP
no route A route is missing Add a route to the destination network
invalid route The gateway is not reachable Use a gateway in the same subnet
loop detected Traffic is being sent back and forth Fix wrong default routes
wrong host The IP exists on the wrong device Check duplicate IPs or overlapping subnets
no reverse way Forward path works but return path is missing Add the return route
route match but no interface for gateway The gateway is not directly reachable Use the correct next hop

Levels

Here are the solutions and explanations for all 10 levels.


Level 1

show
Level 1

Goal

This level has two separate communication goals:

A <--> B
C <--> D

There are no routers and no switches.

Each pair of hosts is directly connected.


Network Topology

The topology can be simplified like this:

A <--> B

C <--> D

So we have two independent small networks:

Network 1: A + B
Network 2: C + D

Network Analysis

For the first connection:

A1 = 104.95.23.11
B1 = 104.95.23.12
Mask = 255.255.255.0

This mask is /24.

So both interfaces are inside:

104.95.23.0/24

That means A and B can communicate directly.


For the second connection:

C1 = 211.191.135.75
D1 = 211.191.135.74
Mask = 255.255.0.0

This mask is /16.

So both interfaces are inside:

211.191.0.0/16

That means C and D can also communicate directly.


Why No Gateway Is Needed

A gateway is only needed when a device wants to reach another network through a router.

In this level:

A and B are directly connected.
C and D are directly connected.

There is no router.

So no gateway is needed.


Final Result

Both goals work:

A -> B : OK
C -> D : OK

And the reverse paths also work:

B -> A : OK
D -> C : OK

Key Takeaway

When two hosts are directly connected, both interfaces must belong to the same subnet.

If they are in the same subnet, they can communicate directly without a gateway.


Solution File

solution/level1.json

back to contents


Level 2

show
Level 2

Goal

This level has two separate communication goals:

B <--> A
D <--> C

There are still no routers and no switches.

Each pair of hosts is directly connected.


Network Topology

The topology can be simplified like this:

B <--> A

D <--> C

So we have two independent networks:

Network 1: A + B
Network 2: C + D

Network Analysis

For the first connection:

A1 = 192.168.99.221
B1 = 192.168.99.222
Mask = 255.255.255.224

The mask 255.255.255.224 is /27.

A /27 subnet increases by blocks of 32 in the last octet:

0, 32, 64, 96, 128, 160, 192, 224

The IP addresses 192.168.99.221 and 192.168.99.222 are inside this subnet:

Network:   192.168.99.192/27
Usable:    192.168.99.193 - 192.168.99.222
Broadcast: 192.168.99.223

So both A1 and B1 are valid usable IP addresses in the same subnet.

That is why A and B can communicate directly.


For the second connection:

C1 = 12.0.0.1
D1 = 12.0.0.2
Mask = 255.255.255.252

The mask 255.255.255.252 is /30.

A /30 subnet has 4 total addresses:

Network address
2 usable host addresses
Broadcast address

For this network:

Network:   12.0.0.0/30
Usable:    12.0.0.1
Usable:    12.0.0.2
Broadcast: 12.0.0.3

So C1 and D1 are exactly the two usable IP addresses.

That is why C and D can communicate directly.


Why No Gateway Is Needed

Both goals are between directly connected hosts.

There is no router in this level.

So the devices only need correct IP addresses and masks.

No default gateway is required.


Understanding the Main Idea

This level is mainly about choosing a valid subnet mask.

The IP address alone is not enough.

You must always check:

IP + Mask

because the mask decides the real network range.


Final Result

Both goals work:

B -> A : OK
D -> C : OK

And the reverse paths also work:

A -> B : OK
C -> D : OK

Key Takeaway

Directly connected devices must be in the same subnet.

Also, the IP addresses must not be the network address or the broadcast address.

In this level:

192.168.99.221 and 192.168.99.222 are valid inside 192.168.99.192/27
12.0.0.1 and 12.0.0.2 are valid inside 12.0.0.0/30

Solution File

solution/level2.json

back to contents


Level 3

show
Level 3

Goal

This level has three communication goals:

A <--> B
A <--> C
B <--> C

All three hosts are connected to the same switch.


Network Topology

The topology can be simplified like this:

        Switch S
       /   |   \
      A    B    C

There is no router in this level.

That means all connected hosts must be part of the same local network.


Network Analysis

The switch connects all hosts inside the same network.

A switch does not separate networks. It only forwards traffic between devices connected to it.

So the important rule here is:

A, B, and C must be in the same subnet.

From the successful log, the hosts communicate using these IP addresses:

A = 104.198.223.125
B = 104.198.223.123
C = 104.198.223.124

All of them are inside the same IP range:

104.198.223.x

So they can communicate directly through the switch.


Why No Gateway Is Needed

There is no router in this level.

Since all hosts are in the same subnet, packets do not need to leave the local network.

So no default gateway is required.

The hosts can send packets directly to each other through the switch.


Understanding the Log

Example from Goal 1:

Forward way: A -> B
on A: packet accepted
on A: send to A1
on switch S: pass to all connections
on B: packet accepted
on B: destination IP reached

This means:

  1. Host A accepted the packet.
  2. A sent the packet through interface A1.
  3. The switch forwarded the packet to connected devices.
  4. Host B received the packet.
  5. The destination was reached successfully.

Why packet not for me Appears

In the log, we also see:

on C: packet not for me

This is normal.

Because the switch forwards traffic to connected devices, another host may see the packet but ignore it if the destination IP is not its own IP.

So when A sends a packet to B, host C may receive the packet but rejects it because it is not the destination.


Why loop detected Appears

The log also shows:

on A: loop detected

or:

on B: loop detected

In this level, this is not the main problem because the final result is successful.

The important line is:

destination IP reached

The switch tests all connected links, including the sender itself. When the packet is seen again by the original sender, NetPractice marks it as a loop in the log.

As long as the destination is reached and the status is OK, this is not an issue for this level.


Final Result

All communication goals work:

A -> B : OK
A -> C : OK
B -> C : OK

And the reverse paths also work:

B -> A : OK
C -> A : OK
C -> B : OK

Key Takeaway

When multiple hosts are connected to the same switch:

They must belong to the same subnet.

A switch does not route traffic between networks.

If the hosts are in different subnets, a router would be needed.


Best Practice

For a switch network, count how many usable IP addresses are needed.

In this level, there are three hosts:

A
B
C

So the subnet must provide at least three usable IP addresses.

A /30 would not be enough because it gives only two usable IP addresses.

A /29 or larger subnet would work because /29 gives six usable IP addresses.


Solution File

solution/level3.json

back to contents


Level 4

show
Level 4

Goal

This level has three communication goals:

A <--> B
A <--> R
B <--> R

Hosts A and B are connected to the same switch as router R.


Network Topology

The topology can be simplified like this:

        Switch S
       /   |   \
      A    B    R

There is one switch and one router interface connected to that switch.

Even though a router exists in the level, the communication goals are still inside the same local network.


Network Analysis

A switch connects devices inside the same network.

In this level, the devices connected to the switch are:

A
B
R

So the interfaces of these devices must belong to the same subnet.

From the successful log, the important IP addresses are:

A = 90.242.111.132
B = 90.242.111.131
R = 90.242.111.130

All of them are in the same IP range:

90.242.111.x

So they can communicate through the switch.


Router Role in This Level

The router R is present, but it is not used to route traffic between different networks in this level.

Here, R behaves like another device connected to the same switch.

That means A, B, and R must all be in the same subnet.

No extra routing table configuration is needed for these goals.


Understanding the Log

Example from Goal 2:

Forward way: A -> R
on A: packet accepted
on A: send to A1
on switch S: pass to all connections
on R: packet accepted
on R: destination IP reached

This means:

  1. Host A accepted the packet.
  2. A sent the packet through interface A1.
  3. The switch forwarded the packet.
  4. Router R received the packet.
  5. The destination was reached successfully.

Why packet not for me Appears

The log contains lines like:

on R: packet not for me

or:

on A: packet not for me

This happens because the switch forwards traffic to connected links.

If a device receives a packet that is not addressed to its own IP, it ignores it.

This is normal in this level.


Why loop detected Appears

The log also contains:

loop detected

In this level, the final result is still correct because the destination is reached.

The switch tests multiple links, including the link back toward the sender.

As long as NetPractice shows OK and the destination is reached, this message is not the main issue here.


Final Result

All goals work:

A -> B : OK
A -> R : OK
B -> R : OK

The reverse paths also work:

B -> A : OK
R -> A : OK
R -> B : OK

Key Takeaway

A router interface connected to a switch must be in the same subnet as the other devices on that switch.

The router only becomes useful for routing when traffic needs to leave this local network.


Best Practice

When a switch connects multiple devices, count how many usable IP addresses are needed.

In this level, the switch connects three interfaces:

A1
B1
R1

So the subnet must provide at least three usable IP addresses.

A /30 is not enough because it provides only two usable IP addresses.

A /29 or larger subnet would be enough.


Solution File

solution/level4.json

back to contents


Level 5

show
Level 5

Goal

This level has three communication goals:

A <--> R
B <--> R
A <--> B

There is one router between two different host networks.


Network Topology

The topology can be simplified like this:

A <--> R <--> B

Router R has two interfaces:

R1 connected to A
R2 connected to B

This means there are two separate networks:

Network 1: A + R1
Network 2: B + R2

Network Analysis

Host A and router interface R1 are directly connected.

From the log:

A = 57.202.124.125
R1 = 57.202.124.126

So A and R1 must be in the same subnet.

Host B and router interface R2 are also directly connected.

From the log:

B  = 135.233.22.253
R2 = 135.233.22.254

So B and R2 must be in the same subnet.


Why Gateways Are Needed

For Goal 1:

A -> R

A can reach R directly through R1.

For Goal 2:

B -> R

B can reach R directly through R2.

But for Goal 3:

A -> B

A and B are not in the same network.

So A must send the packet to its gateway, which is router R.

The same applies in the reverse direction:

B -> A

B must send the packet to router R.


Understanding the Log

From Goal 3:

Forward way: A -> B
on A: destination does not match any interface
on A: route match 0.0.0.0/0
on A: send to gateway 57.202.124.126 through interface A1
on R: packet accepted
on R: send to R2
on B: destination IP reached

This shows the correct path:

A -> R -> B

A does not know B directly, so it sends the packet to its gateway:

57.202.124.126

That gateway is router interface R1.

Then the router forwards the packet through R2 to B.


Reverse Path

The reverse path is also correct:

B -> R -> A

From the log:

on B: route match default
on B: send to gateway 135.233.22.254 through interface B1
on R: packet accepted
on R: send to R1
on A: destination IP reached

B sends traffic to its gateway:

135.233.22.254

That gateway is router interface R2.

The router then forwards the packet back through R1 to A.


Final Result

All goals work:

A -> R : OK
B -> R : OK
A -> B : OK

And the reverse paths also work:

R -> A : OK
R -> B : OK
B -> A : OK

Key Takeaway

When two hosts are in different networks, they need a router between them.

Each host should use the router interface connected to its own network as its gateway.


Best Practice

For two-device links, use the smallest subnet that fits two usable IP addresses.

A /30 is usually enough for:

A <--> R
B <--> R

because /30 gives exactly two usable IP addresses.


Solution File

solution/level5.json

back to contents


Level 6

show
Level 6

Goal

This level has one main goal:

A <--> Internet

Host A must reach the Internet, and the Internet must be able to send traffic back to A.


Topology

The topology can be simplified like this:

A --- Switch S --- R --- Internet

The network is split into two main parts:

A + R
R + Internet

Main Idea

A is not directly connected to the Internet.

So A sends Internet traffic to router R.

Then R forwards the packet to the Internet.

The forward path is:

A -> R -> Internet

The reverse path must also work:

Internet -> R -> A

Important Routes

Host A sends traffic to its gateway:

28.219.87.228

Router R sends Internet traffic to:

163.172.250.1

The Internet sends replies back through:

163.172.250.12

Packet Paths

Forward path:

A -> R -> Internet

Reverse path:

Internet -> R -> A

Key Takeaway

Internet communication needs two directions.

The host needs a default route to the router.

The Internet also needs a reverse route back to the internal network.

Forward routing alone is not enough.


Best Practice

For Internet levels, check this order:

1. Host gateway
2. Router route to Internet
3. Internet reverse route
4. Gateway reachability

Most failures happen because the reverse route is missing or points to the wrong gateway.


Solution File

solution/level6.json

back to contents


Level 7

show
Level 7

Goal

This level has one main goal:

A <--> C

Host A must communicate with host C through two routers.


Topology

The topology can be simplified like this:

A <--> R1 <--> R2 <--> C

The network is split into three parts:

A + R1
R1 + R2
R2 + C

Main Idea

A and C are not directly connected.

So the packet must pass through both routers:

A -> R1 -> R2 -> C

The return path must also work:

C -> R2 -> R1 -> A

This level is mainly about making sure each device sends traffic to the correct next hop.


Important Routes

Host A sends traffic to R1:

107.198.14.1

R1 sends traffic to R2:

107.198.14.253

Host C sends traffic back to R2:

107.198.14.5

R2 sends traffic back to R1:

107.198.14.254

Packet Paths

Forward path:

A -> R1 -> R2 -> C

Reverse path:

C -> R2 -> R1 -> A

Key Takeaway

When traffic crosses multiple routers, every router must know the next hop toward the destination.

The forward path and the reverse path must both be valid.


Best Practice

For this type of topology, solve in this order:

1. Configure the A-to-R1 network.
2. Configure the R1-to-R2 network.
3. Configure the R2-to-C network.
4. Add the forward route from A toward C.
5. Add the reverse route from C back toward A.

Do not guess routes randomly.

Split the topology into small networks first.


Solution File

solution/level7.json

back to contents


Level 8

show
Level 8

Goal

This level has three goals:

C <--> D
C <--> Internet
D <--> Internet

Hosts C and D must communicate with each other, and both hosts must also reach the Internet.


Topology

The topology can be simplified like this:

C ----\
       R2 ---- R1 ---- Internet
D ----/

The network is split into four main parts:

C + R2
D + R2
R2 + R1
R1 + Internet

Main Idea

C and D are not directly connected to the Internet.

They both use R2 as their gateway.

Then R2 forwards traffic to R1.

Finally, R1 forwards traffic to the Internet.

The main path is:

C/D -> R2 -> R1 -> Internet

For the return traffic, the Internet must know how to reach the internal network.

So the reverse path is:

Internet -> R1 -> R2 -> C/D

Important Routes

Host C sends traffic to:

128.24.243.1

Host D sends traffic to:

128.24.243.25

Router R2 sends Internet traffic to R1:

128.24.243.62

Router R1 sends Internet traffic to:

163.225.250.1

The Internet sends replies back through:

163.225.250.12

Packet Paths

Internal communication:

C -> R2 -> D
D -> R2 -> C

Internet communication:

C -> R2 -> R1 -> Internet
D -> R2 -> R1 -> Internet

Reverse Internet communication:

Internet -> R1 -> R2 -> C
Internet -> R1 -> R2 -> D

Key Takeaway

This level is about complete routing.

Forward routing alone is not enough.

The reverse path must also work, especially when the Internet is involved.


Solution File

solution/level8.json

back to contents


Level 9

show
Level 9

Goal

This level has six goals:

A <--> B
C <--> D
A <--> Internet
A <--> D
B <--> C
C <--> Internet

It combines switch communication, multiple routers, host gateways, Internet routing, and reverse paths.


Topology

The topology can be simplified like this:

A ----\
       Switch S ---- R1 ---- Internet
B ----/              |
                     |
                    R2
                   /  \
                  C    D

The network is split into five main parts:

A + B + R1
R1 + Internet
R1 + R2
C + R2
D + R2

Main Idea

A and B are in the same switch network, so they can communicate directly.

C and D are behind R2, so they use R2 as their gateway.

For traffic between the upper network and the lower networks, packets must pass through:

R1 -> R2

For Internet traffic, packets go through:

Internal host -> Router -> Internet

and the Internet must also have a valid route back to the internal networks.


Important Routes

Hosts A and B use R1 as their gateway:

12.168.63.1

Host C uses R2 as its gateway:

1.0.0.2

Host D uses R2 as its gateway:

18.124.23.219

R1 sends traffic to the networks behind R2 through:

163.172.250.253

R2 sends traffic back toward R1 through:

163.172.250.254

The Internet sends replies back through:

163.172.250.12

Packet Paths

Local switch communication:

A -> Switch -> B
B -> Switch -> A

Internal communication behind R2:

C -> R2 -> D
D -> R2 -> C

Communication between upper and lower networks:

A/B -> R1 -> R2 -> C/D
C/D -> R2 -> R1 -> A/B

Internet communication:

A -> R1 -> Internet
C -> R2 -> R1 -> Internet

Reverse Internet communication:

Internet -> R1 -> A
Internet -> R1 -> R2 -> C

Key Takeaway

This level is about connecting multiple smaller networks together.

The switch keeps A, B, and R1 in the same local network.

The routers connect the different networks.

The Internet route must also support the reverse path, not only the forward path.


Best Practice

Solve this level in this order:

1. Make A and B communicate through the switch.
2. Make C and D communicate through R2.
3. Connect R1 and R2.
4. Add routes between the upper and lower networks.
5. Add Internet routes.
6. Verify the reverse paths.

Do not start with the Internet.

Start with local networks first, then connect them together.


Solution File

solution/level9.json

back to contents


Level 10

show
Level 10

Goal

This is the final NetPractice level.

It has seven goals:

H1 <--> H2
H3 <--> H4
H1 <--> Internet
H1 <--> H4
H2 <--> H3
H3 <--> Internet
H4 <--> Internet

This level combines switch networks, multiple routers, host gateways, Internet routing, and reverse paths.


Topology

The topology can be simplified like this:

H1 ----\
        Switch S1 ---- R1 ---- Internet
H2 ----/               |
                       |
                      R2
                    /    \
                  H3      H4

The network is split into five main parts:

H1 + H2 + R1
R1 + Internet
R1 + R2
H3 + R2
H4 + R2

Main Idea

H1 and H2 are in the same switch network, so they can communicate directly.

H3 and H4 are behind R2, so they use R2 as their gateway.

Traffic between the upper switch network and the lower hosts must pass through:

R1 -> R2

Internet traffic from the lower hosts must pass through:

H3/H4 -> R2 -> R1 -> Internet

For the return traffic, the Internet sends packets back to R1, then R1 forwards them either to the switch network or to R2.


Important Routes

H1 and H2 use R1 as their gateway:

162.74.222.1

H3 uses R2 as its gateway:

162.74.222.250

H4 uses R2 as its gateway:

162.74.222.129

R1 sends traffic to the networks behind R2 through:

162.74.222.253

R2 sends traffic back toward R1 through:

162.74.222.254

The Internet sends replies back through:

163.172.250.12

Packet Paths

Local switch communication:

H1 -> Switch S1 -> H2
H2 -> Switch S1 -> H1

Internal communication behind R2:

H3 -> R2 -> H4
H4 -> R2 -> H3

Communication between upper and lower networks:

H1/H2 -> R1 -> R2 -> H3/H4
H3/H4 -> R2 -> R1 -> H1/H2

Internet communication:

H1 -> R1 -> Internet
H3/H4 -> R2 -> R1 -> Internet

Reverse Internet communication:

Internet -> R1 -> H1/H2
Internet -> R1 -> R2 -> H3/H4

Key Takeaway

Level 10 does not introduce one new idea.

It combines all previous ideas:

Switch = same local network
Router = separates networks
Gateway = next hop
Routing table = path to remote networks
Internet route = needs reverse path

The correct method is to solve local networks first, router links second, and Internet routes last.


Best Practice

For the final level, use this order:

1. Check H1 and H2 on the switch network.
2. Check H3 and H4 behind R2.
3. Check the R1-to-R2 link.
4. Add routes between upper and lower networks.
5. Add Internet routes.
6. Verify reverse paths.

Do not randomly change routes.

A single wrong default route can create a loop and break multiple goals.


Solution File

solution/level10.json

back to contents


42 Note

This repository is for learning, review, and documentation.

If you are a 42 student working on NetPractice, try to solve each level by yourself first.

Do not copy the configurations blindly.

The real goal of NetPractice is to understand how IP addressing, subnetting, gateways, and routing tables work.


Status

Completed.


Author

Mohammad Alhindi

About

Solutions and notes for 42 NetPractice networking exercises, covering IP addressing, subnet masks, routing tables, gateways, and troubleshooting.

Topics

Resources

License

Stars

5 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors