1
0
mirror of synced 2024-11-26 23:06:03 +03:00
setup-ipsec-vpn/docs/uninstall.md

88 lines
2.7 KiB
Markdown
Raw Normal View History

2017-03-20 06:10:49 +03:00
# Uninstall the VPN
2016-06-24 02:10:25 +03:00
*Read this in other languages: [English](uninstall.md), [简体中文](uninstall-zh.md).*
Follow these steps to remove the VPN. Commands must be run as `root`, or with `sudo`.
2016-06-24 02:10:25 +03:00
2016-06-24 02:16:01 +03:00
## Steps
* [First step](#first-step)
* [Second step](#second-step)
* [Third step](#third-step)
* [Fourth step](#fourth-step)
* [Optional](#optional)
* [When finished](#when-finished)
2016-06-24 02:10:25 +03:00
## First step
```bash
2016-06-24 02:10:25 +03:00
service ipsec stop
service xl2tpd stop
rm -rf /usr/local/sbin/ipsec /usr/local/libexec/ipsec
2016-06-29 22:35:28 +03:00
rm -f /etc/init/ipsec.conf /lib/systemd/system/ipsec.service \
/etc/init.d/ipsec /usr/lib/systemd/system/ipsec.service
2016-06-24 02:10:25 +03:00
```
## Second step
2020-12-27 09:16:49 +03:00
### Ubuntu & Debian
2016-06-24 02:10:25 +03:00
2016-06-29 22:35:28 +03:00
`apt-get purge xl2tpd`
2016-06-24 02:10:25 +03:00
2020-12-27 09:16:49 +03:00
### CentOS/RHEL & Amazon Linux 2
2016-06-24 02:10:25 +03:00
`yum remove xl2tpd`
## Third step
2020-12-27 09:16:49 +03:00
### Ubuntu & Debian
2016-06-24 02:10:25 +03:00
2020-05-25 22:20:32 +03:00
Edit `/etc/iptables.rules` and remove unneeded rules. Your original rules (if any) are backed up as `/etc/iptables.rules.old-date-time`. In addition, edit `/etc/iptables/rules.v4` if the file exists.
2016-06-24 02:10:25 +03:00
2020-12-27 09:16:49 +03:00
### CentOS/RHEL & Amazon Linux 2
2016-06-24 02:10:25 +03:00
2020-05-25 22:20:32 +03:00
Edit `/etc/sysconfig/iptables` and remove unneeded rules. Your original rules (if any) are backed up as `/etc/sysconfig/iptables.old-date-time`.
**Note:** If using CentOS/RHEL 8 and firewalld was active during VPN setup, nftables may be configured. Edit `/etc/sysconfig/nftables.conf` and remove unneeded rules. Your original rules are backed up as `/etc/sysconfig/nftables.conf.old-date-time`.
2016-06-24 02:10:25 +03:00
## Fourth step
Edit `/etc/sysctl.conf` and remove the lines after `# Added by hwdsl2 VPN script`.
2016-06-25 04:42:57 +03:00
Edit `/etc/rc.local` and remove the lines after `# Added by hwdsl2 VPN script`. DO NOT remove `exit 0` (if any).
2016-06-24 02:10:25 +03:00
## Optional
2020-05-25 22:20:32 +03:00
**Note:** This step is optional.
2016-06-25 04:42:57 +03:00
2016-06-24 02:10:25 +03:00
Remove these config files:
2016-06-29 22:35:28 +03:00
* /etc/ipsec.conf*
* /etc/ipsec.secrets*
* /etc/ppp/chap-secrets*
* /etc/ppp/options.xl2tpd*
2016-06-24 02:10:25 +03:00
* /etc/pam.d/pluto
* /etc/sysconfig/pluto
2016-06-29 22:35:28 +03:00
* /etc/default/pluto
2016-06-25 04:42:57 +03:00
* /etc/ipsec.d (directory)
2016-06-29 22:35:28 +03:00
* /etc/xl2tpd (directory)
2016-06-24 02:10:25 +03:00
Copy and paste for fast removal:
```bash
2016-06-29 22:35:28 +03:00
rm -f /etc/ipsec.conf* /etc/ipsec.secrets* /etc/ppp/chap-secrets* /etc/ppp/options.xl2tpd* \
/etc/pam.d/pluto /etc/sysconfig/pluto /etc/default/pluto
rm -rf /etc/ipsec.d /etc/xl2tpd
2016-06-25 04:42:57 +03:00
```
2016-06-24 02:10:25 +03:00
## When finished
Reboot your server.
2021-03-29 23:05:45 +03:00
## License
2021-06-05 01:27:21 +03:00
Copyright (C) 2016-2021 [Lin Song](https://github.com/hwdsl2) [![View my profile on LinkedIn](https://static.licdn.com/scds/common/u/img/webpromo/btn_viewmy_160x25.png)](https://www.linkedin.com/in/linsongui)
2021-03-29 23:05:45 +03:00
2021-06-05 01:27:21 +03:00
[![Creative Commons License](https://i.creativecommons.org/l/by-sa/3.0/88x31.png)](http://creativecommons.org/licenses/by-sa/3.0/)
This work is licensed under the [Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/)
2021-03-29 23:05:45 +03:00
Attribution required: please include my name in any derivative and let me know how you have improved it!