ITS332
Information Technology Laboratory II
Networking Lab Manual

by
Steven Gordon
Sirindhorn International Institute of Technology
Thammasat University
This manual is also available as:
HTML: ict.siit.tu.ac.th/˜sgordon/netlab/
PDF: ict.siit.tu.ac.th/˜sgordon/reports/netlab-manual.pdf
Course Web Site: ict.siit.tu.ac.th/moodle/
8 January 2015 (r3521)

Contents

1 Introduction
 1.1 About ITS332 Information Technology Lab II
 1.2 About the Lab Manual
  1.2.1 How to Use the Manual
  1.2.2 Notation
  1.2.3 Other Resources
 1.3 Completing the Tasks
  1.3.1 Making Notes
  1.3.2 Drawing Message Sequence Diagrams
  1.3.3 Drawing Packets
  1.3.4 Network Design
  1.3.5 What Not To Do
 1.4 Further Information Sources
2 Ubuntu Linux
 2.1 What is Ubuntu Linux?
  2.1.1 Why Not Microsoft Windows?
 2.2 Common Operations
  2.2.1 Starting Ubuntu Linux
  2.2.2 User Accounts and Login
  2.2.3 Window System
  2.2.4 Command Line Shell
  2.2.5 Text and Source Code Editing
  2.2.6 Applications
 2.3 Advanced Operations
  2.3.1 Installing Software
  2.3.2 Compiling C Code
 2.4 Tasks
3 Wireshark
 3.1 Packet Capture
 3.2 Capturing with tcpdump
 3.3 Viewing and Analysing Packets with Wireshark
  3.3.1 Viewing Captured Traffic
  3.3.2 Analysis and Statistics
  3.3.3 Filters
 3.4 Tasks
4 Client/Server Applications
 4.1 Clients, Servers and Addressing
  4.1.1 Addresses and Ports
  4.1.2 Servers
  4.1.3 Clients
 4.2 Web Browsing
  4.2.1 Server Configuration Files
  4.2.2 Controlling the Web Server
  4.2.3 Creating Web Pages
  4.2.4 Server Logs
  4.2.5 Basic Authentication
 4.3 Remote Login
 4.4 Tasks
5 Networking Tools
 5.1 Operating Systems and Tool Interfaces
 5.2 Viewing Network Interface Information
 5.3 Viewing Ethernet Interface Details
 5.4 Testing Network Connectivity
  5.4.1 ping at SIIT
 5.5 Testing a Route
 5.6 Converting Between Domain Names and IP Addresses
 5.7 Viewing the Routing Table
 5.8 Converting IP Addresses to Hardware Addresses
 5.9 Network Statistics
 5.10 Viewing More Network Information: Useful Files
 5.11 Automatic IP Address Configuration
  5.11.1 How Does DHCP Work?
  5.11.2 Viewing Interface Information
  5.11.3 Viewing DHCP Information
  5.11.4 Setting a Static IP Address
 5.12 Tasks
6 Layer 2 Networking
 6.1 Peer-to-Peer Networks
  6.1.1 Background
  6.1.2 Ethernet Cabling
 6.2 Switched Network
 6.3 Tasks
7 Layer 3 Networking
 7.1 Routers
  7.1.1 Routers and Hosts
  7.1.2 Enabling Routing
  7.1.3 Editing the Routing Table
 7.2 Tasks
8 Firewalls
 8.1 Understanding Firewalls
  8.1.1 How Do Firewalls Work?
  8.1.2 Firewall Rules
  8.1.3 Firewalls and Servers
  8.1.4 Firewalls on Linux: iptables
 8.2 Tasks
9 Socket Programming
 9.1 Programming with Sockets
  9.1.1 Servers Handling Multiple Connections
  9.1.2 Further Explanation
 9.2 Tasks
A Acronyms and Units
 A.1 Acronyms
 A.2 Units
B Lab Facilities
 B.1 Work Stations
 B.2 Network Infrastructure
C Ubuntu Reference Material
 C.1 Commands
 C.2 Files and Directories
D C Sockets Examples
 D.1 TCP Sockets in C
  D.1.1 Example Usage
  D.1.2 TCP Client
  D.1.3 TCP Server
 D.2 UDP Sockets in C
  D.2.1 Example Usage
  D.2.2 UDP Client
  D.2.3 UDP Server
E Python Sockets Examples
 E.1 TCP Sockets in Python
  E.1.1 Example Usage
  E.1.2 TCP Client
  E.1.3 TCP Server
 E.2 UDP Sockets in Python
  E.2.1 Example Usage
  E.2.2 UDP Client
  E.2.3 UDP Server
 E.3 Raw Sockets in Python
F Packet Formats and Constants
 F.1 Packet Formats
 F.2 Port Numbers and Status Codes

List of Figures

1.1 Example message sequence diagram
1.2 Example packet diagram
1.3 Single Router Network
3.1 Capturing packets in the Operating System
3.2 Main window of Wireshark
6.1 Layer 2 Peer-to-peer Network
6.2 Example ordering of Ethernet sockets on computer and switch
6.3 Ethernet straight-through cable connection
6.4 Ethernet cross-over cable connection
6.5 Layer 2 Switched Network
7.1 Comparison of Router and Host
8.1 An organisation views their network as inside, and all other networks as outside
8.2 Example firewall rules
8.3 Chains in iptables
9.1 Socket communications
B.1 Network Lab: Connections for each computer
B.2 Network Lab: Connections for each group of 9 computers
B.3 Network Lab: Connections for entire lab
F.1 IP Datagram Format
F.2 TCP Segment Format
F.3 UDP Datagram Format
F.4 Ethernet Frame Format

List of Tables

3.1 Common Wireshark Display Filters
3.2 IEEE 802.11 Wireshark Display Filters
C.1 General Ubuntu commands
C.2 Important Ubuntu networking commands
C.3 Important Ubuntu files and directories