Set up ipsec VPN with Strongswan on Ubuntu with PSK for roadwarrior use

This post shows how to setup an ipsec VPN connection in roadwarrior fashion. Roadwarrior mode is where you typically have a mobile device which has a dynamic address and you want to connect back to a VPN server. This post uses a simple pre shared key to establish the VPN connection using strongswan. This is much simpler than my past openswan approach which also relied on L2TP, Pluto etc. needing to be configured. Performance also seems to be better with VPN connections establishing much faster.



1. Install strongswan and the xauth plugin

sudo apt-get install strongswan strongswan-plugin-xauth-pam

2. Establish the VPN ipsec configuration

sudo vi /etc/ipsec.conf

Contents

config setup
# strictcrlpolicy=yes
# uniqueids = no
nat_traversal=yes
virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12
charondebug=1
uniqueids=yes
strictcrlpolicy=no

conn tunnel
        keyexchange=ikev1
aggressive=no
        leftfirewall=yes
        left=192.168.1.100
leftsubnet=0.0.0.0/0
right=%any
        rightsourceip=10.0.0.2
rightdns=192.168.1.1
        rightsubnet=0.0.0.0/0
        authby=xauthpsk
        xauth=server
auto=add
        ike=aes128-sha1-modp1024!
        esp=aes128-sha1!
        type=tunnel


3. Create the pre shared keys used to encrypt the VPN

echo | shasum -a 512 

This has will be inserted as the PSK hash into the secret file in the next step.
4. Create secrets file

sudo vi /etc/ipsec.secrets

Contents

USERNAME : XAUTH PASSWORD

%any %any : PSK "INSERT KEY HASH"

Whereby
USERNAME is the username you want to login with.
PASSWORD is the password you want to login with.
INSERT KEY HASH is the PSK generate by the prior command, keep the quotation marks.


5. Set file permissions so people can not view your keys

sudo chmod 600 /etc/ipsec.secrets

6. Tell the server to forward VPN traffic

sudo vi /etc/sysctl.conf

Find and change the follow from 0 to 1

net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1

7. Set up the Firewall

sudo iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o enp2s0 -m policy --dir out --pol ipsec -j ACCEPT

sudo iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o enp2s0 -j MASQUERADE

sudo ufw allow 50/udp
sudo ufw allow 51/udp
sudo ufw allow 500/udp
sudo ufw allow 4500/udp

8. Restart the VPN server strongswan

sudo ipsec restart


Client configuration

Android

I only set the following settings:

Type: IPSec Xauth PSK
Server:
IPSEC preshared key:
DNS server:
Username:
Password:

OSX

TO FOLLOW



