{"id":15693763,"url":"https://github.com/gableroux/l2tp-ipsec-vpn-setup-scripts","last_synced_at":"2025-05-08T05:41:41.072Z","repository":{"id":145782441,"uuid":"152904689","full_name":"GabLeRoux/l2tp-ipsec-vpn-setup-scripts","owner":"GabLeRoux","description":"🌐L2TP IPSec client scripts for CentOS 7","archived":false,"fork":false,"pushed_at":"2024-04-13T16:35:32.000Z","size":7,"stargazers_count":8,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T17:13:50.274Z","etag":null,"topics":["centos7","ipsec","l2tp","shell","vpn"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GabLeRoux.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-13T18:57:33.000Z","updated_at":"2025-01-13T07:52:52.000Z","dependencies_parsed_at":"2024-04-13T17:40:46.544Z","dependency_job_id":"8c91b480-deb6-408d-a066-0ceaa7b16977","html_url":"https://github.com/GabLeRoux/l2tp-ipsec-vpn-setup-scripts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabLeRoux%2Fl2tp-ipsec-vpn-setup-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabLeRoux%2Fl2tp-ipsec-vpn-setup-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabLeRoux%2Fl2tp-ipsec-vpn-setup-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GabLeRoux%2Fl2tp-ipsec-vpn-setup-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GabLeRoux","download_url":"https://codeload.github.com/GabLeRoux/l2tp-ipsec-vpn-setup-scripts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253009529,"owners_count":21839711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["centos7","ipsec","l2tp","shell","vpn"],"created_at":"2024-10-03T18:48:36.871Z","updated_at":"2025-05-08T05:41:41.051Z","avatar_url":"https://github.com/GabLeRoux.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# L2TP ipsec vpn setup scripts\n\nThis is a collection of scripts to help setup an **L2TP IPSec client on CentOS 7**. There are a bunch of tutorials out there, but I had a hard time finding a working solutiion. :fire:\n\nIf you used [hwdsl2/setup-ipsec-vpn](https://github.com/hwdsl2/setup-ipsec-vpn) for the server, then these scripts should work. :+1:\n\nTested on `CentOS Linux release 7.5.1804 (Core)`. The client setup is mostly inspired by [Archlinux wiki: Openswan L2TP/IPsec VPN client setup](https://wiki.archlinux.org/index.php/Openswan_L2TP/IPsec_VPN_client_setup) and adapted for CentOS 7\n\n## Getting started\n\n1. Clone the project\n2. Make sure scripts are executable\n3. Setup your environment variables\n4. Execute the setup script\n5. Each time you want to connect, run the start script `start_vpn_client.sh` with `sudo`\n\n```bash\ngit clone https://github.com/GabLeRoux/l2tp-ipsec-vpn-setup-scripts.git\ncd l2tp-ipsec-vpn-setup-scripts\ncp .env.example .env\nvim .env\nsudo setup_vpn_client.sh\n```\n\n```bash\nsudo start_vpn_client.sh\n```\n\n## Why Centos?\n\nPlease don't ask, that wasn't my idea.\n\n## Is this safe?\n\nRead the scripts, I'm not your mom :wink:. Running things from the internet as `sudo` is never safe friend.\n\n## Is this working?\n\n**Yes**, it does work. Only the part for routing needs some manual actions. Refer to [Archlinux wiki Routing section](https://wiki.archlinux.org/index.php/Openswan_L2TP/IPsec_VPN_client_setup#Routing)\n\nLet's say there is this IP behind the VPN:\n`xxx.xxx.xxx.xxx` and you'd like your system to reach it using the `ppp0` device (your vpn tunnel). You first need to get your `ppp0` device `peer` ip:\n\n```bash\nip a show dev ppp0\n```\n```\n5: ppp0: \u003cPOINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP\u003e mtu 1280 qdisc pfifo_fast state UNKNOWN group default qlen 3\n    link/ppp\n    inet 192.168.42.10 peer 192.168.42.1/32 scope global ppp0\n       valid_lft forever preferred_lft forever\n```\nIn my case, it's `192.168.42.1`. We can get this with the following magic command:\n\n```bash\nip -o -4 a show dev ppp0 | awk -F '[ /]+' '/global/ {print $4}'\n``` \n\nThen you need to update your routing table to let your system know how to reach the desired server behind vpn using your `ppp0` device. Command looks like that:\n\n```bash\nip route add xxx.xxx.xxx.xxx via yyy.yyy.yyy.yyy dev pppX\n```\n\nor in my case:\n\n```bash\nip route add xxx.xxx.xxx.xxx via 192.168.42.1 dev ppp0\n```\n\n## What's my local ip?\n\n```bash\nip a\n```\n\nIt should be somewhere in here, look for `eth0` or `wlan0` if you're on a wifi.\n\n## Vagrant\n\nYeah I prefer Docker, but I had to setup something on an actual machine and docker has no such thing as `systemctl`. Here's how you can try this on vagrant:\n\n```bash\ncp .env.example .env\nvim .env\nvagrant up\nvagrant ssh\nsudo /app/setup_vpn_client.sh\n```\n\nIt's a good idea to try it on a VM first so you don't polute your server before knowing it works.\n\n## I'm stuck with 'Errno 22: Invalid argument'\n\nYup, me too. See [issue #1](https://github.com/GabLeRoux/l2tp-ipsec-vpn-setup-scripts/issues/1). Help me! :fire:\n\n## Contributing\n\nContributions are welcome, I may not maintain this project much, but you can open issues or send pull-requests. :v:\n\n## License\n\n[MIT](LICENSE.md) © [Gabriel Le Breton](https://gableroux.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgableroux%2Fl2tp-ipsec-vpn-setup-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgableroux%2Fl2tp-ipsec-vpn-setup-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgableroux%2Fl2tp-ipsec-vpn-setup-scripts/lists"}