HTTP, FTP, SSH, Telnet, DNS
UDP, TCP, OMGWTFBBQ
IP, ICMP, ARP, IPSec
Ethernet, Wi-Fi, Bluetooth (communication within single network link)
Transport
Network
Data Link
Application
HTTP HEADER
FORM POST
FORM POST
TCP HEADER
IP HEADER
ETH. HEADER
ETH. TRAILER
IP HEADER
TCP HEADER
TCP HEADER
HTTP HEADER
HTTP HEADER
HTTP HEADER
FORM POST
FORM POST
FORM POST
ETHERNET FRAME
IP DATAGRAM
TCP SEGMENT
HTTP REQ.
TLS, DNS, HTTP, HTTPS, POP3, SMTP, FTP, NTP, IRC, SSL, ARP, SMPP, SCTP, SPX, FCP, DCCP, IPX/SPX, NAT, HSRP, TCP, VRRP, IP, SPB, MTP, PP2P, NDP, STP, VTP, Ethernet, ATM, BlueTooth, WUR
TLS, DNS, HTTP, HTTPS, POP3, SMTP, FTP, NTP, IRC, SSL, ARP, SMPP, SCTP, SPX, FCP, DCCP, IPX/SPX, NAT, HSRP, TCP, VRRP, IP, SPB, MTP, PP2P, NDP, STP, VTP, Ethernet, ATM, BlueTooth, WUR
[...] a set of hosts is considered to be "on the same link" if:
- when any host, A, from that set, sends a packet to any other host,
B, in that set, using unicast, multicast, or broadcast, the entire
link-layer packet payload arrives unmodified, and
- a broadcast sent over that link by any host from that set of hosts
can be received by every other host in that set.
HTTP GET to http://192.168.7.1/foo/bar
initialize TCP conn. to 192.168.7.1
resolve 192.168.7.1 to MAC addr.
????
Transport
Network
Data Link
Application
HTTP Client
TCP
IPv4
ARP
NIC
HTTP Server
TCP
IPv4
ARP
NIC
IPv4
ARP
NIC
Ethernet Hub
Mike's Computer
192.168.7.33
My Computer
192.168.7.113
Rit's Computer
192.168.7.1
TCP
IPv4
ARP
NIC
My Computer
192.168.7.113
TCP
IPv4
ARP
NIC
Rit's Computer
192.168.7.1
IPv4
ARP
NIC
Mike's Computer
192.168.7.33
HTTP Client
HTTP Server
Ethernet Hub
TCP
IPv4
ARP
NIC
TCP
IPv4
ARP
NIC
IPv4
ARP
NIC
Mike's Computer
192.168.7.33
My Computer
192.168.7.113
Rit's Computer
192.168.7.1
HTTP Client
HTTP Server
Ethernet Hub
TCP
IPv4
ARP
NIC
TCP
IPv4
ARP
NIC
IPv4
ARP
NIC
Mike's Computer
192.168.7.33
My Computer
192.168.7.113
Rit's Computer
192.168.7.1
HTTP Client
HTTP Server
Ethernet Hub
SSH Client
TCP
IPv4
ARP
NIC
My Computer
192.168.1.11
255.255.255.0
SSH Server
TCP
IPv4
ARP
NIC
Rit's Computer
192.168.1.34
IPv4
ARP
NIC
Mike's Computer
192.168.1.33
No response from devices that don't own requested MAC address.
Ethernet Hub
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
192.16.7.35
111.25.19.0/24
D
192.168.100.12
R3
The Cloud
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
192.16.7.35
111.25.19.0/24
D
192.168.100.12
R3
The Cloud
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
192.16.7.35
111.25.19.0/24
D
192.168.100.12
R3
The Cloud
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
192.16.7.35
111.25.19.0/24
D
192.168.100.12
R3
The Cloud
​80 00 20 3F 7A 3E
Source MAC Address
​80 00 20 3F 7A 3E
Dest. MAC Address
​80 00
Eth. Type
IP Datagram / ARP Req.
Body
​80 00 20 3F
CRC Checksum
​MAC Header (14B)
​Data (14B-1.5KB)
Checksum (4B)
R1
A
B
192.168.100.0/24
192.168.100.12
192.168.100.1
​80 00 20 3F 7A 3E
Source MAC Address
​80 00 20 3F 7A 3E
Dest. MAC Address
​80 00
Eth. Type
IP Datagram / ARP Req.
Body
​80 00 20 3F
CRC Checksum
​Data (14B-1.5KB)
​80 00 20 3F 7A 3E
Source MAC Address
​80 00 20 3F 7A 3E
Dest. MAC Address
​80 00
Eth. Type
IP Datagram / ARP Req.
Body
​80 00 20 3F
CRC Checksum
​Version
​IHL
​DSCP
​ECN
​Total Length
Identification
Flags
Fragment Offset
TTL=128
Protocol
Header Checksum
Destination Address = 192.16.7.35
IP Options
Body
Octet 0 (1B)
Octet 1
Octet 2
Octet 3
Octet 0 (1B)
4
8
12
16
20-35
36-256
Source Address = 192.168.100.12
​80 00 20 3F 7A 3E
Source MAC Address
​80 00 20 3F 7A 3E
Dest. MAC Address
​80 00
Eth. Type
IP Datagram / ARP Req.
Body
​80 00 20 3F
CRC Checksum
​Version
​IHL
​DSCP
​ECN
​Total Length
Identification
Flags
Fragment Offset
TTL=128
Protocol
Header Checksum
IP Options
Body
Octet 0 (1B)
Octet 1
Octet 2
Octet 3
Octet 0 (1B)
4
8
12
16
20-35
36-256
Destination Address = 192.16.7.35
Source Address = 192.168.100.12
Mask | Dest. | Next Hop | Flags | Note |
---|---|---|---|---|
255.255.255.0 | 192.168.100.0 | N/A | U | direct delivery |
255.255.255.0 | 111.25.19.0 | N/A | U | direct delivery |
255.255.255.255 | 192.16.7.13 | 111.25.19.14 | UG | forward to R2 |
255.255.255.0 | 192.16.7.0 | 111.25.19.14 | UG | forward to R2 |
0.0.0.0 | 0.0.0.0 | 111.25.19.21 | UG | default; fwd. to R3 |
Destination Address = 192.16.7.35
Mask | Dest. | Next Hop | Flags | Note |
---|---|---|---|---|
255.255.255.0 | 192.168.100.0 | N/A | U | direct delivery |
255.255.255.0 | 111.25.19.0 | N/A | U | direct delivery |
255.255.255.255 | 192.16.7.13 | 111.25.19.14 | UG | forward to R2 |
255.255.255.0 | 192.16.7.0 | 111.25.19.14 | UG | forward to R2 |
0.0.0.0 | 0.0.0.0 | 111.25.19.21 | UG | default; fwd. to R3 |
Destination Address = 192.16.7.35
​11000000.00010000.00000111.00100011
​ 192. 168. 7. 35
Mask | Dest. | Next Hop | Flags | Note |
---|---|---|---|---|
255.255.255.0 | 192.168.100.0 | N/A | U | direct delivery |
255.255.255.0 | 111.25.19.0 | N/A | U | direct delivery |
255.255.255.255 | 192.16.7.13 | 111.25.19.14 | UG | forward to R2 |
255.255.255.0 | 192.16.7.0 | 111.25.19.14 | UG | forward to R2 |
0.0.0.0 | 0.0.0.0 | 111.25.19.21 | UG | default; fwd. to R3 |
Destination Address = 192.16.7.35
​11000000.00010000.00000111.00100011
​11111111.11111111.11111111.00000000
​ 255. 255. 255. 0
​ 192. 168. 7. 35
Mask | Dest. | Next Hop | Flags | Note |
---|---|---|---|---|
255.255.255.0 | 192.168.100.0 | N/A | U | direct delivery |
255.255.255.0 | 111.25.19.0 | N/A | U | direct delivery |
255.255.255.255 | 192.16.7.13 | 111.25.19.14 | UG | forward to R2 |
255.255.255.0 | 192.16.7.0 | 111.25.19.14 | UG | forward to R2 |
0.0.0.0 | 0.0.0.0 | 111.25.19.21 | UG | default; fwd. to R3 |
Destination Address = 192.16.7.35
​11000000.00010000.00000111.00100011
​11111111.11111111.11111111.00000000
&
​11000000.00010000.00000111.00000000
Mask | Dest. | Next Hop | Flags | Note |
---|---|---|---|---|
255.255.255.0 | 192.168.100.0 | N/A | U | direct delivery |
255.255.255.0 | 111.25.19.0 | N/A | U | direct delivery |
255.255.255.255 | 192.16.7.13 | 111.25.19.14 | UG | forward to R2 |
255.255.255.0 | 192.16.7.0 | 111.25.19.14 | UG | forward to R2 |
0.0.0.0 | 0.0.0.0 | 111.25.19.21 | UG | default; fwd. to R3 |
Destination Address = 192.16.7.35
​11000000.00010000.00000111.00100011
​11111111.11111111.11111111.00000000
11000000.10101000.01100100.00000000
​ 192. 168. 100. 0
&
​11000000.00010000.00000111.00000000
Destination Address = 192.16.7.35
11000000.10101000.01100100.00000000
​11000000.00010000.00000111.00000000
not equal
Mask | Dest. | Next Hop | Flags | Note |
---|---|---|---|---|
255.255.255.0 | 192.168.100.0 | N/A | U | direct delivery |
255.255.255.0 | 111.25.19.0 | N/A | U | direct delivery |
255.255.255.255 | 192.16.7.13 | 111.25.19.14 | UG | forward to R2 |
255.255.255.0 | 192.16.7.0 | 111.25.19.14 | UG | forward to R2 |
0.0.0.0 | 0.0.0.0 | 111.25.19.21 | UG | default; fwd. to R3 |
Mask | Dest. | Next Hop | Flags | Note |
---|---|---|---|---|
255.255.255.0 | 192.168.100.0 | N/A | U | direct delivery |
255.255.255.0 | 111.25.19.0 | N/A | U | direct delivery |
255.255.255.255 | 192.16.7.13 | 111.25.19.14 | UG | forward to R2 |
255.255.255.0 | 192.16.7.0 | 111.25.19.14 | UG | forward to R2 |
0.0.0.0 | 0.0.0.0 | 111.25.19.21 | UG | default; fwd. to R3 |
Destination Address = 192.16.7.35
01101111.00011001.00010011.00000000
​11000000.00010000.00000111.00000000
Mask | Dest. | Next Hop | Flags | Note |
---|---|---|---|---|
255.255.255.0 | 192.168.100.0 | N/A | U | direct delivery |
255.255.255.0 | 111.25.19.0 | N/A | U | direct delivery |
255.255.255.255 | 192.16.7.13 | 111.25.19.14 | UG | forward to R2 |
255.255.255.0 | 192.16.7.0 | 111.25.19.14 | UG | forward to R2 |
0.0.0.0 | 0.0.0.0 | 111.25.19.21 | UG | default; fwd. to R3 |
Destination Address = 192.16.7.35
11000000.00010000.00000111.00001101
​11000000.00010000.00000111.00000000
Mask | Dest. | Next Hop | Flags | Note |
---|---|---|---|---|
255.255.255.0 | 192.168.100.0 | N/A | U | direct delivery |
255.255.255.0 | 111.25.19.0 | N/A | U | direct delivery |
255.255.255.255 | 192.16.7.13 | 111.25.19.14 | UG | forward to R2 |
255.255.255.0 | 192.16.7.0 | 111.25.19.14 | UG | forward to R2 |
0.0.0.0 | 0.0.0.0 | 111.25.19.21 | UG | default; fwd. to R3 |
Destination Address = 192.16.7.35
11000000.00010000.00000111.00000000
​11000000.00010000.00000111.00000000
totes equal
Mask | Dest. | Next Hop | Flags | Note |
---|---|---|---|---|
255.255.255.0 | 192.168.100.0 | N/A | U | direct delivery |
255.255.255.0 | 111.25.19.0 | N/A | U | direct delivery |
255.255.255.255 | 192.16.7.13 | 111.25.19.14 | UG | forward to R2 |
255.255.255.0 | 192.16.7.0 | 111.25.19.14 | UG | forward to R2 |
0.0.0.0 | 0.0.0.0 | 111.25.19.21 | UG | default; fwd. to R3 |
Destination Address = 192.16.7.35
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
R3
The Cloud
Mask | Dest. | Next Hop | Flags | Note |
---|---|---|---|---|
255.255.255.0 | 192.168.100.0 | N/A | U | direct delivery |
255.255.255.0 | 111.25.19.0 | N/A | U | direct delivery |
255.255.255.255 | 192.16.7.13 | 111.25.19.14 | UG | forward to R2 |
255.255.255.0 | 192.16.7.0 | 111.25.19.14 | UG | forward to R2 |
0.0.0.0 | 0.0.0.0 | 111.25.19.21 | UG | default; fwd. to R3 |
Destination Address = 192.16.7.35
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
R3
The Cloud
​80 00 20 3F 7A 3E
Source MAC Address
​80 00 20 3F 7A 3E
Dest. MAC Address
​80 00
Eth. Type
IP Datagram
Body
​80 00 20 3F
CRC Checksum
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
7A 42 66 00 11 1E
Source MAC Address
IP Datagram
Body
​80 00 20 3F
CRC Checksum
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
​80 00 20 3F 7A 3E
Dest. MAC Address
​80 00
Eth. Type
​3E 3E 3E 11 11 11
Dest. MAC Address
​80 00
Eth. Type
IP Datagram
Body
​80 00 20 3F
CRC Checksum
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
7A 42 66 00 11 1E
Source MAC Address
​80 00
Eth. Type
IP Datagram
Body
40 00 FF FF
CRC Checksum
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
​3E 3E 3E 11 11 11
Dest. MAC Address
7A 42 66 00 11 1E
Source MAC Address
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
​80 00
Eth. Type
IP Datagram
Body
40 00 FF FF
CRC Checksum
​11 11 11 11 11 00
Dest. MAC Address
42 42 42 42 FF 00
Source MAC Address
no need to decrement TTL
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
A wants to send IP datagram to C
A -> R1
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
R1 -> R2
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
R2 -> C
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
R2 lost conn. to C
R1
R2
A
B
C
192.168.100.0/24
192.16.7.0/24
111.25.19.0/24
D
R3
The Cloud
R1
R2
A
B
C
D
R3
The Cloud
R2 sends ICMP Destination Unreachable to A
D
C
A
B
R1
R2
R3
192.168.100.0/24
111.25.19.0/24
The Cloud
192.16.7.0/24
My name is Arthur Gordon Pym. My
father was a respectable trader
in sea-stores at Nantucket, where
I was born.
HA: [My name is Arthur Gordon Pym. My ]
HB: [father was a respectable trader ]
HC: [in sea-stores at Nantucket, where]
HD: [I was born. ]
HA: [My name is Arthur Gordon Pym. My ]
HX: [fbther wbs b respectbble trbder ]
HC: [in sea-stores at Nantucket, where]
HD: [I was born. ]
can detect errors but not fix them
UDP datagrams sent from B -> C
UDP datagrams received B <- A
D
C
A
B
R1
R2
R3
192.168.100.0/24
111.25.19.0/24
The Cloud
192.16.7.0/24
HA: [My name is Arthur Gordon Pym. My ]
HB: [father was a respectable trader ]
HC: [in sea-stores at Nantucket, where]
HD: [I was born. ]
HC: [in sea-stores at Nantucket, where]
HA: [My name is Arthur Gordon Pym. My ]
HB: [father was a respectable trader ]
HD: [I was born. ]
does not guarantee order of delivery
UDP datagrams sent from B -> C
UDP datagrams received B <- A
D
C
A
B
R1
R2
R3
192.168.100.0/24
111.25.19.0/24
The Cloud
192.16.7.0/24
HA: [My name is Arthur Gordon Pym. My ]
HB: [father was a respectable trader ]
HC: [in sea-stores at Nantucket, where]
HD: [I was born. ]
HA: [My name is Arthur Gordon Pym. My ]
HC: [in sea-stores at Nantucket, where]
HD: [I was born. ]
cannot detect dropped datagrams
UDP datagrams sent from B -> C
UDP datagrams received B <- A
D
C
A
B
R1
R2
R3
192.168.100.0/24
111.25.19.0/24
The Cloud
192.16.7.0/24
HA: [My name is Arthur Gordon Pym. My ]
HB: [father was a respectable trader ]
HC: [in sea-stores at Nantucket, where]
HD: [I was born. ]
UDP datagrams sent from B -> C
HA: [My name is Arthur Gordon Pym. My ]
HC: [in sea-stores at Nantucket, where]
HD: [I was born. ]
UDP datagrams received B <- A
B needs to tell C what it's sending
D
C
A
B
R1
R2
R3
192.168.100.0/24
111.25.19.0/24
The Cloud
192.16.7.0/24
HA: [My name is Arthur Gordon Pym. My ]
HB: [father was a respectable trader ]
HC: [in sea-stores at Nantucket, where]
HD: [I was born. ]
UDP datagrams sent from B -> C
HA: [My name is Arthur Gordon Pym. My ]
HC: [in sea-stores at Nantucket, where]
HD: [I was born. ]
UDP datagrams received B <- A
D
C needs to tell B what it's received (bi-directional comm.)
C
A
B
R1
R2
R3
192.168.100.0/24
111.25.19.0/24
The Cloud
192.16.7.0/24
HA: [My name is Arthur Gordon Pym. My ]
HB: [father was a respectable trader ]
HC: [in sea-stores at Nantucket, where]
HD: [I was born. ]
UDP datagrams sent from B -> C
HA: [My name is Arthur Gordon Pym. My ]
HC: [in sea-stores at Nantucket, where]
HD: [I was born. ]
UDP datagrams received B <- A
D
C needs to tell B what it's received
C
A
B
R1
R2
R3
192.168.100.0/24
111.25.19.0/24
The Cloud
192.16.7.0/24
TCP to the rescue
client IP = 192.168.0.42 client port = 55551
server IP = 192.168.0.99 server port = 6666
Client
Server
SYN, SEQ=ISN(c)
Client
Server
SYN, SEQ=ISN(c)
SYN+ACK, SEQ=ISN(s), ACK=ISN(c)+1
Client
Server
SYN, SEQ=ISN(c)
ACK, SEQ=ISN(c)+1, ACK=ISN(s)+1
SYN+ACK, SEQ=ISN(s), ACK=ISN(c)+1
Client
Server
SYN, SEQ=ISN(c), WIN=1024B
ACK, SEQ=ISN(c)+1, ACK=ISN(s)+1, WIN=1024B
SYN+ACK, SEQ=ISN(s), ACK=ISN(c)+1, WIN=512B
Client
Server
SEQ=92, DATA=8B
Client
Server
SEQ=92, DATA=8B
ACK=100, WIN=512B
Client
Server
SEQ=92, DATA=8B
SEQ=100, DATA=20B
ACK=100, WIN=512B
Client
Server
SEQ=92, DATA=8B
SEQ=100, DATA=20B
ACK=100, WIN=512B
ACK=120, WIN=512B
Client
Server
SEQ=10, DATA=20B
Client
Server
SEQ=10, DATA=20B
SEQ=10, DATA=20B
RTT expired
Client
Server
SEQ=10, DATA=20B
ACK=30
SEQ=10, DATA=20B
RTT expired
Client
Server
SEQ=10, DATA=20B
Client
Server
SEQ=10, DATA=20B
SEQ=30, DATA=15B
Client
Server
SEQ=10, DATA=20B
SEQ=30, DATA=15B
get buffered
Client
Server
SEQ=10, DATA=20B
SEQ=30, DATA=15B
SEQ=10, DATA=20B
RTT expired
Client
Server
SEQ=10, DATA=20B
ACK=30
SEQ=30, DATA=15B
SEQ=10, DATA=20B
ACK=45
RTT expired
Client
Server
SEQ=92, DATA=8B
Client
Server
SEQ=92, DATA=8B
ACK=100, WIN=512
Client
Server
SEQ=92, DATA=8B
ACK=100, WIN=512
Server stopped processing Client data
Client
Server
SEQ=92, DATA=8B
SEQ=100, DATA=20B
ACK=100, WIN=512
SEQ=120, DATA=360B
Server stopped processing Client data
Client
Server
SEQ=92, DATA=8B
SEQ=100, DATA=20B
ACK=100, WIN=512
ACK=120, WIN=492
SEQ=120, DATA=360B
Server stopped processing Client data
Client
Server
SEQ=92, DATA=8B
SEQ=100, DATA=20B
ACK=100, WIN=512
ACK=120, WIN=492
SEQ=120, DATA=360B
ACK=480, WIN=52
Server stopped processing Client data
D
C
A
B
R1
R2
R3
192.168.100.0/24
111.25.19.0/24
The Cloud
192.16.7.0/24
* this is not technically true
N
A
B
192.168.100.0/24
The Cloud
192.168.100.12
216.9.9.76
C
172.18.128.5
192.168.100.1
N
A
B
192.168.100.0/24
The Cloud
192.168.100.12
216.9.9.76
C
172.18.128.5
$ nc -l 6666
Server
$ nc -p 55551 172.18.128.5 6666
Client
client IP = 192.168.0.42 client port = 55551
server IP = 172.18.128.5 server port = 6666
192.168.100.1
NAT
N
A
B
192.168.100.0/24
The Cloud
192.168.100.12
216.9.9.76
C
172.18.128.5
$ nc -l 6666
Server
$ nc -p 55551 172.18.128.5 6666
Client
client IP = 216.9.9.76
client port = 55551
server IP = 172.18.128.5 server port = 6666
192.168.100.1
NAT
N
A
B
192.168.100.0/24
The Cloud
192.168.100.12
216.9.9.76
C
172.18.128.5
$ nc -l 6666
Server
$ nc -p 55551 172.18.128.5 6666
Client
client IP = 216.9.9.76
client port = 4567
server IP = 172.18.128.5 server port = 6666
192.168.100.1
NAT
N
A
B
192.168.100.0/24
The Cloud
192.168.100.12
216.9.9.76
C
$ nc -l 6666
Server
$ nc -p 55551 172.18.128.5 6666
Client
client IP = 216.9.9.76 client port = 4567
server IP = 172.18.128.5 server port = 6666
192.168.100.1
NAT
172.18.128.5
N
A
B
192.168.100.0/24
The Cloud
192.168.100.12
216.9.9.76
C
$ nc -l 6666
Server
$ nc -p 55551 172.18.128.5 6666
Client
client IP = 216.9.9.76 client port = 4567
server IP = 172.18.128.5 server port = 6666
192.168.100.1
NAT
172.18.128.5
N
A
B
192.168.100.0/24
The Cloud
192.168.100.12
216.9.9.76
C
$ nc -l 6666
Server
$ nc -p 55551 172.18.128.5 6666
Client
client IP = 216.9.9.76 client port = 4567
server IP = 172.18.128.5 server port = 6666
192.168.100.1
NAT
172.18.128.5
remember: TCP conn =
(src IP/port, dst IP/port)
The Cloud
Z
P1
N1
P2
N2
The Cloud
Z
N1
N2
P1
P2
The Cloud
Z
N1
N2
P1
P2
The Cloud
Z
N1
N2
P1
P2
The Cloud
N1
N2
Z
???
P1
P2
P1
The Cloud
N1
P2
N2
Z
Z
SYN from port 5555
N2
SYN from port 50000
P2
The Cloud
N1
N2
Z
Z
SYN from port 5555
SYN+ACK, data=5555
N2
SYN from port 50000
SYN+ACK, data=5555
P1
P2
P2
The Cloud
N1
N2
Z
Z
SYN from port 5555
SYN+ACK, data=5555
N2
SYN from port 50000
SYN+ACK, data=5555
SYN from port 5556
SYN from port 50000
P1
P2
P2
The Cloud
N1
N2
Z
Z
SYN from port 5555
SYN+ACK, data=5555
N2
P2
SYN from port 50000
SYN+ACK, data=5555
SYN from port 5556
SYN+ACK, data=5556
SYN from port 50000
SYN+ACK, data=5556
P1
P2
The Cloud
N1
N2
Z
Conn. # | S port | N2 port |
---|---|---|
1 | 50000 | 5555 |
2 | 50000 | 5556 |
3 | ... | 5557 |
4 | ... | 5558 |
5 | ... | 5559 |
external N2 port can be predicted!
P1
P2
The Cloud
N1
N2
Z
Conn. # | S port | N2 port |
---|---|---|
1 | 50000 | 5555 |
2 | 50000 | 5556 |
3 | ... | 5557 |
4 | ... | 5558 |
5 | ... | 5559 |
P1
P2
P1
The Cloud
N1
P2
N2
Z
Conn. # | P1 port | N1 port |
---|---|---|
1 | 60000 | 6666 |
2 | 60000 | 6667 |
3 | ... | 6668 |
4 | ... | 6669 |
5 | ... | 6670 |
The Cloud
N1
N2
Z
N1
P1
P1
P2
N2
P2
SYN src.port=60000 dst.port=5557
SYN src.port=50000 dst.port=6668
The Cloud
N1
N2
Z
N1
P1
P1
P2
N2
P2
SYN src.port=60000 dst.port=5557
SYN src.port=6668 dst.port=5557
SYN src.port=50000 dst.port=6668
SYN src.port=5557 dst.port=6668
The Cloud
N1
N2
Z
N1
P1
P1
P2
N2
P2
SYN src.port=60000 dst.port=5557
SYN src.port=6668 dst.port=5557
SYN src.port=50000 dst.port=6668
SYN src.port=5557 dst.port=6668
SYN src.port=5557 dst.port=6668
The Cloud
N1
N2
Z
N1
P1
P1
P2
N2
P2
SYN src.port=60000 dst.port=5557
SYN src.port=6668 dst.port=5557
SYN src.port=50000 dst.port=6668
SYN src.port=5557 dst.port=6668
SYN src.port=5557 dst.port=6668
SYN + ACK src.port=77777 dst.port=5557
SYN + ACK src.port=77777 dst.port=5557
SYN + ACK src.port=77777 dst.port=5557
TCP connections are full-duplex and bidirectional!