Skip to content

Instantly share code, notes, and snippets.

@greenido
Created April 9, 2014 08:20
Show Gist options
  • Save greenido/10240597 to your computer and use it in GitHub Desktop.
Save greenido/10240597 to your computer and use it in GitHub Desktop.
sudo rpm -Uvh http://mirrors.kernel.org/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo yum install -y lsof man strongswan rng-tools
sudo sed -e 's/EXTRAOPTIONS=""/EXTRAOPTIONS="-r \/dev\/urandom"/' -i /etc/sysconfig/rngd
sudo ln -s /usr/sbin/strongswan /usr/sbin/ipsec
sudo service rngd start
sudo service ipsec start
sudo service strongswan start
sudo chkconfig rngd on
sudo chkconfig strongswan on
Enable IP forwarding on the gateway (you need to do both of the following):
1.Edit /etc/sysctl.conf and uncomment the line net.ipv4.ip_forward=1.
The next time the system reboots, it will load these settings.
2.For the current session, run sysctl -p to apply the changes to the running system.
6. Define a secret key for both sides.
Execute the following on the host to install & configure strongSwan.
Use the ipsec.conf from above.
echo "%any : PSK \"<secret-key>\"" | sudo tee /etc/strongswan/ipsec.secrets > /dev/null
sudo cp ipsec.conf /etc/strongswan
sudo ipsec restart
sudo ipsec up myconn
(to set MTU size for VPN encapsulation)
sudo ifconfig eth0 mtu 1300 up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment