vpn tunnels - santa monica collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 packet...

21
1 VPN Tunnels David Morgan Tunnel within a network A B C D E F G H I - Packet stream of protocol X - Packet stream of protocol Y - Packet stream: “X over Y” or “X tunneled in/through Y”

Upload: dinhkhue

Post on 28-Jun-2019

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

1

VPN Tunnels

David Morgan

Tunnel within a network

A

B

C

D

E

F

G

H I

- Packet stream of protocol X

- Packet stream of protocol Y

- Packet stream: “X over Y” or “X tunneled in/through Y”

Page 2: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

2

Packet encapsulationto implement tunneling

� Two (or more) packets of adjacent network layers

� Packet belonging to one layer appears as freight carried by (encapsulated in) packet of next lower layer

� The higher level protocol tunnels “over” the lower

A packet to be tunneled

Source Address Destination Address

Data Payload

Page 3: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

3

Tunnel packet

Tunnel

Source Address

Tunnel

Destination Address

Source Address Destination Address

Data Payload

Tunnel

packet’s

payload is

a(nother)

packet

Tunnel

Header

X over Y tunneling

Tunnel

Source Address

Tunnel

Destination Address

Source Address Destination Address

Data Payload

Tunnel

Header

Packet of protocol X

Packet of protocol Y

Page 4: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

4

Another way to draw it …

low-levelheader

mid-levelheader

high-levelheader

payload/cargo/freight protocol X

protocol Y

protocol Z

Layer 2 tunneling

� Payloadis a data link layer (layer 2) frame

� Examples– PPTP

– L2F

– L2TP

– piggybacks somebody else’s wire (eg, internet)

Page 5: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

5

Layer 3 tunneling

� Payloadis a network layer (layer 3) frame

� Examples– IP-over-IP

– SSH port forwarding

– IPSec

Encapsulation vs tunneling

� if outer packet is next-lower layer from inner, it’s normal encapsulation

� tunneling involves some other layer combination

Page 6: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

6

Tunneling layer-matchup types

IP-over-IP

IPSec

SSH port forwarding

PPTP

L2F

L2TP

3

normal (non-tunnel) encapsulation*

PPPoE2

32

inner packet layeroute

r pac

ket

layer 2 tunneling layer 3 tunneling •IP in Ethernet

•IP in PPP, or

•UDP or TCP in IP

•HTTP in TCP

•DNS in UDP

*examples:

Uses of tunneling

� Bridge protocols over domain where they are illegal

� Bridge addresses over domain where they are illegal

� Apply common services to multiple traffic flows

Page 7: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

7

Tunneling ‘illegal’ protocolsIPX Network A IPX Network B

IP Network C

Tunneling ‘illegal’ protocols

Page 8: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

8

Tunneling ‘illegal’ IPX over IP

IPX Network A IPX Network B

IP Network C

(e.g. the internet)

IP Network C

Tunneling ‘illegal’ addressesPrivate IP Network A Private IP Network B

Page 9: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

9

Tunneling ‘illegal’ privateIP over IP

IP Network A

(e.g. the internet)

Private IP Network A Private IP Network B

Applying common services

IPX Network A IPX Network B

IP Network C

(e.g. the internet)

crypto

applied

crypto

applied(to entire tunnel)

Page 10: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

10

Common “common services”

� Data integrity– ensuring what’s received is undistorted

� Confidentiality– ensuring illegibility en route

Achieved at packet level

� Messages are split into packets

� Rendering service to message means applying it to each packet

Page 11: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

11

Data integrity – provided?

IP Header Format

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

|Version| IHL |Type of Service| Total Length |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Identification |Flags| Fragment Offset |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Time to Live | Protocol | Header Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Source Address |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Destination Address |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Options | Padding |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Data integrity – provided?

TCP Header Format

0 1 2 3

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Source Port | Destination Port |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Sequence Number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Acknowledgment Number |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Data | |U|A|P|R|S|F| |

| Offset| Reserved |R|C|S|S|Y|I| Window |

| | |G|K|H|T|N|N| |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Checksum | Urgent Pointer |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Options | Padding |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| data |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Page 12: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

12

IP & TCP checksums

� … assure integrity of packet

� … but nothing assures these checksums’ own integrity

… Virginia Department of Motor Vehicles syndrome… never mind.

� also…checksum algorithm “not sufficiently collision resistant” (many messages get same checksum)

IP & TCP checksums

� Standard checksums based on message only

C = f ( M )

hacker intercepts message

hacker alters message

hacker alters checksum correspondingly

� Message authentication based on message plus key

C = f ( M, K )

hacker intercepts message

hacker alters message

hacker can’t produce corresponding checksum for lack of key

Page 13: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

13

Confidentiality

� Achieved by encryption here …

� … and decryption over there.

� usually with symmetric algorithms for efficiency

Layer 2 tunneling - ppp over IP

� PPP’s design purpose: encapsulate layer 3– put IP packets into PPP frames

� Why encapsulate PPP over IP?– put PPP frames into IP packets

Page 14: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

14

Why encapsulate PPP over IP?

� Why not? (as long as you independently have IP working already)

� Economics

PPP data frame format

flagcontroladdressflag

01111110checkinfoprotocol000000111111111101111110

12 or 4variable1 or 2111 byte

a packet of the protocol identified in “protocol”info

the protocol to which “info”s content belongs (numeric id)

protocole.g., maybe

an IP packet

Page 15: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

15

Dial-up applies ppp to phoneline

Dial-in/Remote-access

Client

Dial-in/Remote-access

Server

ppp

Example: ISPs

ISP

ppp

customer

the internet

Page 16: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

16

Example: corporate networks

company’s

remote

access

server

ppp

employee

company

network

Example: corporate networks

modem

bank

road warrior

company

network

Los Angeles New York

Page 17: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

17

Economic disadvantages

modem

bank

road warrior

company

network

Los Angeles New York

Economic problems of dial-in

� Equipment/maintenance of many modems

� Regular, multiple long-distance phone charges

Page 18: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

18

Layer 2 tunneling - ppp over IP

� PPTP –PointToPoint Tunneling Protocol– Microsoft, Ascend, U.S. Robotics

� L2F –Layer 2 Forwarding Protocol– Cisco, Northern Telecom, Shiva

� L2TP – Layer 2 Tunneling Protocol– IETF, blending of PPTP & L2F features

Dialing in with layer 2 tunneling

Page 19: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

19

Dialing in with PPTP

PPTP encapsulation

Page 20: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

20

L2TP – finding roomfor improvement

� Voluntary mode – tunnel endpoint coincident with client

� Compulsory mode – tunnel endpoints at ISPs

A common weak point

� PPTP – security

� L2F – security

� L2TP - security

Page 21: VPN Tunnels - Santa Monica Collegehomepage.smc.edu/morgan_david/linux/tunnels-ch4-n.pdf · 2 Packet encapsulation to implement tunneling Two (or more) packets of adjacent network

21

Layer 3 tunnelingexample: IP over IP

IPheader 2

IP

header 1

payload

layer 3

layer 3

IPheader 2

IP

header 1

payload

layer 3extra

“security”header

Layer 3 tunnelingexample: IPsec

layer 3