06_vpn
06_vpn
Introduction
• Networks primarily intended for internal use are
called private network.
IP Tunneling
IP Tunneling
Traffics
Tunnel End A inside the Tunnel End B
tunnel are
protected The tunnel goes
through a public
network, such as
the Internet.
IPSec Tunneling
TLS/SSL
Tunneling
(we will focus
on this type)
An Overview of How TLS/SSL VPN Works
Question: How can the This is just a normal TCP or
Tunnel application get an IP UDP based SSL connection
packet?
TUN/TAP Interface
• Question: How can
the Tunnel
application get an IP
Socket
Interface
packet?
– Typically, applications
interact with kernel
using socket
– Using socket, kernel
only gives the data
part of a packet to
applications
– Applications need to
use a different way
to interact with
kernel
TUN/TAP Interface
• Most operating systems have two types of network
interfaces:
– Physical: Corresponds to the physical Network Interface Card (NIC)
– Virtual: It is a virtualized representation of computer network interfaces
that may or may not correspond directly to the NIC card. Example: loopback
device
Routing
packets to
the tunnel
Set UP the Routing
Note: the encryption step is omitted from the code (for the sake of simplicity)
Implementation (Socket TUN)
Note: the decryption step is omitted from the code (for the sake of
simplicity)
Implementation (Monitoring the 2
Interfaces)
select() will be
blocked until one of the
interfaces has data.
Case Study: Configuring a VPN
Configure VPN Server
• On VPN Server, we first run the server program.
• Configure the tun0 interface.
– We use 10.4.2.0/24 as IP prefix for the TUN interface (for
both VPN Client and VPN Server)
• The following two commands assign the IP address to
the tun0, bring it up and then add a corresponding
route to routing table.
Configure VPN Client
• The reply packets should go back via the same VPN tunnel,
so that they are protected.
• To ensure that, route all packets for the 10.4.2.0/24
network toward the tunnel.
• For Host V, we route such packets to VPN Server.
• Add the following routing entry to Host V:
Testing VPN: ping Testing
• Ping Host V from Host U and we see the following result:
Observation: the telnet connection is not broken. TCP will keep resending packets, but
they cannot be delivered because the tunnel is broken. Whatever we type in telnet will
be buffered by TCP, not lost, but we can’t see anything. As soon as we reconnect the
tunnel, everything that we have typed will show up.
Bypassing Firewalls using VPN
Bypassing Firewall using VPN: the Main
Idea
• Send our Facebook-bound packets to the TUN interface towards VPN server
• VPN server will release our Facebook-bound packets to the Internet
• Facebook’s reply packets will be routed to the VPN server (question: why)
• VPN server sends the reply packets back to us via the tunnel
Experiment: Network Setup
Setting UP Firewall
• Setup firewall to block User from accessing Facebook
• We run the following command to get the list of IP prefixes
owned by Facebook: