Created
November 19, 2015 07:38
-
-
Save glavk/832d482bcf384edd5f72 to your computer and use it in GitHub Desktop.
Double VPN restore after restart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# включение маршрутизации | |
sysctl -w net.ipv4.ip_forward=1 | |
# правила межсетевого экрана и NAT | |
iptables -F FORWARD | |
iptables -A INPUT -i tun+ -j ACCEPT | |
iptables -A FORWARD -i tun+ -j ACCEPT | |
iptables -t nat -A POSTROUTING -s 10.1.0.0/24 -o tun0 -j MASQUERADE | |
# монтирование tmpfs | |
mount -o size=10M -t tmpfs none /etc/openvpn/ | |
# копирование конфигурации в /etc/openvpn через WinSCP, scp/ssh | |
# запуск сервера s2s.conf - связь с vps2, server.conf - связь с клиентом | |
openvpn --config server.conf | |
openvpn --config s2s.conf | |
# правила маршрутизации | |
ip rule add from 10.1.0.0/24 table 100 | |
ip route add table 100 default dev tun0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment