Created
October 30, 2022 14:32
-
-
Save billchenchina/d425abd637777836f9047fc3ad5403c3 to your computer and use it in GitHub Desktop.
Strongswan IPsec with IKEv2 PSK
This file contains hidden or 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
conn myikev2psk | |
auto = add | |
authby = psk | |
#compress = yes | |
keyexchange = ikev2 | |
type = tunnel | |
dpdaction = clear | |
dpddelay = 30s | |
#rekey = no | |
# a good convention is to use left for the local side, | |
# and right for the remote side | |
# default left = %any | |
left = ${SERVERIP} | |
#leftauth = | |
leftid = ${SERVERIP} | |
#leftikeport = | |
leftsubnet = 0.0.0.0/0,::/0 | |
right = %any | |
rightid = android | |
rightdns = 8.8.8.8,8.8.4.4 | |
rightsourceip = <a pool cidr, like 10.134.76.0/24> |
This file contains hidden or 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
# This file holds shared secrets or RSA private keys for authentication. | |
# RSA private key for this host, authenticating it to any other host | |
# which knows the public part. | |
: PSK "YOURPSK" |
This file contains hidden or 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
#!/bin/sh | |
# This configuration is tested on Android client | |
apt install strongswan | |
<!-- libcharon-extauth-plugins libstrongswan libstrongswan-standard-plugins strongswan-charon strongswan-libcharon strongswan-starter --> | |
apt install strongswan-pki | |
<!-- strongswan-pki --> | |
# And you need to configure the iptables | |
iptables -t nat -A POSTROUTING -s <source cidr like 10.134.76.0/24> -o <interface like eth0> -j MASQUERADE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment