1 of 34

Networking 101

Lecture 5

lukepeters, kashun

(slide credits abizer, longlian, night)

2 of 34

Course Resources

  • Your facilitators!
  • Ed, Gradescope
  • OCF Slack (ocf.io/slack) or Discord (ocf.io/discord) #decal-general
  • All materials available at decal.ocf.io
  • Ask questions / work on lab with us during lab sessions! (Tuesday 8-9pm in OCF Lab)

3 of 34

Outline

  • What makes up a network system?
  • Addressing & Routing
  • Protocols
  • SysAdmin Tools

4 of 34

What makes up a network system?

5 of 34

Big Question: Why do we need networks?

  • We want easy communication!

What do we need for easy communication?

  • Low latency
  • High bandwidth
  • Ability to easily identify a computer
  • Fault-tolerance

6 of 34

Conceptual Model: TCP/IP

  • 4-layer model
  • Loosely defined (functions can be in-between levels)
  • Higher layers abstract lower layers

Application

Transport

Internet

Link

7 of 34

Link Layer

  • Communication between physically connected nodes
  • MAC Addresses
  • ARP/NDP
  • Underlying hardware implementations are abstracted outside of TCP/IP model
  • “Who can I talk to without going through a router?”

8 of 34

Internet Layer

  • Transmitting data to different networks
  • Global Routing (IP Addresses)
  • No guarantees on reliability (just like real life!)

9 of 34

Transport Layer

  • Defines protocols for communication between computers
  • Dealing with unreliability of sending packets
  • TCP/UDP

10 of 34

Application Layer

  • Application-specific, actually deals with interpreting the data being sent
  • Most “user-facing” functions live here
  • File sharing, message passing, database access
  • Examples: HTTP/FTP/DNS

11 of 34

Addressing & Routing

12 of 34

Media Access Control (MAC) Addresses

  • Looks like this: 00:14:22:01:2a:c5
  • 48 bits, divided into 6 octets
  • First 3 octets identify the interface manufacturer
  • Unique to each device
  • Used to identify devices on local network
  • How do we talk to devices outside the local network?

13 of 34

IP Addresses (IPv4)

  • IP addresses uniquely identify a host
  • IP addresses can be changed
  • 32 bits long, divided into 4 octets, look like: 123.123.123.123
  • IPv4 octets are commonly expressed in decimal notation, although alternative formats, though rarely employed, are also permissible.

14 of 34

A note on bits, decimal and hexadecimal

  • Different ways to write a number!
    • Decimal: uses 0 through 9
      • Add another digit after reaching 9
    • Hex: 0 through 9, a through f
      • Add another digit after reaching f
    • Binary: uses bits (0 or 1)
      • Add another digit… every two numbers… :(
  • . or : in addresses are just separators. Make it easy to read

15 of 34

Example: Sixty

Decimal:

60

Used in IPv4

Hex:

3c

(often written 0x3c)

Used in MAC addresses, IPv6

Binary:

0b111100

It’s more convenient to use hex instead!

16 of 34

Subnets

  • Remember that IP addresses are represented with binary
  • Sometimes, you’ll see 192.168.1.0/24
  • The /24 is a subnet mask
  • Subnet: a range of IP addresses (e.g. 192.168.1.0-255)
  • The first 24 bits of of the address: network prefix
  • The last 8 bits: host identifier

17 of 34

IPv6

  • There are only 4.3 billion IPv4 addresses, but almost 8 billion people in the world - what do we do?
  • IPv6 addresses contain 128 bits
  • Formatted as follows: 1234:5678:89:0:ab:cd:ef:beef
  • We have a million billion IPv6 addresses for each cell in every human on the planet (enough?)

18 of 34

Address Resolution Protocol (ARP)

  • Translates IP address to a specific MAC address
  • ARP Request: asks devices on local network who an IP address belongs to
  • Kernel caches values in an “ARP table”

19 of 34

Routing

  • How do we decide where to jump to?
  • Routers maintain routing tables, which tell us where to hop to next

OCF router routing table

20 of 34

Domain Name System (DNS)

  • Translates domains (as found in URLs) to IP addresses
  • Can manually set domain -> IP mappings, or can use external DNS resolver

21 of 34

Protocols

22 of 34

Transmission Control Protocol (TCP)

  • Ensures reliable transmission
  • Connection-oriented: need to initiate a connection before sending data
  • Used when reliability is more important than speed
  • Examples: website loading, file transfer

23 of 34

User Datagram Protocol (UDP)

  • No reliability guarantees
  • Does not establish a connection
  • Good for real-time applications where some loss is acceptable
  • Examples: (lossy) streaming, gaming

24 of 34

Internet Control Message Protocol (ICMP)

  • Not used to transmit data
  • Technically not a “transport protocol”
  • Used to transmit error messages and status info
  • Used by diagnostic tools

25 of 34

Internet Control Message Protocol (ICMP)

Type

Code

Status

Description

0 – Echo Reply[6]: 14 

0

Echo reply (used to ping)

3 – Destination Unreachable[6]: 4 [9]

0

Destination network unreachable

1

Destination host unreachable

3

Destination port unreachable

8 – Echo Request

0

Echo request (used to ping)

26 of 34

SysAdmin Tools

27 of 34

ping

28 of 34

ping

29 of 34

traceroute

30 of 34

traceroute

31 of 34

arp

32 of 34

dig

33 of 34

dig

34 of 34

ip

Can do many things, including displaying/modifying ip addresses and routing info. Example: ip addr