SlideShare une entreprise Scribd logo
1  sur  54
Télécharger pour lire hors ligne
Wim Godden
Cu.be Solutions
@wimgtr
Your app lives on a network
Networking for web developers
Who am I ?
Wim Godden (@wimgtr)
Where I'm from
Where I'm from
Where I'm from
Where I'm from
Where I'm from
Where I'm from
My town
My town
Belgium – the traffic
Who am I ?
Wim Godden (@wimgtr)
Founder of Cu.be Solutions (http://cu.be)
Open Source developer since 1997
Developer of PHPCompatibility, OpenX, Nginx SLIC, ...
Speaker at PHP and Open Source conferences
Who are you ?
Developers ?
System engineers ?
Network engineers ?
Do you know how the Internet works ?
We’re web developers, not network engineers !
Know enough to build new stuff
Know enough to maintain existing code
What if...
Customer Support Desk Developers
Do you know these ?
TCP
UDP
IP
DNS
BGP
MAC address
IPv4
IPv6
SYN
ACK
Source port
Destination port
Default gateway
Routing table
Basics : OSI model
Physical
Layer 1
Data Link
Layer 2
Network
Layer 3
Transport
Layer 4
Session
Layer 5
Presentation
Layer 6
Application
Layer 7
Wires, network card, wireless interface
Data protocol (ethernet, ...)
IP adressing
TCP, UDP, ports, ...
TLS, L2TP, SOCKS, PPTP, ...
Serialization, data translation
HTTP, DNS, SMTP, ...
Basics : packets
01011010111010
Physical cable
or wireless
01011010111010
Basics : packets
Destination MAC (6 bytes) Source MAC (6 bytes) Type (2 bytes)
Payload (46 – 1500 bytes) CRC (4 bytes)
Part 1 : Ethernet frame
0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31
0 Version Header
length
DSCP ECN Total length
32 Identification Flags Fragment Offset
64 Time To Live Protocol Header Checksum
96 Source IP Address
128 Destination IP Address
160 Options (if required)
< Contents of the packet >
Part 2 : IPv4 header (min. 160 bytes)
Part 3 : TCP/UDP/… header and data
Basics : TCP packet
Bit 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31
0 Source port Destination port
32 Sequence number
64 Acknowledgment number
96 Data
offset
Flags Window size
128 Checksum Urgent pointer
160 Options (if required)
< Contents of the packet >
Basics : packets
Destination MAC (6 bytes) Source MAC (6 bytes) Type (2 bytes)
Payload (46 – 1500 bytes) CRC (4 bytes)
Part 1 : Ethernet frame
Sending on a local network
Each system has a MAC address
Assigned by manufacturer
Can be overwritten (for VM or failover)
Same physical network → send packet to MAC address
Switch knows MAC address(es) of devices and forwards traffic
Layer 2
Sending IP traffic on local network
Requires IP addresses
Where to send ? We need to know MAC address
Uses ARP (Address Resolution Protocol) for lookup
Stores IP ↔ MAC relation in ARP table
What’s “local” ?
→ Same IP subnet
OK, what’s a subnet ?
Layer 3
16:58:56.933019 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.0.15 tell 192.168.0.12, length 28
16:58:56.938019 ARP, Ethernet (len 6), IPv4 (len 4), Reply 192.168.0.15 is-at 00:50:56:8b:6a:b7, length 46
IP adressing (IPv4)
IPv4 adressing = CIDR notation
xxx.xxx.xxx.xxx where 0 <= xxx <= 255
0.0.0.0 → 255.255.255.255
Total amount of IP addresses available :
256 * 256 * 256 * 256 = 28
* 28
* 28
* 28
= 232
= 4.3 billion
Subnet = range of IP addresses
192.168.0.0 → 192.168.0.255
Typical notation uses a “mask” :
192.168.0.0 → 192.168.0.255 = 192.168.0.0/24
IPv4 provides 232
addresses
A /24 mask gives 2(32-24)
or 28
addresses = 256 addresses
Local networks :
10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16
Sending IP traffic on local network
Client
192.168.0.15/24
Server
192.168.0.2/24
MAC for
192.168.0.2 ?
AA:BB:CC:DD:EE:FF
Let’s talk !
Sending IP traffic to remote device
Requires IP addresses
Where to send ?
Can not use ARP : MAC addresses are not shared beyond local network
Uses default gateway
Provided by DHCP or
Set statically
Must be on same subnet → address found in ARP table
Layer 3
Sending IP traffic to remote device
Requires IP addresses
Where to send ?
Can not use ARP : MAC addresses are not shared beyond local network
Uses default gateway
Provided by DHCP or
Set statically
Must be on same subnet → address found in ARP table
Layer 3
Client Router ServerInternet
192.168.0.15 192.168.0.1 194.7.1.4
Default gateway
MAC for
192.168.0.1 ?
AA:BB:CC:DD:EE:FF
Destination : AA:BB:CC:DD:EE:FF
Contents : TCP packet to 194.7.1.4
See ARP table : arp -a
See default gateway : route -n (Lin)
route print (Win)
Basics : TCP packet
Bit 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31
0 Source port Destination port
32 Sequence number
64 Acknowledgment number
96 Data
offset
Flags Window size
128 Checksum Urgent pointer
160 Options (if required)
< Contents of the packet >
Establishing a TCP connection
Client Server
SYN
SYN ACK
ACK
Data
Sequence no = 1002
Acknowledge no = 9001
Sequence no = 1000
Sequence no = 1001
Acknowledge no = 9000
Establishing a TCP connection
Client Server
SYN
SYN ACK
ACK
Data
Sequence no = 1002
Acknowledge no = 9001
Sequence no = 1000
Sequence no = 1001
Acknowledge no = 9000
Brussels Montreal45ms
0
45
90
135
Establishing a TCP connection
Client Server
SYN
SYN ACK
ACK
Data
Sequence no = 1002
Acknowledge no = 9001
Sequence no = 1000
Sequence no = 1001
Acknowledge no = 9000
Brussels Montreal45ms
0
45
90
135
London10ms
10
20
30
TCP Window Size
Client Server
Brussels Montreal
SYN
SYN ACK
rwnd = 8192
rwnd = 8192
rwnd = 16384
ACK
DATA
sysctl net.ipv4.tcp_window_scaling
TCP Slow Start
Client Server
Brussels Montreal45ms
0
45
90
135
180
225
TCP Slow Start
Client Server
Brussels Montreal45ms
0
45
90
135
180
225
New vs existing connection
Client Server
Brussels Montreal45ms
0
45
90
135
280
325
SYN
SYN ACK
ACK
DATA
(x8)
ACK
(x4)
GET /url
DATA
(x4)
ACK
(x8)
370
415
Processing request
235
New vs existing connection
Client Server
GET /url
Brussels Montreal45ms
0
45
145
180
DATA
DATA
(x12)
ACK
(x12)
Processing request
225
TCP Performance
Upgrade to latest Linux kernel or OS
Check window size
Reduce latency (move servers closer to client)
Reuse already established connections
UDP
User Datagram Protocol
Unreliable Datagram Protocol
Connectionless
→ No 3-way handshake required
Simple packet structure
Packets might not arrive
Packets might arrive out of order
Ideal for streaming, gaming, ...
Bit 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31
0 Source port Destination port
32 Length Checksum
< Contents of the packet >
TCP/UDP ports
Bit 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31
0 Source port Destination port
32 Sequence number
64 Acknowledgment number
96 Data
offset
Flags Window size
128 Checksum Urgent pointer
160 Options (if required)
< Contents of the packet >
Bit 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31
0 Source port Destination port
32 Length Checksum
< Contents of the packet >
TCP
UDP
Source and Destination ports
Destination port : defined by service
HTTP : TCP port 80
HTTPS : TCP port 443
DNS : UDP port 53
Source port : for identification of a connection
Client Server
80
80
80
5000
5001
5002
See active connections with
source/destination ports :
netstat -n
Fetching a website
Need to fetch http://cu.be
TCP doesn’t know what cu.be is
→ needs an IP address
Looks up IP address through DNS
Open a socket
Connect to IP address on port 80
Send HTTP request over the connection
Get data back
Get images, CSS, javascript over the same connection
Close the connection
Show the webpage
DNS lookups
Through a DNS server
Authoritative : in charge of the domain name
Recursive : asks the authoritative server, then caches for a while
→ Cache time is defined by TTL
Usually you will use a recursive server (owned by your provider)
Client Recursive
DNS
Server
IP for
cu.be ?
Root DNS
server
IP for
cu.be ?
.be DNS
server
cu.be DNS
server
Ask the .be
DNS server
IP for
cu.be ?Ask the cu.beDNS server
IP forcu.be ?194.50.97.38
194.50.97.38
DNS lookups
Actual lookups depend on type of DNS record
DNS holds lots of things :
A record = IP addresses
CNAME records = aliases for A records
MX records = mail servers
NS records = DNS servers
TXT = various stuff (anti-spam mostly)
2 tools to debug DNS :
dig
nslookup
Sockets
The layer between your application and TCP, UDP, ...
Abstracts syntax
Makes it easy to switch between protocols
Provides an easy interface
No need to know implementation
Send a stream of data → split up in packets
Receive lots of data → converted from packets to string
Packets over the Internet
Client Router ServerInternet
192.168.0.15 192.168.0.1 194.7.1.4
BGP protocol decides how packets are routed
Each public network has AS (Autonomous System) number
AS3356 = Level3
AS39628 = Cu.be
BGP announces subnets over BGP to its uplink providers :
“AS39628 here… you can reach 194.50.97.0/24 through me”
BGP routes
BGP routing
Router
AS 1
Router
AS 5
Router
AS 5
Router
AS 52
Router
AS 10
Router
AS 2
Client
Server
IPv6
Created to solve lack of IP addresses (4.3 billion in IPv4)
Standard created in 90s
Deployed on most major sites, but small sites behind
Addresses :
IPv4 address : 192.168.0.1
IPv6 address : 2001:0db8:0000:0000:0000:0000:0370:7334
Abbreviated : 2001:0db8::0370:7334
Can’t talk to eachother !
Address space :
2128
= 340,282,366,920,938,463,463,374,607,431,770,000,000
Deployment rates (source : Google) :
Global : 13.12%
US : 29.78%
Canada : 16.58%
Belgium : 48.42%
Should you use it ? YES ! (But don’t forget about firewalling !)
TLS
Client Server
0
45
90
135
180
225
SYN
ClientHello
SYN ACK
ACK
ServerHello
Certificate
ServerHelloDone
ClientKeyExchange
ChangeCipherSpec
Finished ChangecipherSpec
Finished
DATA 270
315
TLS with Session Resumption
Client Server
0
45
90
135
180
225
SYN
ClientHello
SYN ACK
ACK
ServerHello
ChangecipherSpec
Finished
ChangeCipherSpec
Finished
DATA
270
315
TLS → HSTS
HSTS = HTTP Strict Transport Security
Remembers that a site is SSL-only
Prevents users from going to http:// then redirected to https://
Prevents leaking of session cookies over unsecured wifi
HTTP
It’s what we use every day ;-)
There’s “new” version : HTTP/2
Developed by Google as SPDY
Designed for speed
Multiple simultaneous requests in 1 connection
Binary format (pro : more efficient – con : harder to debug)
TLS/SSL encryption is standard
Built-in prioritization
Server Push
Header compression
Try it out
Deploy it !
Questions ?
Questions ?
Contact
Twitter @wimgtr
Slides http://www.slideshare.net/wimg
E-mail wim@cu.be
Thanks !

Contenu connexe

Tendances

Networking & Socket Programming In Java
Networking & Socket Programming In JavaNetworking & Socket Programming In Java
Networking & Socket Programming In JavaAnkur Agrawal
 
Socket programming-tutorial-sk
Socket programming-tutorial-skSocket programming-tutorial-sk
Socket programming-tutorial-sksureshkarthick37
 
Programming TCP/IP with Sockets
Programming TCP/IP with SocketsProgramming TCP/IP with Sockets
Programming TCP/IP with Socketselliando dias
 
Socket programming in C
Socket programming in CSocket programming in C
Socket programming in CDeepak Swain
 
Java Socket Programming
Java Socket ProgrammingJava Socket Programming
Java Socket ProgrammingVipin Yadav
 
16network Programming Servers
16network Programming Servers16network Programming Servers
16network Programming ServersAdil Jafri
 
Application Layer and Socket Programming
Application Layer and Socket ProgrammingApplication Layer and Socket Programming
Application Layer and Socket Programmingelliando dias
 
Socket programming using C
Socket programming using CSocket programming using C
Socket programming using CAjit Nayak
 
HTTPS: All you need to know
HTTPS: All you need to knowHTTPS: All you need to know
HTTPS: All you need to knowOVHcloud
 

Tendances (20)

Networking & Socket Programming In Java
Networking & Socket Programming In JavaNetworking & Socket Programming In Java
Networking & Socket Programming In Java
 
Socket Programming
Socket ProgrammingSocket Programming
Socket Programming
 
Os 2
Os 2Os 2
Os 2
 
Socket programming-tutorial-sk
Socket programming-tutorial-skSocket programming-tutorial-sk
Socket programming-tutorial-sk
 
Socket Programming
Socket ProgrammingSocket Programming
Socket Programming
 
Arduino práctico ethernet
Arduino práctico   ethernetArduino práctico   ethernet
Arduino práctico ethernet
 
Programming TCP/IP with Sockets
Programming TCP/IP with SocketsProgramming TCP/IP with Sockets
Programming TCP/IP with Sockets
 
Socket programming in C
Socket programming in CSocket programming in C
Socket programming in C
 
Java Socket Programming
Java Socket ProgrammingJava Socket Programming
Java Socket Programming
 
16network Programming Servers
16network Programming Servers16network Programming Servers
16network Programming Servers
 
Elementary TCP Sockets
Elementary TCP SocketsElementary TCP Sockets
Elementary TCP Sockets
 
Network Sockets
Network SocketsNetwork Sockets
Network Sockets
 
Application Layer and Socket Programming
Application Layer and Socket ProgrammingApplication Layer and Socket Programming
Application Layer and Socket Programming
 
Ppt of socket
Ppt of socketPpt of socket
Ppt of socket
 
Java sockets
Java socketsJava sockets
Java sockets
 
Socket programming using C
Socket programming using CSocket programming using C
Socket programming using C
 
Lecture10
Lecture10Lecture10
Lecture10
 
socket programming
socket programming socket programming
socket programming
 
Socket programming in c
Socket programming in cSocket programming in c
Socket programming in c
 
HTTPS: All you need to know
HTTPS: All you need to knowHTTPS: All you need to know
HTTPS: All you need to know
 

En vedette

The Progressive Web and its New Challenges - Confoo Montréal 2017
The Progressive Web and its New Challenges - Confoo Montréal 2017The Progressive Web and its New Challenges - Confoo Montréal 2017
The Progressive Web and its New Challenges - Confoo Montréal 2017Christian Heilmann
 
Refactoring vers les design patterns pyxis v2
Refactoring vers les design patterns   pyxis v2Refactoring vers les design patterns   pyxis v2
Refactoring vers les design patterns pyxis v2Eric De Carufel
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
Beyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeBeyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeWim Godden
 
Is your code ready for PHP 7 ?
Is your code ready for PHP 7 ?Is your code ready for PHP 7 ?
Is your code ready for PHP 7 ?Wim Godden
 
Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Wim Godden
 
Let's (not) get rid of all the managers!
Let's (not) get rid of all the managers!Let's (not) get rid of all the managers!
Let's (not) get rid of all the managers!Julia Wester
 
Practical git for developers
Practical git for developersPractical git for developers
Practical git for developersWim Godden
 
Refactoring to Design Patterns
Refactoring to Design PatternsRefactoring to Design Patterns
Refactoring to Design PatternsEric De Carufel
 
Designing irresistible APIs
Designing irresistible APIsDesigning irresistible APIs
Designing irresistible APIsKirsten Hunter
 
Designing irresistible apis
Designing irresistible apisDesigning irresistible apis
Designing irresistible apisKirsten Hunter
 
Make Your API Irresistible
Make Your API IrresistibleMake Your API Irresistible
Make Your API Irresistibleduvander
 
Designing irresistible apis
Designing irresistible apisDesigning irresistible apis
Designing irresistible apisKirsten Hunter
 
What Your Database Query is Really Doing
What Your Database Query is Really DoingWhat Your Database Query is Really Doing
What Your Database Query is Really DoingDave Stokes
 
Object Relational Mapping in PHP
Object Relational Mapping in PHPObject Relational Mapping in PHP
Object Relational Mapping in PHPRob Knight
 
Microservices Minus the Hype: How to Build and Why
Microservices Minus the Hype: How to Build and WhyMicroservices Minus the Hype: How to Build and Why
Microservices Minus the Hype: How to Build and WhyMark Heckler
 
Tips on solving E_TOO_MANY_THINGS_TO_LEARN with Kubernetes
Tips on solving E_TOO_MANY_THINGS_TO_LEARN with KubernetesTips on solving E_TOO_MANY_THINGS_TO_LEARN with Kubernetes
Tips on solving E_TOO_MANY_THINGS_TO_LEARN with KubernetesBen Hall
 
Containerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS LambdaContainerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS LambdaRyan Cuprak
 

En vedette (20)

The Progressive Web and its New Challenges - Confoo Montréal 2017
The Progressive Web and its New Challenges - Confoo Montréal 2017The Progressive Web and its New Challenges - Confoo Montréal 2017
The Progressive Web and its New Challenges - Confoo Montréal 2017
 
Refactoring vers les design patterns pyxis v2
Refactoring vers les design patterns   pyxis v2Refactoring vers les design patterns   pyxis v2
Refactoring vers les design patterns pyxis v2
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
Microservices
MicroservicesMicroservices
Microservices
 
Beyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeBeyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the code
 
Is your code ready for PHP 7 ?
Is your code ready for PHP 7 ?Is your code ready for PHP 7 ?
Is your code ready for PHP 7 ?
 
Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011
 
Let's (not) get rid of all the managers!
Let's (not) get rid of all the managers!Let's (not) get rid of all the managers!
Let's (not) get rid of all the managers!
 
Practical git for developers
Practical git for developersPractical git for developers
Practical git for developers
 
Api 101
Api 101Api 101
Api 101
 
Refactoring to Design Patterns
Refactoring to Design PatternsRefactoring to Design Patterns
Refactoring to Design Patterns
 
Designing irresistible APIs
Designing irresistible APIsDesigning irresistible APIs
Designing irresistible APIs
 
Designing irresistible apis
Designing irresistible apisDesigning irresistible apis
Designing irresistible apis
 
Make Your API Irresistible
Make Your API IrresistibleMake Your API Irresistible
Make Your API Irresistible
 
Designing irresistible apis
Designing irresistible apisDesigning irresistible apis
Designing irresistible apis
 
What Your Database Query is Really Doing
What Your Database Query is Really DoingWhat Your Database Query is Really Doing
What Your Database Query is Really Doing
 
Object Relational Mapping in PHP
Object Relational Mapping in PHPObject Relational Mapping in PHP
Object Relational Mapping in PHP
 
Microservices Minus the Hype: How to Build and Why
Microservices Minus the Hype: How to Build and WhyMicroservices Minus the Hype: How to Build and Why
Microservices Minus the Hype: How to Build and Why
 
Tips on solving E_TOO_MANY_THINGS_TO_LEARN with Kubernetes
Tips on solving E_TOO_MANY_THINGS_TO_LEARN with KubernetesTips on solving E_TOO_MANY_THINGS_TO_LEARN with Kubernetes
Tips on solving E_TOO_MANY_THINGS_TO_LEARN with Kubernetes
 
Containerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS LambdaContainerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS Lambda
 

Similaire à Your app lives on the network - networking for web developers

Your app lives on the network - networking for web developers
Your app lives on the network - networking for web developersYour app lives on the network - networking for web developers
Your app lives on the network - networking for web developersWim Godden
 
16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)Jeff Green
 
CCNA Interview.pdf
CCNA Interview.pdfCCNA Interview.pdf
CCNA Interview.pdfhoang971
 
Computer network (12)
Computer network (12)Computer network (12)
Computer network (12)NYversity
 
Clase 1 Direccionamiento IPv4.pdf
Clase 1 Direccionamiento IPv4.pdfClase 1 Direccionamiento IPv4.pdf
Clase 1 Direccionamiento IPv4.pdfFERNANDOBONILLA43
 
Training Day Slides
Training Day SlidesTraining Day Slides
Training Day Slidesadam_merritt
 
Chapter 01 - Overview
Chapter 01 - OverviewChapter 01 - Overview
Chapter 01 - Overviewphanleson
 
Aspects Stratégiques des Réseaux
Aspects Stratégiques des RéseauxAspects Stratégiques des Réseaux
Aspects Stratégiques des RéseauxEric Vyncke
 
2 logical addressing
2 logical addressing2 logical addressing
2 logical addressinggafurov_x
 
Chapter_3_Networking.ppt
Chapter_3_Networking.pptChapter_3_Networking.ppt
Chapter_3_Networking.pptBlaqray1998
 
Chapter_3_Networking.ppt
Chapter_3_Networking.pptChapter_3_Networking.ppt
Chapter_3_Networking.pptBlaqray1998
 

Similaire à Your app lives on the network - networking for web developers (20)

Your app lives on the network - networking for web developers
Your app lives on the network - networking for web developersYour app lives on the network - networking for web developers
Your app lives on the network - networking for web developers
 
16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)
 
CCNA Interview.pdf
CCNA Interview.pdfCCNA Interview.pdf
CCNA Interview.pdf
 
Computer network (12)
Computer network (12)Computer network (12)
Computer network (12)
 
IPAddressing .pptx
IPAddressing .pptxIPAddressing .pptx
IPAddressing .pptx
 
Networking basics
Networking basicsNetworking basics
Networking basics
 
TCP/IP Basics
TCP/IP BasicsTCP/IP Basics
TCP/IP Basics
 
QSpiders - Upper layer-protocols
QSpiders - Upper layer-protocolsQSpiders - Upper layer-protocols
QSpiders - Upper layer-protocols
 
6005679.ppt
6005679.ppt6005679.ppt
6005679.ppt
 
Intro to Ethernet
Intro to EthernetIntro to Ethernet
Intro to Ethernet
 
Clase 1 Direccionamiento IPv4.pdf
Clase 1 Direccionamiento IPv4.pdfClase 1 Direccionamiento IPv4.pdf
Clase 1 Direccionamiento IPv4.pdf
 
Training Day Slides
Training Day SlidesTraining Day Slides
Training Day Slides
 
Network.pptx
Network.pptxNetwork.pptx
Network.pptx
 
Internetworking
InternetworkingInternetworking
Internetworking
 
Chapter 01 - Overview
Chapter 01 - OverviewChapter 01 - Overview
Chapter 01 - Overview
 
Aspects Stratégiques des Réseaux
Aspects Stratégiques des RéseauxAspects Stratégiques des Réseaux
Aspects Stratégiques des Réseaux
 
2 logical addressing
2 logical addressing2 logical addressing
2 logical addressing
 
Chapter_3_Networking.ppt
Chapter_3_Networking.pptChapter_3_Networking.ppt
Chapter_3_Networking.ppt
 
Chapter_3_Networking.ppt
Chapter_3_Networking.pptChapter_3_Networking.ppt
Chapter_3_Networking.ppt
 
More on Tcp/Ip
More on Tcp/IpMore on Tcp/Ip
More on Tcp/Ip
 

Plus de Wim Godden

Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
Bringing bright ideas to life
Bringing bright ideas to lifeBringing bright ideas to life
Bringing bright ideas to lifeWim Godden
 
The why and how of moving to php 8
The why and how of moving to php 8The why and how of moving to php 8
The why and how of moving to php 8Wim Godden
 
The why and how of moving to php 7
The why and how of moving to php 7The why and how of moving to php 7
The why and how of moving to php 7Wim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websocketsWim Godden
 
Bringing bright ideas to life
Bringing bright ideas to lifeBringing bright ideas to life
Bringing bright ideas to lifeWim Godden
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe why and how of moving to php 7.x
The why and how of moving to php 7.xWim Godden
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe why and how of moving to php 7.x
The why and how of moving to php 7.xWim Godden
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous phpWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 

Plus de Wim Godden (20)

Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Bringing bright ideas to life
Bringing bright ideas to lifeBringing bright ideas to life
Bringing bright ideas to life
 
The why and how of moving to php 8
The why and how of moving to php 8The why and how of moving to php 8
The why and how of moving to php 8
 
The why and how of moving to php 7
The why and how of moving to php 7The why and how of moving to php 7
The why and how of moving to php 7
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websockets
 
Bringing bright ideas to life
Bringing bright ideas to lifeBringing bright ideas to life
Bringing bright ideas to life
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe why and how of moving to php 7.x
The why and how of moving to php 7.x
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe why and how of moving to php 7.x
The why and how of moving to php 7.x
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous php
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 

