Lab 7 - Internetworking II

Updated 4 Oct 2026

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, password Siit@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

  1. Draw a logical network diagram
  2. Identify all necessary IP addresses: network address, first valid host, last valid host, and broadcast address
  3. Draw a physical network diagram — specify IP addresses & NICs, then connect computers
  4. Set up IP addresses on NICs and routing tables of each computer/router
  5. Verify connectivity using the ping command

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 CommandExplanation
sudo ifconfig eth1 192.168.10.1/24Set 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.1Add default gateway 192.168.10.1 to the routing table
sudo route add -net 192.168.30.0/24 gw 192.168.20.2Add a static route: packets to 192.168.30.0/24 go via gateway 192.168.20.2
sudo route del defaultDelete the default gateway from the routing table
sudo route del -net 192.168.30.0/24Delete the static route to 192.168.30.0/24
sudo sysctl -w net.ipv4.ip_forward=1Enable IP forwarding (required on routers)
route -nDisplay the routing table (without hostnames)
sudo iptables -P FORWARD ACCEPTAllow the firewall to forward packets (required on routers)
sudo ifconfig eth0 downDisable NIC eth0

Analogy: ip_forward=1 is 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 AddressSubnet MaskFirst Valid HostLast Valid Host
192.168.10.0/24255.255.255.0192.168.10.1192.168.10.254

Network B — 192.168.20.0/24

Network AddressSubnet MaskFirst Valid HostLast Valid Host
192.168.20.0/24255.255.255.0192.168.20.1192.168.20.254

Network C — 192.168.30.0/24

Network AddressSubnet MaskFirst Valid HostLast Valid Host
192.168.30.0/24255.255.255.0192.168.30.1192.168.30.254

For /24 networks: 232−24−2=254\boxed{2^{32-24} - 2 = 254} usable host addresses

Step 3 – Physical Network Diagram

Physical layout (4 computers):

A ──── R1 ──── R2 ──── B
      (Network B between R1 and R2)
MachineNICIP Address
Computer Aeth1192.168.10.8/24
Router R1eth1192.168.10.1/24
Router R1eth2192.168.20.1/24
Router R2eth1192.168.30.1/24
Router R2eth2192.168.20.2/24
Computer Beth1192.168.30.8/24
  • Turn off eth0 on all machines: sudo ifconfig eth0 down

Step 4 – Setup Commands

a) Computer A

Routing table goal:

DestinationGatewayGenmaskFlagsIface
0.0.0.0192.168.10.10.0.0.0UGeth1
192.168.10.00.0.0.0255.255.255.0Ueth1

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:

DestinationGatewayGenmaskFlagsIface
192.168.10.00.0.0.0255.255.255.0Ueth1
192.168.20.00.0.0.0255.255.255.0Ueth2
192.168.30.0192.168.20.2255.255.255.0UGeth2

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:

DestinationGatewayGenmaskFlagsIface
0.0.0.0192.168.30.10.0.0.0UGeth0
192.168.30.00.0.0.0255.255.255.0Ueth0

Commands:

sudo ifconfig eth0 down
sudo ifconfig eth1 192.168.30.8/24
sudo route add default gw 192.168.30.1
route -n

TA Signature required after showing routing table

d) Router R2

Routing table goal:

DestinationGatewayGenmaskFlagsIface
192.168.10.0192.168.20.1255.255.255.0UGeth0
192.168.20.00.0.0.0255.255.255.0Ueth0
192.168.30.00.0.0.0255.255.255.0Ueth1

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 -n

TA Signature required after showing routing table

Step 5 – Verify Connectivity

ping 192.168.30.8   # from Computer A to Computer B

TA 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 AddressSubnet MaskFirst Valid HostLast Valid Host
172.16.101.200255.255.255.248172.16.101.201172.16.101.206

/29 gives 232−29−2=6\boxed{2^{32-29} - 2 = 6} usable hosts

Network B — 192.168.216.12/30

Network AddressSubnet MaskFirst Valid HostLast Valid Host
192.168.216.12255.255.255.252192.168.216.13192.168.216.14

/30 gives 232−30−2=2\boxed{2^{32-30} - 2 = 2} usable hosts — typical for point-to-point links!

Network C — 192.168.66.0/24

Network AddressSubnet MaskFirst Valid HostLast Valid Host
192.168.66.0255.255.255.0192.168.66.1192.168.66.254

Network D — 192.168.88.0/24

Network AddressSubnet MaskFirst Valid HostLast Valid Host
192.168.88.0255.255.255.0192.168.88.1192.168.88.254

Network E — 68.66.11.80/29

Network AddressSubnet MaskFirst Valid HostLast Valid Host
68.66.11.80255.255.255.24868.66.11.8168.66.11.86

Network F — 211.60.36.16/28

Network AddressSubnet MaskFirst Valid HostLast Valid Host
211.60.36.16255.255.255.240211.60.36.17211.60.36.30

/28 gives 232−28−2=14\boxed{2^{32-28} - 2 = 14} usable hosts

Network G — 16.18.11.64/29

Network AddressSubnet MaskFirst Valid HostLast Valid Host
16.18.11.64255.255.255.24816.18.11.6516.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:

NetworkGateway
A— (direct)
B— (direct)
C— (direct)
DR2 (IP connecting to R1)
ER2 (IP connecting to R1)
FR2 (IP connecting to R1)
GR2 (IP connecting to R1)

Router R2 — has direct access to Networks C, D:

NetworkGateway
AR1 (IP connecting to R2)
BR1 (IP connecting to R2)
C— (direct)
D— (direct)
ER3 (IP connecting to R2)
FR3 (IP connecting to R2)
GR3 (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

DestinationGatewayGenmaskFlagsIface
0.0.0.0172.16.101.2020.0.0.0UGeth0
172.16.101.2000.0.0.0255.255.255.248Ueth0

b) Routing Table: Computer B

DestinationGatewayGenmaskFlagsIface
0.0.0.0192.168.216.130.0.0.0UGeth0
192.168.216.120.0.0.0255.255.255.252Ueth0

(Note: Computer B uses /30 — only 2 hosts, point-to-point to R1)

c) Routing Table: Computer F

From lab screenshot:

DestinationGatewayGenmaskFlagsIface
0.0.0.0211.60.36.170.0.0.0UGeth0
211.60.36.160.0.0.0255.255.255.240Ueth0

d) Routing Table: Computer G

From lab screenshot:

DestinationGatewayGenmaskFlagsIface
0.0.0.016.18.11.650.0.0.0UGeth0
16.18.11.640.0.0.0255.255.255.248Ueth0

e) Routing Table: Router R1

From lab screenshot:

DestinationGatewayGenmaskFlagsIface
0.0.0.0192.168.66.20.0.0.0UGeth2
16.18.11.64192.168.66.2255.255.255.248UGeth2
68.66.11.80192.168.66.2255.255.255.248UGeth2
172.16.101.2000.0.0.0255.255.255.248Ueth0
192.168.66.00.0.0.0255.255.255.0Ueth2
192.168.88.0192.168.66.2255.255.255.0UGeth2
192.168.216.120.0.0.0255.255.255.252Ueth1
211.60.36.16192.168.66.2255.255.255.240UGeth2

f) Routing Table: Router R2

From lab screenshot:

DestinationGatewayGenmaskFlagsIface
16.18.11.64192.168.88.2255.255.255.248UGeth1
68.66.11.80192.168.88.2255.255.255.248UGeth1
172.16.101.200192.168.66.1255.255.255.248UGeth0
192.168.66.00.0.0.0255.255.255.0Ueth0
192.168.88.00.0.0.0255.255.255.0Ueth1
192.168.216.12192.168.66.1255.255.255.252UGeth0
211.60.36.16192.168.88.2255.255.255.240UGeth1

g) Routing Table: Router R3

From lab screenshot:

DestinationGatewayGenmaskFlagsIface
16.18.11.6468.66.11.82255.255.255.248UGeth1
68.66.11.800.0.0.0255.255.255.248Ueth1
172.16.101.200192.168.88.1255.255.255.248UGeth0
192.168.66.0192.168.88.1255.255.255.0UGeth0
192.168.88.00.0.0.0255.255.255.0Ueth0
192.168.216.12192.168.88.1255.255.255.252UGeth0
211.60.36.1668.66.11.82255.255.255.240UGeth1

h) Routing Table: Router R4

From lab screenshot:

DestinationGatewayGenmaskFlagsIface
16.18.11.640.0.0.0255.255.255.248Ueth2
68.66.11.800.0.0.0255.255.255.248Ueth0
172.16.101.20068.66.11.81255.255.255.248UGeth0
192.168.66.068.66.11.81255.255.255.0UGeth0
192.168.88.068.66.11.81255.255.255.0UGeth0
192.168.216.1268.66.11.81255.255.255.252UGeth0
211.60.36.160.0.0.0255.255.255.240Ueth1

Step 5 – Verify Connectivity

ping <Computer B IP>   # from Computer A
ping <Computer F IP>   # from Computer A
ping <Computer G IP>   # from Computer B

TA 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

CIDRSubnet MaskUsable Hosts
/24255.255.255.028−2=2542^8 - 2 = 254
/28255.255.255.24024−2=142^4 - 2 = 14
/29255.255.255.24823−2=62^3 - 2 = 6
/30255.255.255.25222−2=22^2 - 2 = 2

General formula: Usable Hosts=232−prefix−2\boxed{\text{Usable Hosts} = 2^{32 - \text{prefix}} - 2}

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

  1. What command adds a default gateway 10.0.0.1 to 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
  2. Which flag in route -n output indicates that packets go through a gateway?

    • A) U
    • B) H
    • C) G ✅
    • D) R
  3. How many usable host addresses are in a /30 subnet?

    • A) 30
    • B) 6
    • C) 4
    • D) 2 ✅
  4. 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
  5. In the routing table, what does destination 0.0.0.0 with flag UG represent?

    • A) A loopback route
    • B) A directly connected network
    • C) The default gateway route ✅
    • D) A host-specific route
  6. 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 → gateway 0.0.0.0, genmask 255.255.255.0, flag U

Short Answer Style Questions

  1. Why must ip_forward be 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.
  2. 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.
  3. 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.
  4. What is the network address and broadcast address of 192.168.10.0/24?

    • Network: 192.168.10.0
    • Broadcast: 192.168.10.255\boxed{192.168.10.255}
    • First host: 192.168.10.1, Last host: 192.168.10.254
  5. What command would you use to add a route to 192.168.30.0/24 through gateway 192.168.20.2?

    sudo route add -net 192.168.30.0/24 gw 192.168.20.2
  6. How do you verify routing table entries in Linux?

    route -n

    The -n flag shows IP addresses numerically instead of resolving hostnames (faster and clearer).