21
VPNs and NAT Literature: Forouzan: TCP/IP Protocol Suite : Ch 26 Internetworking

VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

  • Upload
    lamminh

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

Page 1: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

VPNs and NAT

Literature:Forouzan: TCP/IP Protocol Suite : Ch 26

Int ernet w orking

Page 2: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

Private Networks

● Designed to be used within an organization● Access to shared resources● Provides privacy● Intranet

– Access to network limited to users within the organization● Extranet

– Some resources may be accessed by specific users outside the organization.

● Addressing– Global addresses

● Future proof - but are not accessible– Private addresses

● Need NAT to access Internet

Page 3: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

Motivation and challenges for VPNs● To build a long distance private network by leased lines is

expensive● Could the same service be offered on top of a public network

(Internet)?● This would be cheaper

– Existing infrastructure can be re-used

● But to build a VPN we need to address:

– Privacy● others cannot see our data

– Addressing and routing● Internal addresses used within private networks

● External addresses used on the Internet

Page 4: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

Tunneling and Privacy

● Encapsulate the private datagram within another datagram● Privacy: encrypt the private datagram ● Problem: Who can you trust to encrypt the data?

– only yourself

– the ISP providing the VPN

– some third party

Page 5: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

Addressing

● The Internet carries the tunneled datagram from R1 to R2 using public addressing

● R1 encapsulates, R2 decapsulates● Public versus private addressing

Page 6: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

VPN Architecture 1

Connect hosts to cen tral server.

Internet

Point -to-pointtunnels

MainLAN

Page 7: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

VPN Architecture 2

Connect several LAN “islands”.

Internet

IP/ Ipsec Tunnels/MPLS pathsVirtual Rout ing

LAN LAN

LAN

Page 8: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

L3 VPN

● LANs connect to a router that routes the datagrams between sites.● IP/IPsec tunnels

– Point-to-point– Full mesh between peers

● Virtual Routing– Separate routing tables – Different address domains

● MPLS/BGP– RFC 2547’’– Set up MPLS point-to-point paths over a network– Good for Traffic Engineering purposes– No need to export customers routing tables into the network

Page 9: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

L2VPN● LAN interconnection may be done by tunneling layer 2 frames (eg

Ethernet) over an (IP) network. Most are point-to-point and for dial-up services

● Layer-2 Forwarding (L2F)● Point-to-point Tunneling Protocol (PPTP)

– In Windows 95/NT

● Layer Two Tunneling Protocol(L2TP)

– RFC 2661

– PPP based

● VPLS

– Virtual Private LAN Services (IETF PPVPN)

– Multi LAN

Page 10: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

Traffic Engineering

● Many VPN services provides ”QoS”

– To ensure service for internal traffic

● Provider wants to guarantee a service to VPN customers.

– No delays

– No packet loss

– Eg Telephony over IP (VoIP or tunneled E1:s)

● Typical solution use MPLS

– Fixed path through a network where resources are allocated

– RSVP-TE● Aggregated traffic with bandwidth guarantees

– OSPF-TE

Page 11: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

Network Address Translation (NAT)● How can we use private addresses and communicate with the

global Internet?● How can we use more addresses than our ISP assigned us?

– We may only get one or a pool of IPv4 addresses

– But we have many local machines

● Solution: IPv6

– Plenty of addresses

● Or NAT/NAPT

Page 12: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

Network Address Translation (NAT)● Internally, there are many hosts with private addresses● But the outside world sees only one global address

– Or a set of global addresses● The NAT router translates between local (private) and global

addresses– Typically use private IPv4 addresses, eg 10.0.0.0/8.– Translate them to global addresses

Internet10.0.0.1 200.24.5.8

10.0.0.2 10.0.0.410.0.0.3

NAT

25.8.2.10

Page 13: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

Address Translation

● Eg, a client accesses a global server● Dynamic table driven from the inside● Outgoing packets

– source private address is replaced by global address

● Incoming packets

– destination global address is replaced by private address

src: 10.0.0.2dst: 25.8.2.10

NAT

NAT binding:10.0.0.2 200.24.5.8

Private

Internet

src: 25.8.2.10dst: 10.0.0.2

src: 200.24.5.8dst: 25.8.2.10

src: 200.24.5.8dst: 25.8.2.10

10.0.0.2

Page 14: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

Extending the mapping: NAPT● One-to-one address mapping may be too restrictive and static● Use the L4 port numbers

● Map local address + port global address + port

● Network Address Port Translation● Extends the address space with 216 port numbers● Limited to TCP/UDP● Some problems with other protocols and applications

Page 15: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

NAPT Example

src: 10.0.0.2:1400dst: 25.8.2.10:80

NAT

NAT binding:10.0.0.2:1400 200.24.5.8:2100

Private Internet

src: 25.8.2.10:80dst: 10.0.0.2:1400

src: 200.24.5.8:2100dst: 25.8.2.10:80

src: 25.8.2.10:80dst: 200.24.5.8:2100

Page 16: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

NAPT to access internal servers● Servers on the inside needs to be accessed from the outside.

– ssh server at 10.0.0.5

– http server at 10.0.0.3 (port 8080)

InternetPrivate

http server, 10.0.0.3:8080

NAPT

ssh server, 10.0.0.5:22

NAT binding:10.0.0.3:8080 200.24.5.8:80

10.0.0.5:22 200.24.5.8:22

Page 17: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

Rewriting of header

source port num ber dest inat ion port num ber

TCP checksum urgent pointer

sequence num ber

acknowledgem ent num ber

window sizeflagsreservedheaderlength

src addr

dst addr

header checksumprotocolt t l

fragment fieldsident ificat ion

total lengthtoshlenversion

Example: TCP packet sent from inside to outside

Page 18: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

But NATs also filter addresses

● A NAT has also filtering – to restrict which external peers can communicate with the internal host

● So other peers can use the ”hole” in the NAT opened by an initial communication

● This can be used by peer-to-peer applications to make ”NAT-traversal”– Otherwise, two hosts behind NATs can never communicate

– Important for interactive applications eg VoIP

● Only for UDP– TCP has state (eg sequence numbers) that can not be re-

used

Page 19: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

Full Cone

Full cone – No filtering– 32.4.5.6 can use the entry opened by the access to

25.8.2.10

src: 10.0.0.2:1400dst: 32.4.5.6:80

NAT

NAT binding:10.0.0.2:1400 200.24.5.8:2100

Private Internet

src: 32.4.5.6:80dst: 10.0.0.2:1400

NAT filtering:*:*

25.8.2.10

32.4.5.6

Page 20: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

Symmetric NAT

Symmetric NAT

– 32.4.5.6 can not use the entry

– Only 25.8.2.10:80 is accepted as source address

NAT

NAT binding:10.0.0.2:1400 200.24.5.8:2100

Private Internet

NAT filtering:25.8.2.10:80

25.8.2.10

32.4.5.6

dropped!

Page 21: VPNs and NAT - KTH · Motivation and challenges for VPNs To build a long distance private network by leased lines is expensive Could the same service be offered on top of a public

NAPT and Applications

● Problem: address and ports numbers may also be present in payload

– E.g. FTP and SIP prints the port numbers converted into ASCII in the payload during connection set up

● ICMP

– echo reply: who should get the reply?

– redirect: the gateway (NAT box) has an incorrect route?

– destination unreachable: the payload of the ICMP carries the header from the datagram that could not be delivered.

● Many peer-to-peer applications use special techniques to bypass NAT/NAPT

– Third party

– Overloading of well-known ports, eg port 80

● IPsec breaks

– eg authentication of addresses/ports that are modified