SlideShare a Scribd company logo
Convert your Linux box in to security Gateway Part-2 (VPN)By MurtujaBharmalhttp://null.co.in/http://nullcon.net/
http://null.co.in/http://nullcon.net/About MeNo Work Busy Man….Unemployed….Interest…. /dev/random….Co-founder of null…. :-DX-IBMer …..    Dal, Roti ka jugad, Security Consulting/Training
Prerequisiteshttp://null.co.in/http://nullcon.net/Basic concept of networking/routing/natting.Knowledge of TCP/IP model & communication protocol IP, TCP, UDP, ICMP, DNS, HTTP/S, SMTP, FTP etc. How to Install and use Linux OSSome hands on Linux command line
Full Picturehttp://null.co.in/http://nullcon.net/Security Features of Linux..Hardening OSFirewall Concept/ConfigurationVPN Concept/ConfigurationIDS/IPS Concept/ConfigurationProxy Concept/ConfigurationAntivirus Concept/ConfigurationHardening Services i.e. Web Server/Mail Server/Database etc.
Agenda for TodayWhat is VPNWhy VPNBenefits of VPNTypes of VPNVPN ConceptVPN Configuration – (Openswan)http://null.co.in/http://nullcon.net/
 What is VPN (Misconception)http://null.co.in/http://nullcon.net/
