Course: ITS352 / DES352 — Networking Laboratory Institution: School of ICT, Sirindhorn International Institute of Technology (SIIT) Student: Nonprawich Intakaew — 6622772422
Instructions
- Attendance is checked at the beginning of the lab
- Login: username
student, passwordSiit@1992 - Show Lab Sheet to TA after finishing each assignment → get signature
- 10-minute quiz near the end of the lab
- Submit the last page to TA at the end of class
Overview: General Procedure for Building an Internetwork
- Draw a logical network diagram
- Identify all necessary IP addresses: network address, first valid host, last valid host, and broadcast address
- Draw a physical network diagram — specify IP addresses & NICs, then connect computers
- Set up IP addresses on NICs and routing tables of each computer/router
- Verify connectivity using the
pingcommand
Think of this like setting up a postal system: each network is a neighbourhood, routers are post offices that forward letters between neighbourhoods, and routing tables are the address books that tell each post office where to send packets next.
Linux Commands Reference
| Linux Command | Explanation |
|---|---|
sudo ifconfig eth1 192.168.10.1/24 | Set IP address 192.168.10.1 to NIC eth1 with subnet mask /24 (255.255.255.0) |
sudo route add default gw 192.168.10.1 | Add default gateway 192.168.10.1 to the routing table |
sudo route add -net 192.168.30.0/24 gw 192.168.20.2 | Add a static route: packets to 192.168.30.0/24 go via gateway 192.168.20.2 |
sudo route del default | Delete the default gateway from the routing table |
sudo route del -net 192.168.30.0/24 | Delete the static route to 192.168.30.0/24 |
sudo sysctl -w net.ipv4.ip_forward=1 | Enable IP forwarding (required on routers) |
route -n | Display the routing table (without hostnames) |
sudo iptables -P FORWARD ACCEPT | Allow the firewall to forward packets (required on routers) |
sudo ifconfig eth0 down | Disable NIC eth0 |
Analogy:
ip_forward=1is like telling a post office "yes, you ARE allowed to forward mail that isn't addressed to you" — without this, a Linux machine silently drops packets not meant for it.
Assignment 1: Internetwork of Three Networks
Setup
- Group of 4 students, 4 computers, connecting 3 networks
- Two routers: R1 and R2
- Computers: A (in Network A) and B (in Network C)
Step 1 – Logical Network Diagram
(Image — see original lab sheet)
Key addresses from the diagram:
- R1 has:
eth1→192.168.10.1/24(connects to Network A)eth2→192.168.20.1/24(connects to Network B)
- R2 has:
eth1→192.168.30.1/24(connects to Network C)eth2→192.168.20.2/24(connects to Network B)
- Computer A:
eth1→192.168.10.8/24 - Computer B:
eth1→192.168.30.8/24
Step 2 – IP Address Table
Network A — 192.168.10.0/24
| Network Address | Subnet Mask | First Valid Host | Last Valid Host |
|---|---|---|---|
192.168.10.0/24 | 255.255.255.0 | 192.168.10.1 | 192.168.10.254 |
Network B — 192.168.20.0/24
| Network Address | Subnet Mask | First Valid Host | Last Valid Host |
|---|---|---|---|
192.168.20.0/24 | 255.255.255.0 | 192.168.20.1 | 192.168.20.254 |
Network C — 192.168.30.0/24
| Network Address | Subnet Mask | First Valid Host | Last Valid Host |
|---|---|---|---|
192.168.30.0/24 | 255.255.255.0 | 192.168.30.1 | 192.168.30.254 |
For /24 networks: usable host addresses
Step 3 – Physical Network Diagram
Physical layout (4 computers):
A ──── R1 ──── R2 ──── B
(Network B between R1 and R2)
| Machine | NIC | IP Address |
|---|---|---|
| Computer A | eth1 | 192.168.10.8/24 |
| Router R1 | eth1 | 192.168.10.1/24 |
| Router R1 | eth2 | 192.168.20.1/24 |
| Router R2 | eth1 | 192.168.30.1/24 |
| Router R2 | eth2 | 192.168.20.2/24 |
| Computer B | eth1 | 192.168.30.8/24 |
- Turn off
eth0on all machines:sudo ifconfig eth0 down
Step 4 – Setup Commands
a) Computer A
Routing table goal:
| Destination | Gateway | Genmask | Flags | Iface |
|---|---|---|---|---|
0.0.0.0 | 192.168.10.1 | 0.0.0.0 | UG | eth1 |
192.168.10.0 | 0.0.0.0 | 255.255.255.0 | U | eth1 |
Commands:
sudo ifconfig eth0 down
sudo ifconfig eth1 192.168.10.8/24
sudo route add default gw 192.168.10.1
route -n- The second line (local network) is added automatically when you set the IP
- The first line (default gateway) must be added manually — points to R1
Analogy: Computer A only knows its own street (192.168.10.x). For anything else, it hands the packet to R1 (its "post office") and trusts R1 to figure out the rest.
b) Router R1
Routing table goal:
| Destination | Gateway | Genmask | Flags | Iface |
|---|---|---|---|---|
192.168.10.0 | 0.0.0.0 | 255.255.255.0 | U | eth1 |
192.168.20.0 | 0.0.0.0 | 255.255.255.0 | U | eth2 |
192.168.30.0 | 192.168.20.2 | 255.255.255.0 | UG | eth2 |
Commands:
sudo ifconfig eth0 down
sudo ifconfig eth1 192.168.10.1/24
sudo ifconfig eth2 192.168.20.1/24
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -P FORWARD ACCEPT
sudo route add -net 192.168.30.0/24 gw 192.168.20.2
route -n- Lines 1 & 2 (directly connected networks) are added automatically
- Line 3 (route to Network C via R2) must be added manually
- IP forwarding must be explicitly enabled
c) Computer B
Routing table goal:
| Destination | Gateway | Genmask | Flags | Iface |
|---|---|---|---|---|
0.0.0.0 | 192.168.30.1 | 0.0.0.0 | UG | eth0 |
192.168.30.0 | 0.0.0.0 | 255.255.255.0 | U | eth0 |
Commands:
sudo ifconfig eth0 down
sudo ifconfig eth1 192.168.30.8/24
sudo route add default gw 192.168.30.1
route -nTA Signature required after showing routing table
d) Router R2
Routing table goal:
| Destination | Gateway | Genmask | Flags | Iface |
|---|---|---|---|---|
192.168.10.0 | 192.168.20.1 | 255.255.255.0 | UG | eth0 |
192.168.20.0 | 0.0.0.0 | 255.255.255.0 | U | eth0 |
192.168.30.0 | 0.0.0.0 | 255.255.255.0 | U | eth1 |
Commands:
sudo ifconfig eth0 down
sudo ifconfig eth1 192.168.30.1/24
sudo ifconfig eth2 192.168.20.2/24
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -P FORWARD ACCEPT
sudo route add -net 192.168.10.0/24 gw 192.168.20.1
route -nTA Signature required after showing routing table
Step 5 – Verify Connectivity
ping 192.168.30.8 # from Computer A to Computer BTA Signature required after demonstrating successful ping
Assignment 2: Internetwork of Seven Networks
Setup
- Group of 8 students, 8 computers, connecting 7 networks
- Four routers: R1, R2, R3, R4
- Computers: A, B (at R1 side), F, G (at R4 side)
Step 1 – Logical Network Diagram
(Image — see original lab sheet)
Topology overview:
A ── R1 ── R2 ── R3 ── R4 ── G
| | |
B D E
|
R4──F
Networks:
- A:
172.16.101.200/29 - B:
192.168.216.12/30 - C:
192.168.66.0/24(between R1 and R2) - D:
192.168.88.0/24(between R2 and R3) - E:
68.66.11.80/29(between R3 and R4) - F:
211.60.36.16/28 - G:
16.18.11.64/29
Step 2 – IP Address Tables
Network A — 172.16.101.200/29
| Network Address | Subnet Mask | First Valid Host | Last Valid Host |
|---|---|---|---|
172.16.101.200 | 255.255.255.248 | 172.16.101.201 | 172.16.101.206 |
/29 gives usable hosts
Network B — 192.168.216.12/30
| Network Address | Subnet Mask | First Valid Host | Last Valid Host |
|---|---|---|---|
192.168.216.12 | 255.255.255.252 | 192.168.216.13 | 192.168.216.14 |
/30 gives usable hosts — typical for point-to-point links!
Network C — 192.168.66.0/24
| Network Address | Subnet Mask | First Valid Host | Last Valid Host |
|---|---|---|---|
192.168.66.0 | 255.255.255.0 | 192.168.66.1 | 192.168.66.254 |
Network D — 192.168.88.0/24
| Network Address | Subnet Mask | First Valid Host | Last Valid Host |
|---|---|---|---|
192.168.88.0 | 255.255.255.0 | 192.168.88.1 | 192.168.88.254 |
Network E — 68.66.11.80/29
| Network Address | Subnet Mask | First Valid Host | Last Valid Host |
|---|---|---|---|
68.66.11.80 | 255.255.255.248 | 68.66.11.81 | 68.66.11.86 |
Network F — 211.60.36.16/28
| Network Address | Subnet Mask | First Valid Host | Last Valid Host |
|---|---|---|---|
211.60.36.16 | 255.255.255.240 | 211.60.36.17 | 211.60.36.30 |
/28 gives usable hosts
Network G — 16.18.11.64/29
| Network Address | Subnet Mask | First Valid Host | Last Valid Host |
|---|---|---|---|
16.18.11.64 | 255.255.255.248 | 16.18.11.65 | 16.18.11.70 |
Step 3 – Physical Network Diagram
(Draw IP addresses and NICs on the blank diagram — see original lab sheet)
Some routers require all three NICs (eth0, eth1, eth2).
Step 4 – Routing Tables
Routing Strategy (Hint from Lab Sheet)
Router R1 — has direct access to Networks A, B, C:
| Network | Gateway |
|---|---|
| A | — (direct) |
| B | — (direct) |
| C | — (direct) |
| D | R2 (IP connecting to R1) |
| E | R2 (IP connecting to R1) |
| F | R2 (IP connecting to R1) |
| G | R2 (IP connecting to R1) |
Router R2 — has direct access to Networks C, D:
| Network | Gateway |
|---|---|
| A | R1 (IP connecting to R2) |
| B | R1 (IP connecting to R2) |
| C | — (direct) |
| D | — (direct) |
| E | R3 (IP connecting to R2) |
| F | R3 (IP connecting to R2) |
| G | R3 (IP connecting to R2) |
Analogy: R2 is like a central sorting hub — it knows to send westbound mail to R1 and eastbound mail to R3.
a) Routing Table: Computer A
| Destination | Gateway | Genmask | Flags | Iface |
|---|---|---|---|---|
0.0.0.0 | 172.16.101.202 | 0.0.0.0 | UG | eth0 |
172.16.101.200 | 0.0.0.0 | 255.255.255.248 | U | eth0 |
b) Routing Table: Computer B
| Destination | Gateway | Genmask | Flags | Iface |
|---|---|---|---|---|
0.0.0.0 | 192.168.216.13 | 0.0.0.0 | UG | eth0 |
192.168.216.12 | 0.0.0.0 | 255.255.255.252 | U | eth0 |
(Note: Computer B uses /30 — only 2 hosts, point-to-point to R1)
c) Routing Table: Computer F
From lab screenshot:
| Destination | Gateway | Genmask | Flags | Iface |
|---|---|---|---|---|
0.0.0.0 | 211.60.36.17 | 0.0.0.0 | UG | eth0 |
211.60.36.16 | 0.0.0.0 | 255.255.255.240 | U | eth0 |
d) Routing Table: Computer G
From lab screenshot:
| Destination | Gateway | Genmask | Flags | Iface |
|---|---|---|---|---|
0.0.0.0 | 16.18.11.65 | 0.0.0.0 | UG | eth0 |
16.18.11.64 | 0.0.0.0 | 255.255.255.248 | U | eth0 |
e) Routing Table: Router R1
From lab screenshot:
| Destination | Gateway | Genmask | Flags | Iface |
|---|---|---|---|---|
0.0.0.0 | 192.168.66.2 | 0.0.0.0 | UG | eth2 |
16.18.11.64 | 192.168.66.2 | 255.255.255.248 | UG | eth2 |
68.66.11.80 | 192.168.66.2 | 255.255.255.248 | UG | eth2 |
172.16.101.200 | 0.0.0.0 | 255.255.255.248 | U | eth0 |
192.168.66.0 | 0.0.0.0 | 255.255.255.0 | U | eth2 |
192.168.88.0 | 192.168.66.2 | 255.255.255.0 | UG | eth2 |
192.168.216.12 | 0.0.0.0 | 255.255.255.252 | U | eth1 |
211.60.36.16 | 192.168.66.2 | 255.255.255.240 | UG | eth2 |
f) Routing Table: Router R2
From lab screenshot:
| Destination | Gateway | Genmask | Flags | Iface |
|---|---|---|---|---|
16.18.11.64 | 192.168.88.2 | 255.255.255.248 | UG | eth1 |
68.66.11.80 | 192.168.88.2 | 255.255.255.248 | UG | eth1 |
172.16.101.200 | 192.168.66.1 | 255.255.255.248 | UG | eth0 |
192.168.66.0 | 0.0.0.0 | 255.255.255.0 | U | eth0 |
192.168.88.0 | 0.0.0.0 | 255.255.255.0 | U | eth1 |
192.168.216.12 | 192.168.66.1 | 255.255.255.252 | UG | eth0 |
211.60.36.16 | 192.168.88.2 | 255.255.255.240 | UG | eth1 |
g) Routing Table: Router R3
From lab screenshot:
| Destination | Gateway | Genmask | Flags | Iface |
|---|---|---|---|---|
16.18.11.64 | 68.66.11.82 | 255.255.255.248 | UG | eth1 |
68.66.11.80 | 0.0.0.0 | 255.255.255.248 | U | eth1 |
172.16.101.200 | 192.168.88.1 | 255.255.255.248 | UG | eth0 |
192.168.66.0 | 192.168.88.1 | 255.255.255.0 | UG | eth0 |
192.168.88.0 | 0.0.0.0 | 255.255.255.0 | U | eth0 |
192.168.216.12 | 192.168.88.1 | 255.255.255.252 | UG | eth0 |
211.60.36.16 | 68.66.11.82 | 255.255.255.240 | UG | eth1 |
h) Routing Table: Router R4
From lab screenshot:
| Destination | Gateway | Genmask | Flags | Iface |
|---|---|---|---|---|
16.18.11.64 | 0.0.0.0 | 255.255.255.248 | U | eth2 |
68.66.11.80 | 0.0.0.0 | 255.255.255.248 | U | eth0 |
172.16.101.200 | 68.66.11.81 | 255.255.255.248 | UG | eth0 |
192.168.66.0 | 68.66.11.81 | 255.255.255.0 | UG | eth0 |
192.168.88.0 | 68.66.11.81 | 255.255.255.0 | UG | eth0 |
192.168.216.12 | 68.66.11.81 | 255.255.255.252 | UG | eth0 |
211.60.36.16 | 0.0.0.0 | 255.255.255.240 | U | eth1 |
Step 5 – Verify Connectivity
ping <Computer B IP> # from Computer A
ping <Computer F IP> # from Computer A
ping <Computer G IP> # from Computer BTA Signature required after demonstrating all three pings
Key Concepts Summary
Routing Table Flags
U— Route is Up (active)G— Route goes through a Gateway (router)UG— Active route through a gateway (most static routes look like this)H— Route to a specific Host (not a network)
Default Gateway vs Static Route
- Default gateway (
0.0.0.0 gw X.X.X.X): catch-all for any packet with no more-specific route — used on end hosts - Static route (
-net A.B.C.D/XX gw X.X.X.X): specific route to a network — used on routers
End hosts only need a default gateway. Routers need explicit routes to every network they can't directly reach.
Subnet Size Quick Reference
| CIDR | Subnet Mask | Usable Hosts |
|---|---|---|
| /24 | 255.255.255.0 | |
| /28 | 255.255.255.240 | |
| /29 | 255.255.255.248 | |
| /30 | 255.255.255.252 |
General formula:
IP Forwarding on Routers
A Linux machine by default does NOT forward packets. Two commands needed:
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -P FORWARD ACCEPT🧠 Quiz Prep — Likely Quiz Topics
Multiple Choice Style Questions
-
What command adds a default gateway
10.0.0.1to the routing table?- A)
sudo ifconfig gw 10.0.0.1 - B)
sudo route add default gw 10.0.0.1✅ - C)
sudo route add -net 0.0.0.0 gw 10.0.0.1 - D)
sudo sysctl gw=10.0.0.1
- A)
-
Which flag in
route -noutput indicates that packets go through a gateway?- A) U
- B) H
- C) G ✅
- D) R
-
How many usable host addresses are in a
/30subnet?- A) 30
- B) 6
- C) 4
- D) 2 ✅
-
Which command enables IP packet forwarding on a Linux router?
- A)
sudo iptables -P FORWARD ACCEPT - B)
sudo sysctl -w net.ipv4.ip_forward=1✅ - C)
sudo ifconfig forward=1 - D)
sudo route enable forward
- A)
-
In the routing table, what does destination
0.0.0.0with flagUGrepresent?- A) A loopback route
- B) A directly connected network
- C) The default gateway route ✅
- D) A host-specific route
-
When you run
sudo ifconfig eth1 192.168.10.1/24, what routing table entry is automatically created?- The local network entry:
192.168.10.0→ gateway0.0.0.0, genmask255.255.255.0, flagU
- The local network entry:
Short Answer Style Questions
-
Why must
ip_forwardbe enabled on a router but not on a regular host?- A regular host only needs to send/receive its own packets. A router must accept packets addressed to _other_hosts and forward them onward — this behaviour is disabled by default for security reasons.
-
What is the difference between a default gateway and a static route?
- A default gateway (
0.0.0.0/0) is a catch-all used by end hosts for any traffic destined outside the local network. A static route targets a specific network (-net X.X.X.X/YY) and is used on routers to direct traffic toward particular remote networks.
- A default gateway (
-
In Assignment 2, Router R1 routes traffic to Networks D, E, F, G all through the same gateway (R2). Why?
- Because R1 is not directly connected to those networks — R2 is the next hop that bridges R1 toward the right side of the topology. R1 sends all non-local traffic to R2, which then decides further routing.
-
What is the network address and broadcast address of
192.168.10.0/24?- Network:
192.168.10.0 - Broadcast:
- First host:
192.168.10.1, Last host:192.168.10.254
- Network:
-
What command would you use to add a route to
192.168.30.0/24through gateway192.168.20.2?sudo route add -net 192.168.30.0/24 gw 192.168.20.2 -
How do you verify routing table entries in Linux?
route -nThe
-nflag shows IP addresses numerically instead of resolving hostnames (faster and clearer).