CT320: Network and System Administration

Fall 2018

TCP-IP

See this page as a slide show

CT320 TCP-IP

Thanks to:

for the contents of these slides.

Communications Architecture

Divide & Conquer

Layers Example

Each layer assumes that the layer below it will do its job.

TCP/IP Protocol Suite

The Layers

Old OSI Model TCP/IP Hierarchy Protocols
7: Application Layer Application Layer

domain (DNS, hostname→IP address)
http, https (web pages)
pop3, imap, smtp (email)
ntp (time synchronization)
ssh (remote login/file copy)
x11 (X Window System)

6: Presentation Layer
5: Session Layer
4: Transport Layer Transport Layer

TCP (connection-oriented reliable packets)
UDP (hope & luck)

3: Network Layer Network Layer

IP (it all boils down to this)

2: Link Layer Link Layer
(alias Data Link Layer)

ARP (Mac address→IP address)
Ethernet PPP

1: Physical Layer

Functions of the Layers

Assignment of Protocols to Layers

Layered Communications

┌──────────────────┐   Layer N+1 protocol  ┌──────────────────┐
│ Layer N+1 entity │<–––––––––––––––––––––>│ Layer N+1 entity │
└──────────────────┘                       └──────────────────┘
  │             ∧                             │             ∧
  ∨             │                             ∨             │
┌──────────────────┐   Layer N protocol    ┌──────────────────┐
│ Layer N entity   │<–––––––––––––––––––––>│ Layer N entity   │
└──────────────────┘                       └──────────────────┘
  │             ∧                             │             ∧
  ∨             │                             ∨             │
┌──────────────────┐   Layer N-1 protocol  ┌──────────────────┐
│ Layer N-1 entity │<–––––––––––––––––––––>│ Layer N-1 entity │
└──────────────────┘                       └──────────────────┘

Layered Communications

A layer N+1 entity sees the lower layers only as a service provider:

┌──────────────────┐   Layer N+1 protocol  ┌──────────────────┐
│ Layer N+1 entity │<–––––––––––––––––––––>│ Layer N+1 entity │
└──────────────────┘                       └──────────────────┘
  │                                                         ∧
  │                                                         │
  │request                                          indicate│
  │delivery                                         delivery│
  │                                                         │
  ∨                                                         │
┌─────────────────────────────────────────────────────────────┐
│                    Service provider                         │
└─────────────────────────────────────────────────────────────┘

Application View of Networking

Application job: write the web browser (client) or web server (server)

    ┌─────────┐           ┌──────────┐           ┌──────┐
    │ laptop  │           │          │           │      │
    │ running │···········│ Internet │···········│ eBay │
    │ browser │           │          │           │      │
    └─────────┘           └──────────┘           └──────┘

Assume network provides way to send a messages between hosts.

Transport View of Networking

Transport job: implement the connection-(oriented/less) service

    ┌─────────┐           ┌──────────┐           ┌──────┐
    │ laptop  │           │          │           │      │
    │ running │···········│ Internet │···········│ eBay │
    │ browser │           │          │           │      │
    └─────────┘           └──────────┘           └──────┘

Network Layer View

Network layer job: get a message from a source to a destination

    ┌─────────┐
    │ laptop  │     ┌───────┐    ┌───────┐    ┌───────┐
    │ running │·····│ ISP A │····│ ISP B │····│ ISP C │
    │ browser │     └───────┘    └───────┘    └───────┘
    └─────────┘         :            :            :
        	        :            :            :
                    ┌───────┐    ┌───────┐    ┌───────┐      ┌──────┐
                    │ ISP D │····│ ISP E │····│ ISP F │······│ eBay │
                    └───────┘    └───────┘    └───────┘      └──────┘

Link Layer View of Networking

Link Layer job: get a message sent across some medium

    ┌────────┐                             ┌────────┐
    │ host A │·····························│ host B │
    └────────┘      direct connection      └────────┘