68 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. If you are looking for antivirus security for your PC and any other digital devices than. Visit@: my sites :-
    mcafee.com/activate

    mcafee.com/activate

    norton.com/setup

    ReplyDelete
  3. I'm glad I found this web site, I couldn't find any knowledge on this matter prior to.Also operate a site and if you are ever interested in doing some visitor writing for me if possible feel free to let me know, im always look for people to check out my web site. save money with vpn

    ReplyDelete
  4. Thanks for sharing your inspiring blog the information was very useful to my project ….

    mcafee.com/activate | norton.com/setup | norton.com/setup | office.com/setup | mcafee.com/activate | mcafee.com/activate | norton.com/setup

    ReplyDelete
  5. I really happy found this website eventually. Really informative and inoperative, Thanks for the post and effort! Please keep sharing more such blog.

    norton.com/setup

    norton.com/setup

    mcafee.com/activate

    kaspersky activation code

    free pogo games

    roadrunner email

    aol mail

    ReplyDelete
  6. Help for all Microsoft Office Apps. Set up your Office 365 membership. Get help from the experts, you can tap on the link and get the best answer for your concern.
    Office.com/setup
    Office.com/setup

    ReplyDelete
  7. I really happy found this website eventually. Really informative and inoperative, Thanks for the post and effort! Please keep sharing more such blog.

    norton.com/setup

    norton.com/setup

    mcafee.com/activate

    kaspersky activation code

    free pogo games

    roadrunner email

    aol mail

    ReplyDelete
  8. Do you require HP printer setup for your mac operating system? Is your printer driver not suitable for macOS? Then visit the 123.hp.com/setup to get the software and driver for better functioning of your printer. You can also call our expert HP support team for services.

    ReplyDelete
  9. Thank you so much for sharing such superb information's with us. Download the Microsoft Office setup on your Windows or Mac computer. Make sure that the Office product key is already copied for the activation procedure. office.com/setup | office.com/setup

    Before you set up McAfee Antivirus protection on your device, you first need to make sure that you don’t have an older version of McAfee on your device. mcafee.com/activate | mcafee.com/activate | mcafee.com/activate

    ReplyDelete
  10. Positive web page source, where did u come up with the information on this posting? I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.

    mcafee.com/activate | mcafee.com/activate

    ReplyDelete
  11. Norton Antivirus protect your computer, mobile and tablet against virus, malware, trojan and, other online threats. To get assistance from the Norton online support, just visit the official website of the Norton Antivirus by click on the link Norton.com/setup.
    Norton.com/setup

    ReplyDelete
  12. Microsoft Office Suite of products developed by Microsoft that includes Microsoft Word, Excel, Access, PowerPoint, and Outlook. Get some easy steps for easy downloading, installing, activating, and re-installing the Microsoft Office suite by visiting the following links.
    Office.com/setup
    Office.com/setup

    ReplyDelete
  13. Data security is a very big issue nowadays. Viruses harm the data. Here you can know more about how to remove viruses from your computer and makes your data secure and safe.
    Easy Steps To Remove Viruses
    How to Remove Viruses from your computer?

    ReplyDelete
  14. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. If you are looking for antivirus security for your PC and any other digital devices than. Visit my sites.


    webroot.com/safe | webroot.com/safe | central.bitdefender.com | eset.com/activate |

    ReplyDelete
  15. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. If you are looking for antivirus security for your PC and any other digital devices than. Visit my sites.


    www.webroot.uk.com

    ReplyDelete
  16. Greetings, I’m John. I’m a writer living in London, UK. I am a fan of technology, writing. You can visit my store.
    Mcafee.com/activate
    Mcafee.com/activate
    Mcafee.com/activate
    Mcafee.com/activate

    ReplyDelete
  17. VITAL BENEFITS OF WEBROOT FOR USERS

    Quick scan is available.
    Protects from cyber attacks.
    Identifies harmful websites and ads.
    Asks before deleting any personal data.
    Two-way firewall protection is available.
    Passwords and bank details are protected.
    Keeps Android, Windows, Mac fast as ever.


    To know more details visit:- guide-to-download-install-and-activate-webroot-antivirus-using-webroot-com-safe-for-mac-windows-users


    webroot.com/safe | webroot.com/safe | central.bitdefender.com | eset.com/activate | webroot.com/safe | webroot.com/safe

    ReplyDelete
  18. WEBROOT ANTIVIRUS MINIMUM SYSTEM REQUIREMENTS
     

    Before installing Webroot, it is highly suggested to visit webroot.com/safe and match your system’s requirements accordingly. Other than that, here is the list of some elements that you need to match to access Webroot antivirus efficiently.
     
    For Windows Operating System:
     

    Version: Can be installed on Windows 10, 8, 8.1 and 7 (32-bit and 64-bit)
    Hard Disk Space: 15 MB
    Internet: Requires Internet access.
    Browser: Minimum 32-bit or 64-bit browser is required.
    RAM: 2 GB RAM recommended.
     
    For the Mac Operating System:
     

    Version: Can be installed on OS X 10.9, 10.10, 10.11, 10.12, and 10.13.
    Hard Disk Space: 15 MB
    Internet: Requires internet connection.
    Browser: Safari at least 7.0 or higher.
    RAM: Minimum of 128 MB recommended.

    To get full details visit:-   
    How to Download, Install & Activate WEBROOT Antivirus  |  How to Download, Install & Activate WEBROOT Antivirus |   How to Download, Install & Activate WEBROOT Antivirus

    For more technical support visit:- wixsite  |  mystrikingly  

    ReplyDelete
  19. Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man,Keep it up.
    Webroot.com/safe | central.bitdefender.com | webroot.com/safe

    ReplyDelete
  20. Office.com/setup - MS Office provides amazing desktop applications such as Microsoft Word, PowerPoint, Excel, OneNote, Publisher, Access and Skype for business. The Office suite introduced by Microsoft is contributing to enhancing the performance of every section of society whether it is enterprises, school students, universities or individuals working in offices. The access to various applications are convenient for the users, and further information could be sought by visiting Office.com/setup

    ReplyDelete
  21. YouTube is using several people today and worldwide billions of users on YouTube. There you can watch amazing content, music, or the latest videos. If you want to connect YouTube on your gadget during this time you facing any type of error so you don't take tension. Few steps to resolve issues visit our website YouTube Activate follow the instructions or enjoying videos. But if you do not do these steps, you contact us our toll-free and there our expert team fix your issues immediately furthermore provides the finest solution.

    ReplyDelete
  22. This is very good blog post, I like your content writing skill and I have also something to share:

    norton.com/setup
    www.norton.com/setup
    norton download
    norton setup

    ReplyDelete
  23. Spirit Airlines Reservations Thanks for the information provided by you it’s really great to help from your side but I got the complete solution from the mentioned site

    ReplyDelete
  24. Spirit Airlines Booking A good Blog gives a lot more knowledge about this. I will continue to support your work. Thank you.

    ReplyDelete
  25. Thanks for sharing this great information,your post it really so helpful …… Spirit Airlines Ticket Booking

    ReplyDelete
  26. Thanks for providing the information with this post. Post is very nice! Spirit Airlines Flight Reservations

    ReplyDelete
  27. Thanks for sharing the useful information. You have mentioned all essential points for getting Assignment Help easily.Spirit Airlines Cancellation Policy

    ReplyDelete
  28. Norton antivirus is leading antivirus in the market its protect you from any kind of security threats. if its matter of your system security, you must trust on Norton antivirus. here are some security links that may helpful to you.

    norton.com/setup Australia
    www.norton.com/setup Australia
    norton download Australia
    norton setup Australia

    ReplyDelete
  29. Much obliged for the post and effort! You should keep sharing even more such information.
    Aol Mail Login

    ReplyDelete
  30. Nice Post, You really give informative information. Thanks for sharing this great article.
    m3m golf estate price list

    ReplyDelete
  31. The Hewlett-Packard Company, commonly shortened to Hewlett-Packard or HP, was an American multinational information technology company headquartered in

    123.hp/laserjet

    www.amazon.com/code

    192.168.11

    ReplyDelete
  32. A debt of gratitude is in order for your understanding for your phenomenal posting.
    Garmin Express

    ReplyDelete
  33. While making another Roku account, you will be approached to give an installment strategy. Thanks for watching my blog.

    Roku.comlink

    ReplyDelete
  34. Ik ben erg onder de indruk van het lezen van je blog. Blijf deze waardevolle blogs delen. Bellen google

    ReplyDelete
  35. Positieve webpagina-bron, waar heb je de informatie over dit bericht gevonden? Bedankt voor het delen. telefoon telefoon bellen Instagram

    ReplyDelete
  36. Positieve webpagina-bron, waar heb je de informatie over dit bericht gevonden? Bedankt voor het delen. Bellen paypal Nummer

    ReplyDelete
  37. Ik vond dit een informatieve blog en ook erg nuttig en deskundig. Bellen Outlook

    ReplyDelete
  38. Thanks for sharing, nice post! Post really provice useful information!

    ReplyDelete
  39. It is very easy to contact PayPal Netherlands and they will give you details via phone call or live chat if you are unable to use the phone. You can call their customer number and have your problems solved. You can also start PayPal's help chat service with just one click. In addition to the services, PayPal also helps with issues such as credit and debit card transfers.PayPal Nederland

    ReplyDelete
  40. Stellar Converter for Audio Video is a desktop YouTube video converter software. It can speedily convert multiple YouTube to MP4 file format in one go. The software also allows you to customize the output MP4 file. You can set video frame rate, resolution, metadata, and bitrate, etc. There’s no video file size limit for conversion.
    Further, the software has multiple useful features. Stellar Converter for Audio Video can convert videos to different video and audio format. You can replace audio track in a YouTube video, merge two or more videos, edit videos , and do more.
    How to convert YouTube to mp3
    First, download the desired YouTube video on your computer. Choose any YouTube downloader app, such as Free YouTube Downloader, YTD Video Downloader, Y2Mate, SaveFrom.net, etc.
    Once the video is downloaded, launch Stellar Converter for Audio Video on your PC or Mac.
    Select MP4 as output format and click on Convert.Add the YouTube video download file saved on your computer.

    Also Download facebook video with facebook video downloader

    ReplyDelete
  41. Hey buddy, I must say you have written a great article. The way you have described everything is phenomenal. Thanks for sharing it. I have bookmarked your website so that I could learn more things from your blog.
    Visit: webroot.com/safe

    ReplyDelete
  42. Great post! I am actually getting ready to across this information, is very helpful my friend. Also great blog here with all of the valuable information you have. Keep up the good work you are doing.
    Visit: www.webroot.com/safe

    ReplyDelete
  43. Outstanding article! I want people to know just how good this information is in your article. Your views are much like my own concerning this subject. I will visit daily your blog because I know. It may be very beneficial for me.
    Visit: www.trendmicro.com/downloadme

    ReplyDelete
  44. Awesome article, it was exceptionally helpful! I simply began in this and I’m becoming more acquainted with it better! keep doing awesome.
    Visit: www.trendmicro.com/downloadme

    ReplyDelete
  45. I really happy found this website eventually. Really informative and inoperative, Thanks for the post and effort! Please keep sharing more such a blog.
    Visit: aol desktop gold download

    ReplyDelete
  46. It's a good idea to run these security and privacy tests regularly. Even if you're just using Gmail, you need to verify your full Google account settings to make sure your data and identity are safe. Google makes managing account security really easy if you know where to look, but they change the style and scope of the settings from time to time, so if you haven't checked them in a while, now's a good time.
    ==============================
    Gmail Contact

    ReplyDelete
  47. Hi, I am Nancywilson open my site we are here to inspect the way to fix a circumstance where customers face issues while specific assistance. searching for indeed gifted competitors with remarkable social capacities with regards to the Technical Support position. Specific Support Officers research particular issues give accommodating client examination and support them turn out of new applications, among different commitments. We are here to inspect the way to fix a circumstance where customers face issues while specific assistance. Webroot Download | mcafee.com/activate | AOL Desktop Gold Download | HP Printer Drivers | Garmin.com/express |

    ReplyDelete
  48. HP printers, as an incredible asset for proficient and stable printing with guided exactness, have become an important component of our own just as expert life. Get your hands on the best HP printer in the business and set up the framework upheld by a bunch of directions by 123.hp.com/setup. Guarantee to utilize solid help to stay away from mistakes however much as could be expected. 123.hp.com/setup

    ReplyDelete
  49. Canon.com/ijsetup is a site that gives you a protected, secure, and dependable stage for downloading the driver. ... After the driver arrangement is done, you can utilize the product for controlling and commanding your printer to print your attractive records.canon.com/ijsetup | ij.start.cannon

    ReplyDelete
  50. If your printer is connected to your Windows 8 computer but does not appear in the list of printers to add in the control panel settings, you probably do not have the correct drivers installed. Although Windows 8 comes with more drivers than Windows 7, some printers may require you to install drivers. In most cases, Windows 8 will identify and download the correct drivers themselves. If it doesn't, open "Device Manager", locate your printer, and update the driver. If Windows is unable to update, you must either download the appropriate drivers from the printer manufacturer's website or install the drivers using the disc that came with the printer.Window Klantenservice Nederland

    ReplyDelete
  51. instagram
    instagram login
    http://eshbrooklyn.com
    instagram video download
    instagram download
    instagram reels download
    instagram story download
    instagram bio for girls
    instagram captions
    instagram app
    instagram account delete
    instagram apk
    instagram autofree.in
    instagram account
    instagram appeal form
    instagram account delete permanently
    instagram auto liker
    instagram bio
    instagram bio for boys
    instagram bio ideas
    instagram background
    instagram bio for girls attitude
    instagram blue tick copy
    instagram bio for boys in punjabi
    instagram captions for boys
    instagram captions for girls
    instagram customer care number india
    instagram create new account
    instagram copy link download
    instagram ceo
    instagram call centre number
    instagram dp
    instagram delete account
    instagram download video
    instagram download apk
    instagram download for pc
    instagram delete permanent
    instagram dp for girls
    instagram emoji
    instagram engagement rate
    instagram email
    instagram engagement rate calculator
    instagram engagement
    instagram extension
    instagram editing
    instagram email support
    instagram followers
    instagram followers increase
    instagram followers hack
    instagram followers free
    instagram fonts
    instagram followers increase app
    instagram forgot password
    instagram fake followers

    ReplyDelete
  52. Like any other program, the Kindle app has a myriad of issues that crop up from time to time on your iOS, Android, or Amazon Kindle Fire device. While you want to read your purchased books, they may not load, the app may refuse to work, or a dark screen may appear that disturbs you when you are in a good mood. This isn't to say the app isn't problematic – far from it. The software functions normally, although it occasionally encounters issues due to the older version, installation of poorly written updates, connectivity issues, device problems, and other factors. Because you want to be able to read your recently downloaded or favorite books from your collection and make further purchases. We have arrived to assist you with your shopping and other needs. Here's the most current list of proven patches for the Kindle app on your devices. After the issue is resolved, go for a walk (optional).Kindle Contact Nederland

    ReplyDelete
  53. An AOL mail service that is free, an AOL login is an email service that is web-based. So you can access a free AOL email, all that is needed is a mobile device or a computer with a web browser program such as Mozilla Firefox, Internet Explorer, or Google Chrome, and an internet connection.
    visit:
    AOL Mail Login
    AOL Mail signin
    AOL Mail signin
    AOL Mail Login Problems

    ReplyDelete
  54. Ik vond dit een informatieve blog en ook erg nuttig en deskundig. Bellen google

    ReplyDelete
  55. Positieve webpagina-bron, waar heb je de informatie over dit bericht gevonden? Bedankt voor het delen. telefoon bellen Instagram

    ReplyDelete
  56. Zeer informatieve blog. bedankt voor het delen met ons.Bellen Outlook

    ReplyDelete
  57. Windows 11 is the redesigned version of Windows 10 and that is why it has much more features than the ones present in Windows 10. But, I didn’t know how to download windows 11 iso file 64 bit and 32 bit versions of Windows 11 on my computer. However, this blog helped me a lot in the same and guided me towards making a good 32 & 64-bit Windows 11 Download, and that too free of cost.

    ReplyDelete
  58. Microsoft 365 plans for personal and home provides robust Office desktop apps including Word, PowerPoint, Excel, Outlook, and OneNote.
    microsoft365.com/setup | microsoft365.com/setup allows you to download and activate the Microsoft Office setup. Go through the canon.com/ijsetup webpage,e, click Set Up and start the Canon ij printer setup process.

    ReplyDelete
  59. Defend against the unknown threats and proceed for Trend micro download with www.trendmicro.com/activate having Advanced Machine Learning Technology.If you have a Norton product key norton.com/setup and download Norton setup. Go through the 123.hp.com/laserjet provides wired and wireless.

    ReplyDelete