From: Andrea Rossato Date: Fri, 14 Mar 2003 10:59:10 +0000 Subject: [LARTC] ipsec for linux 2.4 eventually made easy?! Message-Id: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: lartc@vger.kernel.org hi there, I just wanted to share a recent discovery I did on how to setup a secure=20 VPN implementation for linux 2.4.x (I'm using 2.4.20 but it should be=20 working, as far as documentation states, for > 2.4.18) without using=20 FreeS/WAN. The tool (ipsec_tunnel: http://ringstrom.mine.nu/ipsec_tunnel/, by=20 Tobias Ringstr=F6m) is a kernel module based on ipip and ip_gre. It uses=20 CyptoAPI to carry out actual encryption, as in the 2.5 implementation. Installation and setup are a matter of few seconds: get CrypotAPI=20 (http://www.kernel.org/pub/linux/kernel/crypto/v2.4/cryptoapi-0.1.0.tar.gz)= ,=20 untar and compile as modules: tar xvfz cryptoapi-0.1.0.tar.gz cd cryptoapi-0.1.0 make modules KDIR=3D/path/to/running/kernel make modules_install modprobe cryptoapi modprobe cipher-3des modprobe digest-sha1 Get ipsec_tunnel=20 (http://ringstrom.mine.nu/ipsec_tunnel/download/ipsec_tunnel-0.9.tar.gz) tar xvfz ipsec_tunnel-0.9.tar.gz cd ipsec_tunnel-0.9 ./configure (it will ask you the path to cryptoapi source and to you=20 running kernel) make make install modprobe ipsec_tunnel create an encryption key and an autenthication key: mkdir /etc/ipsec chmod 500 /etc/ipsec ipsecadm key create 3des --file=3D/etc/ipsec/demo.ciph.key ipsecadm key create sha1 --file=3D/etc/ipsec/demo.auth.key copy them in the remote host (with scp) scp /etc/ipsec/* root@remote.host:/etc/ipsec/ Now the actual setup (clearly explained in the ipsec_tunnel documentation): A) Local host (change 172.16.0.1 with our public IP; 192.168.122.1 will=20 be the address of the host in the VPN) ipsecadm sa add --spi=3D0x1000 --dst=172.16.0.1 --src=172.16.0.2 \ --cipher=3Des-cbc --cipher-keyfile=3D/etc/ipsec/demo.ciph.key \ --digest=3Dsha1 --digest-keyfile=3D/etc/ipsec/demo.auth.key --duplex ipsecadm tunnel add ipsec1 --local=172.16.0.1 --remote=172.16.0.2 ifconfig ipsec1 192.168.122.1 up route add -net 192.168.122.0/24 dev ipsec1 B) Remote host (change 172.16.0.2 with it's public ip; 192.128.122.2=20 will be the addres in the VPN) psecadm sa add --spi=3D0x1000 --dst=172.16.0.2 --src=172.16.0.1 \ --cipher=3Des-cbc --cipher-keyfile=3D/etc/ipsec/demo.ciph.key \ --digest=3Dsha1 --digest-keyfile=3D/etc/ipsec/demo.auth.key --duplex ipsecadm tunnel add ipsec1 --local=172.16.0.2 --remote=172.16.0.1 ifconfig ipsec1 192.168.122.2 up route add -net 192.168.122.0/24 dev ipsec1 You have now your secure VPN up and running. I think it's quite cool.=20 What do you think? Shouldn't this get into LARTC? I believe it=20 definitely should! Best regards, Andrea Rossato _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/