Exchange of Data

        ┌─────────┐           ┌───────────┐           ┌─────────┐
      A │ Layer N │           │    PDU    │         B │ Layer N │
        │ entity  │···········│ (layer N) │···········│ entity  │
        └─────────┘           └───────────┘           └─────────┘

Love Letters

My wife is visiting her family in France, and I miss her terribly, so I write a passionate love letter:

Dear Wife,

Warmest regards. Lonely Husband

Example

Say that a web browser wants to see eBay’s home page. It might construct this 34-byte HTTP request:

GET / HTTP/1.1\r\nHost: ebay.com\r\n\r\n

However, to send this over a TCP connection, the Transport level adds a 20-byte header, so now we have this:

[TCP header][HTTP request]

Example

The Transport level hands this off to the Network level, which will create an IP packet with its own 20-byte header:

[IP header][TCP header][HTTP request]

The Network level hands this off to the Data Link layer, which will add its own overhead, depending on the medium:

[Frame header][IP header][TCP header][HTTP request][Frame footer]

Example

Packet Protocol Level
Data Application
TCP header Data Transport
IP header TCP header Data Network
Frame header IP header TCP header Data Frame footer Data Link

When sending, each level treats the data from the previous level as a black box, an unintelligible blob of stuff, and adds its own header or footer.

Similarly, when receiving, each level removes its overhead.

Layers in the Example

┌──────────┐                                        ┌──────────┐
│   HTTP   │                                        │   HTTP   │
└──────────┘                                        └──────────┘
     │                                                   │
┌──────────┐                                        ┌──────────┐
│   TCP    │                                        │   TCP    │
└──────────┘                                        └──────────┘
     │                                                   │
┌──────────┐              ┌──────────┐              ┌──────────┐
│   IP     │              │    IP    │              │   IP     │
└──────────┘              └──────────┘              └──────────┘
     │                      │      │                     │
┌──────────┐      ┌──────────┐    ┌──────────┐      ┌──────────┐
│   Link   │······│   Link   │    │   Link   │······│   Link   │
└──────────┘      └──────────┘    └──────────┘      └──────────┘
   ct320-1           router	     acushla            salem
192.168.110.101  192.168.110.1    129.82.45.35      129.82.44.169

Layers and Services

Stalin says that “Quanity has a quality all its own”

made at imgflip.com

IP: Internet Protocol

 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Version IHL Type of service Total length
Identification Flags Fragment offset
Time to live Protocol Header checksum
Source IP address
Destination IP address
Options (optional)
IP data payload (many bytes)

Protocol: 1=ICMP, 6=TCP, 17=UDP

IP Routing

┌─────────────┐                                   ┌─────────────┐
│ Application │                                   │ Application │
├─────────────┤                                   ├─────────────┤
│  Transport  │                                   │  Transport  │
├─────────────┤          ┌─────────────┐          ├─────────────┤
│   Network   │          │   Network   │          │   Network   │
├─────────────┤          ├─────────────┤          ├─────────────┤
│     Link    │··········│     Link    │··········│     Link    │
└─────────────┘          └─────────────┘          └─────────────┘

ICMP : Internet Control Message Protocol

ICMP Message
20 bytes1 byte1 byte2 bytesmore bytes
IP headerTypeCodeChecksumICMP data

TCP : Transmission Control Protocol

 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Source port Destination port
Sequence number
Acknowledgement number
Data offset - - - - CWR ECNE URG ACK PSH RST SYN FIN Window
Checksum Urgent pointer
Options (0–10 32-bit words)
TCP payload (many bytes)

IP Addressing: Review

┌─────────────────┐       ┌───────────────┐       ┌───────────────┐
│     ct320-1     │  lan1 │    router     │       │     boise     │
│ 192.168.110.101 │·······│ 192.168.110.1 │   ····│ 129.82.44.133 │
└─────────────────┘   :   ├ ─ ─ ─ ─ ─ ─ ─ ┤   :   └───────────────┘
┌─────────────────┐   :   │    acushla    │   :   ┌───────────────┐
│     ct320-2     │   :   │ 129.82.45.35  │·······│     salem     │
│ 192.168.110.102 │····   └───────────────┘  lan2 │ 129.82.44.169 │
└─────────────────┘                               └───────────────┘