Dernier

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Dernier (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Your app lives on the network - networking for web developers

  • 1. Wim Godden Cu.be Solutions @wimgtr Your app lives on a network Networking for web developers
  • 2. Who am I ? Wim Godden (@wimgtr)
  • 11. Belgium – the traffic
  • 12. Who am I ? Wim Godden (@wimgtr) Founder of Cu.be Solutions (http://cu.be) Open Source developer since 1997 Developer of PHPCompatibility, OpenX, Nginx SLIC, ... Speaker at PHP and Open Source conferences
  • 13. Who are you ? Developers ? System engineers ? Network engineers ? Do you know how the Internet works ?
  • 14. We’re web developers, not network engineers ! Know enough to build new stuff Know enough to maintain existing code What if... Customer Support Desk Developers
  • 15. Do you know these ? TCP UDP IP DNS BGP MAC address IPv4 IPv6 SYN ACK Source port Destination port Default gateway Routing table
  • 16. Basics : OSI model Physical Layer 1 Data Link Layer 2 Network Layer 3 Transport Layer 4 Session Layer 5 Presentation Layer 6 Application Layer 7 Wires, network card, wireless interface Data protocol (ethernet, ...) IP adressing TCP, UDP, ports, ... TLS, L2TP, SOCKS, PPTP, ... Serialization, data translation HTTP, DNS, SMTP, ...
  • 17. Basics : packets 01011010111010 Physical cable or wireless 01011010111010
  • 18. Basics : packets Destination MAC (6 bytes) Source MAC (6 bytes) Type (2 bytes) Payload (46 – 1500 bytes) CRC (4 bytes) Part 1 : Ethernet frame 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31 0 Version Header length DSCP ECN Total length 32 Identification Flags Fragment Offset 64 Time To Live Protocol Header Checksum 96 Source IP Address 128 Destination IP Address 160 Options (if required) < Contents of the packet > Part 2 : IPv4 header (min. 160 bytes) Part 3 : TCP/UDP/… header and data
  • 19. Basics : TCP packet Bit 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31 0 Source port Destination port 32 Sequence number 64 Acknowledgment number 96 Data offset Flags Window size 128 Checksum Urgent pointer 160 Options (if required) < Contents of the packet >
  • 20. Basics : packets Destination MAC (6 bytes) Source MAC (6 bytes) Type (2 bytes) Payload (46 – 1500 bytes) CRC (4 bytes) Part 1 : Ethernet frame
  • 21. Sending on a local network Each system has a MAC address Assigned by manufacturer Can be overwritten (for VM or failover) Same physical network → send packet to MAC address Switch knows MAC address(es) of devices and forwards traffic Layer 2
  • 22. Sending IP traffic on local network Requires IP addresses Where to send ? We need to know MAC address Uses ARP (Address Resolution Protocol) for lookup Stores IP ↔ MAC relation in ARP table What’s “local” ? → Same IP subnet OK, what’s a subnet ? Layer 3 16:58:56.933019 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.0.15 tell 192.168.0.12, length 28 16:58:56.938019 ARP, Ethernet (len 6), IPv4 (len 4), Reply 192.168.0.15 is-at 00:50:56:8b:6a:b7, length 46
  • 23. IP adressing (IPv4) IPv4 adressing = CIDR notation xxx.xxx.xxx.xxx where 0 <= xxx <= 255 0.0.0.0 → 255.255.255.255 Total amount of IP addresses available : 256 * 256 * 256 * 256 = 28 * 28 * 28 * 28 = 232 = 4.3 billion Subnet = range of IP addresses 192.168.0.0 → 192.168.0.255 Typical notation uses a “mask” : 192.168.0.0 → 192.168.0.255 = 192.168.0.0/24 IPv4 provides 232 addresses A /24 mask gives 2(32-24) or 28 addresses = 256 addresses Local networks : 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16
  • 24. Sending IP traffic on local network Client 192.168.0.15/24 Server 192.168.0.2/24 MAC for 192.168.0.2 ? AA:BB:CC:DD:EE:FF Let’s talk !
  • 25. Sending IP traffic to remote device Requires IP addresses Where to send ? Can not use ARP : MAC addresses are not shared beyond local network Uses default gateway Provided by DHCP or Set statically Must be on same subnet → address found in ARP table Layer 3
  • 26. Sending IP traffic to remote device Requires IP addresses Where to send ? Can not use ARP : MAC addresses are not shared beyond local network Uses default gateway Provided by DHCP or Set statically Must be on same subnet → address found in ARP table Layer 3 Client Router ServerInternet 192.168.0.15 192.168.0.1 194.7.1.4 Default gateway MAC for 192.168.0.1 ? AA:BB:CC:DD:EE:FF Destination : AA:BB:CC:DD:EE:FF Contents : TCP packet to 194.7.1.4 See ARP table : arp -a See default gateway : route -n (Lin) route print (Win)
  • 27. Basics : TCP packet Bit 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31 0 Source port Destination port 32 Sequence number 64 Acknowledgment number 96 Data offset Flags Window size 128 Checksum Urgent pointer 160 Options (if required) < Contents of the packet >
  • 28. Establishing a TCP connection Client Server SYN SYN ACK ACK Data Sequence no = 1002 Acknowledge no = 9001 Sequence no = 1000 Sequence no = 1001 Acknowledge no = 9000
  • 29. Establishing a TCP connection Client Server SYN SYN ACK ACK Data Sequence no = 1002 Acknowledge no = 9001 Sequence no = 1000 Sequence no = 1001 Acknowledge no = 9000 Brussels Montreal45ms 0 45 90 135
  • 30. Establishing a TCP connection Client Server SYN SYN ACK ACK Data Sequence no = 1002 Acknowledge no = 9001 Sequence no = 1000 Sequence no = 1001 Acknowledge no = 9000 Brussels Montreal45ms 0 45 90 135 London10ms 10 20 30
  • 31. TCP Window Size Client Server Brussels Montreal SYN SYN ACK rwnd = 8192 rwnd = 8192 rwnd = 16384 ACK DATA sysctl net.ipv4.tcp_window_scaling
  • 32. TCP Slow Start Client Server Brussels Montreal45ms 0 45 90 135 180 225
  • 33. TCP Slow Start Client Server Brussels Montreal45ms 0 45 90 135 180 225
  • 34. New vs existing connection Client Server Brussels Montreal45ms 0 45 90 135 280 325 SYN SYN ACK ACK DATA (x8) ACK (x4) GET /url DATA (x4) ACK (x8) 370 415 Processing request 235
  • 35. New vs existing connection Client Server GET /url Brussels Montreal45ms 0 45 145 180 DATA DATA (x12) ACK (x12) Processing request 225
  • 36. TCP Performance Upgrade to latest Linux kernel or OS Check window size Reduce latency (move servers closer to client) Reuse already established connections
  • 37. UDP User Datagram Protocol Unreliable Datagram Protocol Connectionless → No 3-way handshake required Simple packet structure Packets might not arrive Packets might arrive out of order Ideal for streaming, gaming, ... Bit 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31 0 Source port Destination port 32 Length Checksum < Contents of the packet >
  • 38. TCP/UDP ports Bit 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31 0 Source port Destination port 32 Sequence number 64 Acknowledgment number 96 Data offset Flags Window size 128 Checksum Urgent pointer 160 Options (if required) < Contents of the packet > Bit 0-3 4-7 8-11 12-15 16-19 20-23 24-27 28-31 0 Source port Destination port 32 Length Checksum < Contents of the packet > TCP UDP
  • 39. Source and Destination ports Destination port : defined by service HTTP : TCP port 80 HTTPS : TCP port 443 DNS : UDP port 53 Source port : for identification of a connection Client Server 80 80 80 5000 5001 5002 See active connections with source/destination ports : netstat -n
  • 40. Fetching a website Need to fetch http://cu.be TCP doesn’t know what cu.be is → needs an IP address Looks up IP address through DNS Open a socket Connect to IP address on port 80 Send HTTP request over the connection Get data back Get images, CSS, javascript over the same connection Close the connection Show the webpage
  • 41. DNS lookups Through a DNS server Authoritative : in charge of the domain name Recursive : asks the authoritative server, then caches for a while → Cache time is defined by TTL Usually you will use a recursive server (owned by your provider) Client Recursive DNS Server IP for cu.be ? Root DNS server IP for cu.be ? .be DNS server cu.be DNS server Ask the .be DNS server IP for cu.be ?Ask the cu.beDNS server IP forcu.be ?194.50.97.38 194.50.97.38
  • 42. DNS lookups Actual lookups depend on type of DNS record DNS holds lots of things : A record = IP addresses CNAME records = aliases for A records MX records = mail servers NS records = DNS servers TXT = various stuff (anti-spam mostly) 2 tools to debug DNS : dig nslookup
  • 43. Sockets The layer between your application and TCP, UDP, ... Abstracts syntax Makes it easy to switch between protocols Provides an easy interface No need to know implementation Send a stream of data → split up in packets Receive lots of data → converted from packets to string
  • 44. Packets over the Internet Client Router ServerInternet 192.168.0.15 192.168.0.1 194.7.1.4 BGP protocol decides how packets are routed Each public network has AS (Autonomous System) number AS3356 = Level3 AS39628 = Cu.be BGP announces subnets over BGP to its uplink providers : “AS39628 here… you can reach 194.50.97.0/24 through me”
  • 46. BGP routing Router AS 1 Router AS 5 Router AS 5 Router AS 52 Router AS 10 Router AS 2 Client Server
  • 47. IPv6 Created to solve lack of IP addresses (4.3 billion in IPv4) Standard created in 90s Deployed on most major sites, but small sites behind Addresses : IPv4 address : 192.168.0.1 IPv6 address : 2001:0db8:0000:0000:0000:0000:0370:7334 Abbreviated : 2001:0db8::0370:7334 Can’t talk to eachother ! Address space : 2128 = 340,282,366,920,938,463,463,374,607,431,770,000,000 Deployment rates (source : Google) : Global : 13.12% US : 29.78% Canada : 16.58% Belgium : 48.42% Should you use it ? YES ! (But don’t forget about firewalling !)
  • 49. TLS with Session Resumption Client Server 0 45 90 135 180 225 SYN ClientHello SYN ACK ACK ServerHello ChangecipherSpec Finished ChangeCipherSpec Finished DATA 270 315
  • 50. TLS → HSTS HSTS = HTTP Strict Transport Security Remembers that a site is SSL-only Prevents users from going to http:// then redirected to https:// Prevents leaking of session cookies over unsecured wifi
  • 51. HTTP It’s what we use every day ;-) There’s “new” version : HTTP/2 Developed by Google as SPDY Designed for speed Multiple simultaneous requests in 1 connection Binary format (pro : more efficient – con : harder to debug) TLS/SSL encryption is standard Built-in prioritization Server Push Header compression Try it out Deploy it !