What is VPN (Conceptually)http://null.co.in/http://nullcon.net/
What is VPN (Actually)http://null.co.in/http://nullcon.net/
Why VPNhttp://null.co.in/http://nullcon.net/Business have grown beyond local and regional concern. We now have to worry about global markets and logisticsWe need to get connected efficiently and securely to our offices.Earlier Offices where connected through leased lines, from ISDN to OC3 (Optical Carrier 3 – 155 Mbps) fibre. It proved to be expensive.With the wide use of Internet, it became the medium to connect business together and also connect offices using VPNVPN, in short, is connecting networks together, using a public network. It could connect a mobile user, or a remote office to the head office using the Internet.
Benefits of VPNExtend Geographic connectivityReduce Operational costs versus traditional WANImprove SecurityImprove productivity?Provide global networking opportunityProvide broadband networking compatibilityProvide telecommuter supporthttp://null.co.in/http://nullcon.net/
Types of VPN (Based on Technology)IPSec VPN – IP SecuritySSL VPN – Secure Socket Layer MPLS – Multiprotocol Layering SwitchGRE – Generic Route Encapsulation PPTP – Point-to-Point Tunneling ProtocolL2TP – Layer 2 Tunneling Protocolhttp://null.co.in/http://nullcon.net/
Types of VPN (Based on functionality)Site-to-Site VPNClient-to-Site VPNhttp://null.co.in/http://nullcon.net/
Site-to-Site VPNhttp://null.co.in/http://nullcon.net/Courtesy: http://nirlog.com
Client-to-Site VPNhttp://null.co.in/http://nullcon.net/Courtesy: http://nirlog.com
VPN Concept (Encryption)Translation of data into secret code is called encryptionTo decrypt data you must have access to a secret key or passwordUnencrypted data is called plain textEncrypted data is called cipher texthttp://null.co.in/http://nullcon.net/Courtesy: http://www.webopedia.com
VPN Concept (Encryption)There are two main forms of encryptionSymmetric encryptionEach computer uses a secret key  that it can use to encrypt data. The same key is used to decrypt data too.Public Key encryptionUses a combination of two keys called as private key and public key. The public key is given to everyone. The data is encrypted using the publickey and the privatekey is used to decrypt it.http://null.co.in/http://nullcon.net/Courtesy: http://www.webopedia.com
VPN Concept (HASH)Cryptographic hash functions are used for example to create a message digestA hash function compresses the bits of a messages to a fixed-size hash value in a way that only one hash value is possible for a message.Most widely used hash functions are md5 and sha-1http://null.co.in/http://nullcon.net/Courtesy: http://www.webopedia.com
VPN Concept (IPSec)Why do we need IPSec ?Suite of protocols for securing network connectionsIPSec provides mechanism and not policyYou can decide on any encryption algorithm or authentication method as long as both the connecting parties agreehttp://null.co.in/http://nullcon.net/Courtesy: http://www.unixwiz.net
IP Headerhttp://null.co.in/http://nullcon.net/Courtesy: http://www.unixwiz.net
VPN Concept (IPSec Overview)IPSec, is a framework of open standards (from IETF) that define policies for secure communication in a network. Using IPSec, participating peers (computers or machines) can achieve data confidentiality, data integrity, and data authentication at the network layer The IPsec standard provides a method to manage authentication and data protection between multiple crypto peers engaging in secure data transfer. IPsec includes the Internet Security Association and Key Management Protocol (ISAKMP)/Oakley and two IPsec IP protocols: Encapsulating Security Protocol (ESP) and Authentication Header (AH). IPsec uses symmetrical encryption algorithms for data protection. Symmetrical encryption algorithms are more efficient and easier to implement in hardware. These algorithms need a secure method of key exchange to ensure data protection. Internet Key Exchange (IKE) ISAKMP/Oakley protocols provide this capability.http://null.co.in/http://nullcon.net/Courtesy: http://cisco.comCourtesy: http://ipv6.com
VPN Concept (IPSec Overview)IPSec consists of the following two main protocols:Authentication Header (AH)Encapsulating Security Payload (ESP)http://null.co.in/http://nullcon.net/
VPN Concept (IPSec Mode)•TransportmodeIPsec transport mode works by inserting the ESP or AH header between the IP header and the next protocol or the transport layer of the packet. Both IP addresses of the two network nodes whose traffic is being protected by IPsec are visible in the IP header of the post-encrypted packet.•TunnelmodeTunnel mode works by encapsulating and protecting an entire IP packet. Because tunnel mode encapsulates or hides the IP header of the pre-encrypted packet, a new IP header is added so that the packet can be successfully forwarded. The encrypting devices themselves own the IP addresses used in this new header. Tunnel mode can be employed with either or both IPsec protocols (ESP and AH). Tunnel mode results in additional packet expansion of approximately 20 bytes because of the new IP header. Tunnel mode is widely considered more secure and flexible than transport mode. IPsec tunnel mode encrypts the source and destination IP addresses of the original packet, and hides that information from the unprotected network.http://null.co.in/http://nullcon.net/Courtesy: http://www.unixwiz.net
Optional EncryptionOptional EncryptionOuter IP HeaderInner IP HeaderVPN Concept (Difference in Modes)Original PacketTransport Mode IP HeaderDataOriginal IPHeaderIPSec ESPHeaderDataTunnel Mode New IPHeaderIPSec ESPHeaderDataOriginal IPHeaderhttp://nullcon.net/http://null.co.in/
http://null.co.in/http://nullcon.net/Courtesy: http://www.unixwiz.net
VPN Concept (Security Association)A Security Association (SA) is an agreement between two peers engaging in a crypto exchange. This agreement includes the type and strength of the encryption algorithm used to protect the data. The SA includes the method and strength of the data authentication and the method of creating new keys for that data protection.ISAKMP Security Association (ISAKMP Phase 1)The first phase is a “setup” stage where two devices agree on how to exchange further information securely. This negotiation between the two units creates a security association for ISAKMP itself; an ISAKMP SA. This security association is then used for securely exchanging more detailed information in Phase 2.IPsec Security Associations (ISAKMP Phase 2) Data TunnelIn this phase the ISAKMP SA established in Phase 1 is used to create SAs for othe security protocols. Normally, this is where the parameters for the “real” SAs for the AH and ESP protocols would be negotiated.http://null.co.in/http://nullcon.net/
VPN Concept (Phase 1: Main Mode)http://null.co.in/http://nullcon.net/Courtesy: http://www.eetimes.com
VPN Concept (Phase 1: Aggressive Mode)http://null.co.in/http://nullcon.net/Courtesy: http://www.eetimes.com
VPN Concept (Phase 1: Authentication)IKE phase 1 has three methods to authenticate IPSec peers.1. Pre-Shared Keys (PSK).      2. Public KeyInfrastructure (PKI) using X.509	Digital Certificates.      3. RSA encrypted nonceshttp://null.co.in/http://nullcon.net/
VPN Concept (Phase 2: Quick Mode)http://null.co.in/http://nullcon.net/Courtesy: http://www.eetimes.com
VPN Configuration (OpenSwan)Site-to-Site VPNhttp://null.co.in/http://nullcon.net/5.6.7.8172.16.1.1eth0eth15.6.7.91.2.3.5eth1Office 2 LAN172.16.1.0/24 1.2.3.4eth0192.168.1.1Office 1 LAN192.168.1.0/24
http://null.co.in/http://nullcon.net/VPN Configuration (OpenSwan)Site-to-Site VPN – /etc/ipsec.confCourtesy: http://www.linuxhomenetworking.com
Conn net-to-netauthby=secret #Key exchange methodleft=1.2.3.4leftsubnet =192.168.1.0/24leftnexthope=%defaultrouteright=5.6.7.8rightsubnet=172.16.1.0/24rightnexthope=5.6.7.9auto=start/addhttp://null.co.in/http://nullcon.net/VPN Configuration (OpenSwan)Site-to-Site VPN – /etc/ipsec.confCourtesy: http://www.linuxhomenetworking.com
1.2.3.4 	5.6.7.8 : PSK "nonebutourselvescanfreeourminds"http://null.co.in/http://nullcon.net/VPN Configuration (OpenSwan)Site-to-Site VPN – /etc/ipsec.secretsCourtesy: http://www.linuxhomenetworking.com
net/ipv4/ip_forward = 1iptables -t nat -A POSTROUTING -o eth0 -s 192.168.1.0/24 -d \! 172.16.1.0/24 -j MASQUERADEhttp://null.co.in/http://nullcon.net/VPN Configuration (OpenSwan)Site-to-Site VPN – OthersettingCourtesy: http://www.linuxhomenetworking.com
104 "net-to-net" #1: STATE_MAIN_I1: initiate 106 "net-to-net" #1: STATE_MAIN_I2: sent MI2, expecting MR2 108 "net-to-net" #1: STATE_MAIN_I3: sent MI3, expecting MR3 004 "net-to-net" #1: STATE_MAIN_I4: ISAKMP SA established 112 "net-to-net" #2: STATE_QUICK_I1: initiate 004 "net-to-net" #2: STATE_QUICK_I2: sent QI2, IPsec SA established {ESP=>0xe0bdd0e9 <0x13ac7645}http://null.co.in/http://nullcon.net/VPN Configuration (OpenSwan)Site-to-Site VPN – LogCourtesy: http://www.linuxhomenetworking.com
[root@vpn2 tmp]# netstat -nr Kernel IP routing table Destination        Gateway       Genmask               Flags     MSS      Window   irttIface10.0.0.0 	           0.0.0.0           255.255.255.0     U             40           0                0      eth1 6.25.232.0          0.0.0.0           255.255.255.248 U            40            0                0      eth0 172.16.1.0          1.2.3.4            255.255.255.0     UG          40           0                0      ipsec0tcpdump -n -i ipsec0 icmp03:05:53.971308 IP 192.168.1.5 > 172.16.1.5: icmp 64: echo request seq 89 03:05:53.995297 IP 172.16.1.5 > 192.168.1.5: icmp 64: echo reply seq89tcpdump -n -i eth1 host 5.6.7.8 02:08:23.637149 IP 1.2.3.4 > 5.6.7.8: ESP(spi=0xf4909a7e,seq=0x73) 02:08:24.635302 IP 5.6.7.8 > 1.2.3.4: ESP(spi=0x808e9a87,seq=0x74) http://null.co.in/http://nullcon.net/VPN Configuration (OpenSwan)Site-to-Site VPN – Verification/DebugCourtesy: http://www.linuxhomenetworking.com
Questions?http://null.co.in/http://nullcon.net/
void@null.co.inbharmal.murtuja@gmail.comhttp://null.co.in/http://nullcon.net/Courtesy http://www.wien2k.at

More Related Content

PPTX
IPSec and VPN
PPTX
ip security
PPT
PPT
PPTX
IPSec VPN tunnel
PPT
PPTX
IP Sec - Basic Concepts
IPSec and VPN
ip security
IPSec VPN tunnel
IP Sec - Basic Concepts

What's hot (19)

PPT
IP Security in Network Security NS6
PDF
IPSec VPN Tutorial Part1
PPTX
IPSec VPN & IPSec Protocols
PPTX
IPsec with AH
PPTX
Ipsec 2
PPT
Ip sec and ssl
PPTX
SITE TO SITE IPSEC VPN TUNNEL B/W CISCO ROUTERS
PPT
Overview of ip_security by JetArvind kumar Madhukar
PPT
Ip security
PPT
Ip sec talk
PPTX
IPSec | Computer Network
PPTX
PPTX
IP security
PPTX
IP Security
PDF
IP Security
PPT
IPSec Overview
PDF
BAIT1103 Chapter 6
PPTX
Ip security
IP Security in Network Security NS6
IPSec VPN Tutorial Part1
IPSec VPN & IPSec Protocols
IPsec with AH
Ipsec 2
Ip sec and ssl
SITE TO SITE IPSEC VPN TUNNEL B/W CISCO ROUTERS
Overview of ip_security by JetArvind kumar Madhukar
Ip security
Ip sec talk
IPSec | Computer Network
IP security
IP Security
IP Security
IPSec Overview
BAIT1103 Chapter 6
Ip security
Ad

Viewers also liked (10)

PDF
social media marketing strategy_소셜미디어 마케팅 전략
PPS
National geographicphotos 1
PDF
Plano de Obama para a Saúde por Orlando Cândido dos Passos
PPSX
Reclamacoes
PPS
45 lesons in life
PDF
The Key Course
PPTX
Consumo en Navidad
PPT
Presentacion telework
PPT
Competències bàsiques i xarxes social
PPS
Bpoilspillinthegulfofmexico
social media marketing strategy_소셜미디어 마케팅 전략
National geographicphotos 1
Plano de Obama para a Saúde por Orlando Cândido dos Passos
Reclamacoes
45 lesons in life
The Key Course
Consumo en Navidad
Presentacion telework
Competències bàsiques i xarxes social
Bpoilspillinthegulfofmexico
Ad

Similar to Converting your linux Box in security Gateway Part – 2 (Looking inside VPN) (20)

PPTX
Lec 9.pptx
PDF
IP Security One problem with Internet protocol (IP) is that it has.pdf
PDF
IP security and VPN presentation
PPT
Chapter_4_InternetSecurity.pptChapter_4_InternetSecurity.pptChapter_4_Interne...
PPT
Chapter_4_InternetSecurity.pptChapter_4_InternetSecurity.pptChapter_4_Interne...
PPT
VPN presentation - moeshesh
PPTX
Ip Security.pptx
PPTX
Lan to lan vpn
PPTX
Ipsecurity
PPT
The Security layer
DOCX
Crypto map based IPsec VPN fundamentals - negotiation and configuration
PPT
V P N
DOCX
Certified Ethical Hacker quick test prep cheat sheet
PDF
Lecture14..pdf
PPT
Phifer 3 30_04
DOCX
college assignment on Applications of ipsec
PPTX
Module3 rnbtybtybntrbnbrtrg56g56h6yh6yh7yh5h655PPT.pptx
PPTX
Network security Slides fir bs-13.PPT.pptx
Lec 9.pptx
IP Security One problem with Internet protocol (IP) is that it has.pdf
IP security and VPN presentation
Chapter_4_InternetSecurity.pptChapter_4_InternetSecurity.pptChapter_4_Interne...
Chapter_4_InternetSecurity.pptChapter_4_InternetSecurity.pptChapter_4_Interne...
VPN presentation - moeshesh
Ip Security.pptx
Lan to lan vpn
Ipsecurity
The Security layer
Crypto map based IPsec VPN fundamentals - negotiation and configuration
V P N
Certified Ethical Hacker quick test prep cheat sheet
Lecture14..pdf
Phifer 3 30_04
college assignment on Applications of ipsec
Module3 rnbtybtybntrbnbrtrg56g56h6yh6yh7yh5h655PPT.pptx
Network security Slides fir bs-13.PPT.pptx

More from n|u - The Open Security Community (20)

PDF
Hardware security testing 101 (Null - Delhi Chapter)
PPTX
SSRF exploit the trust relationship
PDF
PDF
Api security-testing
PDF
Introduction to TLS 1.3
PDF
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
PDF
Talking About SSRF,CRLF
PPTX
Building active directory lab for red teaming
PPTX
Owning a company through their logs
PPTX
Introduction to shodan
PDF
Detecting persistence in windows
PPTX
Frida - Objection Tool Usage
PDF
OSQuery - Monitoring System Process
PDF
DevSecOps Jenkins Pipeline -Security
PDF
Extensible markup language attacks
PPTX
PDF
Hardware security testing 101 (Null - Delhi Chapter)
SSRF exploit the trust relationship
Api security-testing
Introduction to TLS 1.3
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Talking About SSRF,CRLF
Building active directory lab for red teaming
Owning a company through their logs
Introduction to shodan
Detecting persistence in windows
Frida - Objection Tool Usage
OSQuery - Monitoring System Process
DevSecOps Jenkins Pipeline -Security
Extensible markup language attacks

Recently uploaded (20)

PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Encapsulation theory and applications.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Assigned Numbers - 2025 - Bluetooth® Document
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
Agricultural_Statistics_at_a_Glance_2022_0.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
20250228 LYD VKU AI Blended-Learning.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Network Security Unit 5.pdf for BCA BBA.
Advanced methodologies resolving dimensionality complications for autism neur...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Encapsulation theory and applications.pdf
Big Data Technologies - Introduction.pptx
sap open course for s4hana steps from ECC to s4
Chapter 3 Spatial Domain Image Processing.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Assigned Numbers - 2025 - Bluetooth® Document
The AUB Centre for AI in Media Proposal.docx
Diabetes mellitus diagnosis method based random forest with bat algorithm

Converting your linux Box in security Gateway Part – 2 (Looking inside VPN)

  • 1. Convert your Linux box in to security Gateway Part-2 (VPN)By MurtujaBharmalhttp://null.co.in/http://nullcon.net/
  • 2. http://null.co.in/http://nullcon.net/About MeNo Work Busy Man….Unemployed….Interest…. /dev/random….Co-founder of null…. :-DX-IBMer ….. Dal, Roti ka jugad, Security Consulting/Training
  • 3. Prerequisiteshttp://null.co.in/http://nullcon.net/Basic concept of networking/routing/natting.Knowledge of TCP/IP model & communication protocol IP, TCP, UDP, ICMP, DNS, HTTP/S, SMTP, FTP etc. How to Install and use Linux OSSome hands on Linux command line
  • 4. Full Picturehttp://null.co.in/http://nullcon.net/Security Features of Linux..Hardening OSFirewall Concept/ConfigurationVPN Concept/ConfigurationIDS/IPS Concept/ConfigurationProxy Concept/ConfigurationAntivirus Concept/ConfigurationHardening Services i.e. Web Server/Mail Server/Database etc.
  • 5. Agenda for TodayWhat is VPNWhy VPNBenefits of VPNTypes of VPNVPN ConceptVPN Configuration – (Openswan)http://null.co.in/http://nullcon.net/
  • 6. What is VPN (Misconception)http://null.co.in/http://nullcon.net/
  • 7. What is VPN (Conceptually)http://null.co.in/http://nullcon.net/
  • 8. What is VPN (Actually)http://null.co.in/http://nullcon.net/
  • 9. Why VPNhttp://null.co.in/http://nullcon.net/Business have grown beyond local and regional concern. We now have to worry about global markets and logisticsWe need to get connected efficiently and securely to our offices.Earlier Offices where connected through leased lines, from ISDN to OC3 (Optical Carrier 3 – 155 Mbps) fibre. It proved to be expensive.With the wide use of Internet, it became the medium to connect business together and also connect offices using VPNVPN, in short, is connecting networks together, using a public network. It could connect a mobile user, or a remote office to the head office using the Internet.
  • 10. Benefits of VPNExtend Geographic connectivityReduce Operational costs versus traditional WANImprove SecurityImprove productivity?Provide global networking opportunityProvide broadband networking compatibilityProvide telecommuter supporthttp://null.co.in/http://nullcon.net/
  • 11. Types of VPN (Based on Technology)IPSec VPN – IP SecuritySSL VPN – Secure Socket Layer MPLS – Multiprotocol Layering SwitchGRE – Generic Route Encapsulation PPTP – Point-to-Point Tunneling ProtocolL2TP – Layer 2 Tunneling Protocolhttp://null.co.in/http://nullcon.net/
  • 12. Types of VPN (Based on functionality)Site-to-Site VPNClient-to-Site VPNhttp://null.co.in/http://nullcon.net/
  • 15. VPN Concept (Encryption)Translation of data into secret code is called encryptionTo decrypt data you must have access to a secret key or passwordUnencrypted data is called plain textEncrypted data is called cipher texthttp://null.co.in/http://nullcon.net/Courtesy: http://www.webopedia.com
  • 16. VPN Concept (Encryption)There are two main forms of encryptionSymmetric encryptionEach computer uses a secret key that it can use to encrypt data. The same key is used to decrypt data too.Public Key encryptionUses a combination of two keys called as private key and public key. The public key is given to everyone. The data is encrypted using the publickey and the privatekey is used to decrypt it.http://null.co.in/http://nullcon.net/Courtesy: http://www.webopedia.com
  • 17. VPN Concept (HASH)Cryptographic hash functions are used for example to create a message digestA hash function compresses the bits of a messages to a fixed-size hash value in a way that only one hash value is possible for a message.Most widely used hash functions are md5 and sha-1http://null.co.in/http://nullcon.net/Courtesy: http://www.webopedia.com
  • 18. VPN Concept (IPSec)Why do we need IPSec ?Suite of protocols for securing network connectionsIPSec provides mechanism and not policyYou can decide on any encryption algorithm or authentication method as long as both the connecting parties agreehttp://null.co.in/http://nullcon.net/Courtesy: http://www.unixwiz.net
  • 20. VPN Concept (IPSec Overview)IPSec, is a framework of open standards (from IETF) that define policies for secure communication in a network. Using IPSec, participating peers (computers or machines) can achieve data confidentiality, data integrity, and data authentication at the network layer The IPsec standard provides a method to manage authentication and data protection between multiple crypto peers engaging in secure data transfer. IPsec includes the Internet Security Association and Key Management Protocol (ISAKMP)/Oakley and two IPsec IP protocols: Encapsulating Security Protocol (ESP) and Authentication Header (AH). IPsec uses symmetrical encryption algorithms for data protection. Symmetrical encryption algorithms are more efficient and easier to implement in hardware. These algorithms need a secure method of key exchange to ensure data protection. Internet Key Exchange (IKE) ISAKMP/Oakley protocols provide this capability.http://null.co.in/http://nullcon.net/Courtesy: http://cisco.comCourtesy: http://ipv6.com
  • 21. VPN Concept (IPSec Overview)IPSec consists of the following two main protocols:Authentication Header (AH)Encapsulating Security Payload (ESP)http://null.co.in/http://nullcon.net/
  • 22. VPN Concept (IPSec Mode)•TransportmodeIPsec transport mode works by inserting the ESP or AH header between the IP header and the next protocol or the transport layer of the packet. Both IP addresses of the two network nodes whose traffic is being protected by IPsec are visible in the IP header of the post-encrypted packet.•TunnelmodeTunnel mode works by encapsulating and protecting an entire IP packet. Because tunnel mode encapsulates or hides the IP header of the pre-encrypted packet, a new IP header is added so that the packet can be successfully forwarded. The encrypting devices themselves own the IP addresses used in this new header. Tunnel mode can be employed with either or both IPsec protocols (ESP and AH). Tunnel mode results in additional packet expansion of approximately 20 bytes because of the new IP header. Tunnel mode is widely considered more secure and flexible than transport mode. IPsec tunnel mode encrypts the source and destination IP addresses of the original packet, and hides that information from the unprotected network.http://null.co.in/http://nullcon.net/Courtesy: http://www.unixwiz.net
  • 23. Optional EncryptionOptional EncryptionOuter IP HeaderInner IP HeaderVPN Concept (Difference in Modes)Original PacketTransport Mode IP HeaderDataOriginal IPHeaderIPSec ESPHeaderDataTunnel Mode New IPHeaderIPSec ESPHeaderDataOriginal IPHeaderhttp://nullcon.net/http://null.co.in/
  • 25. VPN Concept (Security Association)A Security Association (SA) is an agreement between two peers engaging in a crypto exchange. This agreement includes the type and strength of the encryption algorithm used to protect the data. The SA includes the method and strength of the data authentication and the method of creating new keys for that data protection.ISAKMP Security Association (ISAKMP Phase 1)The first phase is a “setup” stage where two devices agree on how to exchange further information securely. This negotiation between the two units creates a security association for ISAKMP itself; an ISAKMP SA. This security association is then used for securely exchanging more detailed information in Phase 2.IPsec Security Associations (ISAKMP Phase 2) Data TunnelIn this phase the ISAKMP SA established in Phase 1 is used to create SAs for othe security protocols. Normally, this is where the parameters for the “real” SAs for the AH and ESP protocols would be negotiated.http://null.co.in/http://nullcon.net/
  • 26. VPN Concept (Phase 1: Main Mode)http://null.co.in/http://nullcon.net/Courtesy: http://www.eetimes.com
  • 27. VPN Concept (Phase 1: Aggressive Mode)http://null.co.in/http://nullcon.net/Courtesy: http://www.eetimes.com
  • 28. VPN Concept (Phase 1: Authentication)IKE phase 1 has three methods to authenticate IPSec peers.1. Pre-Shared Keys (PSK). 2. Public KeyInfrastructure (PKI) using X.509 Digital Certificates. 3. RSA encrypted nonceshttp://null.co.in/http://nullcon.net/
  • 29. VPN Concept (Phase 2: Quick Mode)http://null.co.in/http://nullcon.net/Courtesy: http://www.eetimes.com
  • 30. VPN Configuration (OpenSwan)Site-to-Site VPNhttp://null.co.in/http://nullcon.net/5.6.7.8172.16.1.1eth0eth15.6.7.91.2.3.5eth1Office 2 LAN172.16.1.0/24 1.2.3.4eth0192.168.1.1Office 1 LAN192.168.1.0/24
  • 31. http://null.co.in/http://nullcon.net/VPN Configuration (OpenSwan)Site-to-Site VPN – /etc/ipsec.confCourtesy: http://www.linuxhomenetworking.com
  • 32. Conn net-to-netauthby=secret #Key exchange methodleft=1.2.3.4leftsubnet =192.168.1.0/24leftnexthope=%defaultrouteright=5.6.7.8rightsubnet=172.16.1.0/24rightnexthope=5.6.7.9auto=start/addhttp://null.co.in/http://nullcon.net/VPN Configuration (OpenSwan)Site-to-Site VPN – /etc/ipsec.confCourtesy: http://www.linuxhomenetworking.com
  • 33. 1.2.3.4 5.6.7.8 : PSK "nonebutourselvescanfreeourminds"http://null.co.in/http://nullcon.net/VPN Configuration (OpenSwan)Site-to-Site VPN – /etc/ipsec.secretsCourtesy: http://www.linuxhomenetworking.com
  • 34. net/ipv4/ip_forward = 1iptables -t nat -A POSTROUTING -o eth0 -s 192.168.1.0/24 -d \! 172.16.1.0/24 -j MASQUERADEhttp://null.co.in/http://nullcon.net/VPN Configuration (OpenSwan)Site-to-Site VPN – OthersettingCourtesy: http://www.linuxhomenetworking.com
  • 35. 104 "net-to-net" #1: STATE_MAIN_I1: initiate 106 "net-to-net" #1: STATE_MAIN_I2: sent MI2, expecting MR2 108 "net-to-net" #1: STATE_MAIN_I3: sent MI3, expecting MR3 004 "net-to-net" #1: STATE_MAIN_I4: ISAKMP SA established 112 "net-to-net" #2: STATE_QUICK_I1: initiate 004 "net-to-net" #2: STATE_QUICK_I2: sent QI2, IPsec SA established {ESP=>0xe0bdd0e9 <0x13ac7645}http://null.co.in/http://nullcon.net/VPN Configuration (OpenSwan)Site-to-Site VPN – LogCourtesy: http://www.linuxhomenetworking.com
  • 36. [root@vpn2 tmp]# netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irttIface10.0.0.0 0.0.0.0 255.255.255.0 U 40 0 0 eth1 6.25.232.0 0.0.0.0 255.255.255.248 U 40 0 0 eth0 172.16.1.0 1.2.3.4 255.255.255.0 UG 40 0 0 ipsec0tcpdump -n -i ipsec0 icmp03:05:53.971308 IP 192.168.1.5 > 172.16.1.5: icmp 64: echo request seq 89 03:05:53.995297 IP 172.16.1.5 > 192.168.1.5: icmp 64: echo reply seq89tcpdump -n -i eth1 host 5.6.7.8 02:08:23.637149 IP 1.2.3.4 > 5.6.7.8: ESP(spi=0xf4909a7e,seq=0x73) 02:08:24.635302 IP 5.6.7.8 > 1.2.3.4: ESP(spi=0x808e9a87,seq=0x74) http://null.co.in/http://nullcon.net/VPN Configuration (OpenSwan)Site-to-Site VPN – Verification/DebugCourtesy: http://www.linuxhomenetworking.com

Editor's Notes