IP Addresses

Subnets

┌─────────────────┐       ┌───────────────┐       ┌───────────────┐
│     ct320-1     │  lan1 │    router     │       │     boise     │
│ 192.168.110.101 │·······│ 192.168.110.1 │   ····│ 129.82.44.133 │
└─────────────────┘   :   ├ ─ ─ ─ ─ ─ ─ ─ ┤   :   └───────────────┘
┌─────────────────┐   :   │    acushla    │   :   ┌───────────────┐
│     ct320-2     │   :   │ 129.82.45.35  │·······│     salem     │
│ 192.168.110.102 │····   └───────────────┘  lan2 │ 129.82.44.169 │
└─────────────────┘                               └───────────────┘

Subnets

┌─────────────────┐       ┌───────────────┐       ┌───────────────┐
│     ct320-1     │  lan1 │    router     │       │     boise     │
│ 192.168.110.101 │·······│ 192.168.110.1 │   ····│ 129.82.44.133 │
└─────────────────┘   :   ├ ─ ─ ─ ─ ─ ─ ─ ┤   :   └───────────────┘
┌─────────────────┐   :   │    acushla    │   :   ┌───────────────┐
│     ct320-2     │   :   │ 129.82.45.35  │·······│     salem     │
│ 192.168.110.102 │····   └───────────────┘  lan2 │ 129.82.44.169 │
└─────────────────┘                               └───────────────┘

Why Have Subnets?

Why bother with routers or subnets? Just put all of your computers on one giant LAN, and be done with it!

Getting a datagram from source to destination

Consider this unusual network. In the center is a router, with several LAN ports, connecting three LANs. Note that 203.0.113.12 and 203.0.113.66 are also connected by a dedicated super-high-speed LAN, because they exchange tons of data.

                                          ┌───────────────┐
┌───────────┐       ┌─────────────┐   :···│ 203.0.113.252 │
│ 10.12.1.3 │·······│ 10.12.1.1   │   ·   └───────────────┘
└───────────┘   :   ├ ─ ─ ─ ─ ─ ─ ┤   :   ┌───────────────┐
┌───────────┐   :   │ 203.0.113.1 │···:···│ 203.0.113.12  │
│ 10.12.1.5 │···:   ├ ─ ─ ─ ─ ─ ─ ┤   :   └───────────────┘
└───────────┘   :   │ 192.0.2.7   │   :          :
┌───────────┐   :   └─────────────┘   :          :
│ 10.12.1.6 │····         :           :   ┌───────────────┐
└───────────┘             :           ····│ 203.0.113.66  │
		      to Comcast          └───────────────┘

Getting a datagram from source to destination

                                          ┌───────────────┐
┌───────────┐       ┌─────────────┐   :···│ 203.0.113.252 │
│ 10.12.1.3 │·······│ 10.12.1.1   │   ·   └───────────────┘
└───────────┘   :   ├ ─ ─ ─ ─ ─ ─ ┤   :   ┌───────────────┐
┌───────────┐   :   │ 203.0.113.1 │···:···│ 203.0.113.12  │
│ 10.12.1.5 │···:   ├ ─ ─ ─ ─ ─ ─ ┤   :   └───────────────┘
└───────────┘   :   │ 192.0.2.7   │   :          :
┌───────────┐   :   └─────────────┘   :          :
│ 10.12.1.6 │····         :           :   ┌───────────────┐
└───────────┘             :           ····│ 203.0.113.66  │
		      to Comcast          └───────────────┘

How would 203.0.113.66 send data to:

How’s it supposed to know all that‽

Routing Tables

                                          ┌───────────────┐
┌───────────┐       ┌─────────────┐   :···│ 203.0.113.252 │
│ 10.12.1.3 │·······│ 10.12.1.1   │   ·   └───────────────┘
└───────────┘   :   ├ ─ ─ ─ ─ ─ ─ ┤   :   ┌───────────────┐
┌───────────┐   :   │ 203.0.113.1 │···:···│ 203.0.113.12  │
│ 10.12.1.5 │···:   ├ ─ ─ ─ ─ ─ ─ ┤   :   └───────────────┘
└───────────┘   :   │ 192.0.2.7   │   :          :
┌───────────┐   :   └─────────────┘   :          :
│ 10.12.1.6 │····         :           :   ┌───────────────┐
└───────────┘             :           ····│ 203.0.113.66  │
		      to Comcast          └───────────────┘
Routing Table for 203.0.113.66
DestinationCostInterface
203.0.113.12/321top
203.0.113/242left
gateway3left

Each host (both end-user computers and routers) has a routing table.

Is the second entry really needed? Note the the table does not try to get a packet all the way to 10.12.1.5; it only specifies the next hop.

Routing Tables

                                          ┌───────────────┐
┌───────────┐       ┌─────────────┐   :···│ 203.0.113.252 │
│ 10.12.1.3 │·······│ 10.12.1.1   │   ·   └───────────────┘
└───────────┘   :   ├ ─ ─ ─ ─ ─ ─ ┤   :   ┌───────────────┐
┌───────────┐   :   │ 203.0.113.1 │···:···│ 203.0.113.12  │
│ 10.12.1.5 │···:   ├ ─ ─ ─ ─ ─ ─ ┤   :   └───────────────┘
└───────────┘   :   │ 192.0.2.7   │   :          :
┌───────────┐   :   └─────────────┘   :          :
│ 10.12.1.6 │····         :           :   ┌───────────────┐
└───────────┘             :           ····│ 203.0.113.66  │
		      to Comcast          └───────────────┘
Routing Table for the router
DestinationCostInterface
203.0.113/241right
10/81left
gateway2bottom

There is not one giant routing table for everything. No single host has the big picture. Nobody has the big picture.

Instead, each host minds its own business, and has its own routing table, which tells that host where packets should go.

Routing Tables

                                          ┌───────────────┐
┌───────────┐       ┌─────────────┐   :···│ 203.0.113.252 │
│ 10.12.1.3 │·······│ 10.12.1.1   │   ·   └───────────────┘
└───────────┘   :   ├ ─ ─ ─ ─ ─ ─ ┤   :   ┌───────────────┐
┌───────────┐   :   │ 203.0.113.1 │···:···│ 203.0.113.12  │
│ 10.12.1.5 │···:   ├ ─ ─ ─ ─ ─ ─ ┤   :   └───────────────┘
└───────────┘   :   │ 192.0.2.7   │   :          :
┌───────────┐   :   └─────────────┘   :          :
│ 10.12.1.6 │····         :           :   ┌───────────────┐
└───────────┘             :           ····│ 203.0.113.66  │
		      to Comcast          └───────────────┘
Routing Table for 10.12.1.6
DestinationCostInterface
gateway1right

It only has one LAN interface. Everything’s got to go through that! Once a (non-local) packet gets to the router, then it’s the router’s task to figure out where it should go next.

Actual example

$ ssh acushla ip route
default via 129.82.44.1 dev eno1 
129.82.44.0/23 dev eno1 proto kernel scope link src 129.82.45.35 
169.254.0.0/16 dev eno1 scope link metric 1002 
169.254.0.0/16 dev ens5 scope link metric 1003 
169.254.0.0/16 dev ens7 scope link metric 1005 
192.168.100.0/24 dev ens5 proto kernel scope link src 192.168.100.1 
192.168.110.0/24 dev ens7 proto kernel scope link src 192.168.110.1 
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown 

IP addresses: Allocation

User: Guest

Check: HTML CSS
Edit History Source

Modified: 2018-06-20T17:27

Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2018 Colorado State University
CS Building