Course: ITS352 / DES352 — Networking Laboratory Institution: School of ICT, Sirindhorn International Institute of Technology (SIIT)
📋 Instructions
- Attendance is checked at the beginning of the Lab class
- Log in Ubuntu: username:
student| password:Siit@1992 - After finishing each assignment, show the Lab Sheet to a TA and ask for a signature
- There will be a 10-minute quiz around the end of the Lab class
- Submit the last page to a TA at the end of class
Overview: Internetworking is the process or technique of connecting different networks by using intermediary devices such as routers or gateway devices.
Section 1: Connecting Devices
Hosts/computers/devices and networks do not normally operate in isolation. We use connecting devices to:
- Connect hosts together → make a network
- Connect networks together → make an internetwork
Connecting devices can operate in different layers of the Internet model.
Two Groups of Connecting Devices
🔵 Devices Used to Create a Network (Local)
- Hub — operates only in the Physical Layer
- Signals can travel a fixed distance before attenuation endangers data integrity
- Simply repeats/broadcasts signal to all ports
- Link-Layer Switch (Switch) — operates in Physical + Data-Link Layers
- As a physical-layer device: regenerates the signal it receives
- As a data-link device: checks MAC addresses (source & destination) in the frame and forwards to the correct destination
💡 Analogy: A hub is like a loudspeaker in a room — everyone hears everything. A switch is like a smart mailman — it reads the address and delivers only to the right person.
🔴 Devices Used to Connect Multiple Networks (Internet)
- Router — operates in Physical + Data-Link + Network Layers
- As a physical-layer device: regenerates the signal it receives
- As a data-link device: checks MAC addresses (physical addresses)
- As a network-layer device: checks IP addresses (network-layer addresses)
- It is an internetworking device — connects independent networks to form an internetwork
💡 Analogy: A router is like a post office — it reads the full address (IP), figures out the best route, and forwards the package to the next destination.
Layer Summary Table
| Device | Physical | Data-Link | Network |
|---|---|---|---|
| Hub | ✅ | ❌ | ❌ |
| Switch | ✅ | ✅ | ❌ |
| Router | ✅ | ✅ | ✅ |
Section 2: IPv4 Addresses
An IPv4 address is a logical (network-layer) address. It is a 32-bit address that uniquely and universally defines the connection of a host or router to the Internet.
⚠️ The IP address is the address of the connection, not the host/router itself — if the device moves to another network, the IP address may change.
2.1 Notation
There are three common notations for IPv4:
- Binary notation (base 2): displayed as 32 bits
- Example:
10000000 00001011 00000011 00011111
- Example:
- Dotted-decimal notation (base 256): 4 decimal numbers separated by dots, each representing 8 bits
- Example:
128.11.3.31
- Example:
- Hexadecimal notation (base 16): each hex digit = 4 bits → 32-bit address = 8 hex digits
- Example:
80 0B 03 1F - Often used in network programming
- Example:
💡 Analogy: Same address, different languages. Binary is machine language, dotted-decimal is human-readable, hex is programmer-friendly.
2.2 Hierarchy in Addressing
A 32-bit IPv4 address is divided into two parts:
- Network Prefix — identifies the network
- Host Number/Address — identifies the specific device within that network
- Computers in the same LAN share the same network prefix but differ in host address
Section 3: IPv4 Classless Addressing
Classless addressing is the modern method of assigning IP addresses to a network (the classic method is called classful addressing).
- The prefix length is variable (ranges from 0 to 32)
- The size of the network is inversely proportional to the prefix length:
- Small prefix → larger network (more IP addresses)
- Large prefix → smaller network (fewer IP addresses)
3.1 CIDR Notation (Slash Notation)
Formally called Classless Interdomain Routing (CIDR) — pronounced "cider".
Examples: 12.24.76.8/8, 23.14.67.92/12, 220.8.24.255/25
What the /n tells you:
- IP address — the part before the
/ - Network prefix — first bits in binary
- Host addresses — last bits
- Total host addresses in network —
- Subnet mask — first bits are
1, rest are0
Special addresses derived from /n:
| Address | Binary pattern |
|---|---|
| Network address | Network prefix + 00...00 |
| First available host | Network prefix + 00...01 |
| Last available host | Network prefix + 11...10 |
| Broadcast address | Network prefix + 11...11 |
💡 Analogy: Think of the network prefix like a ZIP code area and the host part like individual house numbers. The network address is the "ZIP code itself" (not assignable), broadcast is "send to every house in this ZIP code."
3.2 Worked Example: 128.143.137.144/20
Step-by-step binary breakdown:
128.143.137.144 = 10000000 10001111 10001001 10010000
255.255.240.0 = 11111111 11111111 11110000 00000000
(first 20 bits are 1s)
↑ Network | Host ↑
Derived values:
Network Address: 128.143.128.0 = 10000000 10001111 10000000 00000000
First Host: 128.143.128.1 = 10000000 10001111 10000000 00000001
Last Host: 128.143.143.254 = 10000000 10001111 10001111 11111110
Broadcast: 128.143.143.255 = 10000000 10001111 10001111 11111111
Summary:
- Network Address =
128.143.128.0/20 - First Available Host =
128.143.128.1 - Last Available Host =
128.143.143.254 - Broadcast Address =
128.143.143.255
Useful online calculators:
- http://jodies.de/ipcalc
- https://www.ipaddressguide.com/cidr
- https://www.ultratools.com/tools/netMask
Section 4: Network Diagrams
A network diagram is a visual representation of a computer or telecommunications network — showing components and how they interact (routers, devices, hubs, firewalls, etc.).
Two Types Used in This Lab
-
Logical Network Diagram
- Shows how information flows through a network
- Displays: subnets, network devices, routing protocols
- Helps keep the network optimized
- [See diagram in original lab sheet — p.4]
-
Physical Network Diagram
- Shows the actual topology as it physically exists
- Includes: ports, cables, racks, servers, specific models, interface names (e.g.
eth1,eth2) - [See diagram in original lab sheet — p.4]
💡 Analogy: Logical diagram = a subway map (simplified, shows connections). Physical diagram = a blueprint (exact wires, ports, hardware).
Assignment 1 – Classless Addressing
Given: 128.143.137.144/20
Fill in the table below (compute by yourself — do not use online calculators):
| Network Prefix | Subnet Mask | First Available Host Address | Last Available Host Address |
|---|---|---|---|
TA's Signature: ______________________
Assignment 2 – Create a Network Using a Hub
Note: Onsite students can use physical PC or IMUNES. Online students use IMUNES. You can work alone this semester.
Connect three computers together using a hub to form a network.
2.1 LAN Cable Connection
- Use NIC eth1 on each computer
- Connect each computer's
eth1to the hub
2.2 IP Address Setup
Set the following IPs (using ifconfig):
| Computer | IP Address |
|---|---|
| 1st | 192.168.61.1 |
| 2nd | 192.168.61.2 |
| 3rd | 192.168.61.3 |
Command example:
$ sudo ifconfig eth1 192.168.61.1⚠️ When no subnet mask is specified, the network address defaults to
192.168.61.0. The available host range is192.168.61.1–192.168.61.254.
2.3 Verify Network Connection
- Use
pingto confirm connectivity between all three computers - You must be able to ping each computer
$ ping 192.168.61.2
$ ping 192.168.61.3TA's Signature: ______________________
Assignment 3 – Create an Internetwork Using a Router
Set up a simple internetwork connecting two networks via a router.
[Logical and Physical Network Diagrams — see original lab sheet p.6]
Summary of Setup
| Computer | Role | NIC | IP Address |
|---|---|---|---|
| A | Host | eth1 → R1's eth1 | 172.16.101.201/29 |
| C | Host | eth1 → R1's eth2 | 192.168.216.14/30 |
| R1 | Router | eth1 → Computer A | 172.16.101.202/29 |
| R1 | Router | eth2 → Computer C | 192.168.216.13/30 |
3.1 LAN Cable Connection
- Unplug cable from
eth0(not used) - Connect: Computer A
eth1↔ Router R1eth1 - Connect: Router R1
eth2↔ Computer Ceth1
3.2 Setup Computer A
a) Disable eth0:
$ sudo ifconfig eth0 down
$ route -n # routing table should be emptyb) Set IP address on eth1:
Subnet mask for /29: (11111111.11111111.11111111.11111000)
$ sudo ifconfig eth1 172.16.101.201/29
$ route -nThe network address is
172.16.101.200. The local range is172.16.101.200–172.16.101.208. Note:.200= network address,.208= broadcast address (neither assignable).
c) Add default gateway (router R1):
$ sudo route add default gw 172.16.101.202
$ route -nTo delete the default gateway:
$ route del default
3.3 Setup Computer C
a) Disable eth0:
$ sudo ifconfig eth0 down
$ route -nb) Set IP address on eth1:
Subnet mask for /30: (11111111.11111111.11111111.11111100)
$ sudo ifconfig eth1 192.168.216.14/30
$ route -nThe network address is
192.168.216.12. The local range is192.168.216.13–192.168.216.14. Note:.12= network address,.15= broadcast address.
c) Add default gateway (router R1):
$ sudo route add default gw 192.168.216.13
$ route -n3.4 Setup Router R1
a) Disable eth0:
$ sudo ifconfig eth0 down
$ route -nb) Set IP on eth1 (side facing Computer A):
$ sudo ifconfig eth1 172.16.101.202/29
$ route -nc) Set IP on eth2 (side facing Computer C):
$ sudo ifconfig eth2 192.168.216.13/30
$ route -nd) Enable IP Forwarding (makes R1 act as a router):
By default, IP forwarding is disabled.
- Check current status:
$ sudo sysctl -a | grep ip_forward
# net.ipv4.ip_forward = 0 → disabled- Enable IP forwarding:
$ sudo sysctl -w net.ipv4.ip_forward=1
# net.ipv4.ip_forward = 1 → enabled💡 Enabling IP forwarding links eth1 and eth2 together logically, allowing packets to be forwarded between the two networks. Now R1 works as a real router!
3.5 Verify the Internetwork
From Computer A → ping Computer C:
$ ping -c 5 192.168.216.14From Computer C → ping Computer A:
$ ping -c 5 172.16.101.201Expected result: 5 packets transmitted, 5 received, 0% packet loss
TA's Signature: ______________________
Assignment 4 – Create an Internetwork of Three Networks
Group of four students. Using four computers, create the internetwork shown in the logical diagram below. Router R1 uses all three NICs (
eth0,eth1,eth2) to connect three networks together.
Networks:
- Network A:
211.60.36.16/28 - Network B:
16.18.11.64/29 - Network C:
68.66.11.80/29
[Logical Network Diagram — see original lab sheet p.11]
4.1 Design Your Physical Network Diagram
- Detail which computer connects to which NIC with which IP
- Show to TA before proceeding
TA's Signature: ______________________
4.2 Connect and Verify
- Set up the internetwork according to your diagram
- Verify using
pingbetween all hosts across networks
TA's Signature: ______________________
Quick Reference: Key Commands
| Purpose | Command |
|---|---|
| Set IP on interface | sudo ifconfig eth1 <IP>/<prefix> |
| Disable interface | sudo ifconfig eth0 down |
| View routing table | route -n |
| Add default gateway | sudo route add default gw <gateway-IP> |
| Delete default gateway | route del default |
| Check IP forwarding | sudo sysctl -a | grep ip_forward |
| Enable IP forwarding | sudo sysctl -w net.ipv4.ip_forward=1 |
| Ping N packets | ping -c <N> <IP> |