Linux Systeembeheer/Servers op afstand beheren met VPN

Download de onderstaande bestanden:
a) OpenSWAN 2.6.14 via https://www.openswan.org
b) l2tpd 0.69
c) l2tpd Legacy PTY patch
d) l2tpd SysV PTY patch
e) l2tpd startup file

Installeren OpenSwan:

 cd /usr/local/src
 yum install openswan openswan-doc

Het voorbeeld « ipsec.conf » bestand verplaatsen om zo het origineel te behouden.

 mv /etc/ipsec.conf /etc/ipsec.conf.old

Pas het volgende aan in het bestand:

 version 2.0
 config setup
 interfaces=%defaultroute
 klipsdebug=none
 plutodebug=none
 overridemtu=1410
 nat_traversal=yes
 virtual_private=%v4:10.0.0.0/8,%v4:172.16.0.0/12,%v4:192.168.0.0/16
 
 conn %default
 keyingtries=3
 compress=yes
 disablearrivalcheck=no
 authby=secret
 type=tunnel
 keyexchange=ike
 ikelifetime=240m
 keylife=60m
 
 conn roadwarrior-net
 leftsubnet=192.168.0.0/16
 also=roadwarrior
 
 conn roadwarrior-all
 leftsubnet=0.0.0.0/0
 also=roadwarrior
 
 conn roadwarrior-l2tp
 leftprotoport=17/0
 rightprotoport=17/1701
 also=roadwarrior
 
 conn roadwarrior-l2tp-updatedwin
 leftprotoport=17/1701
 rightprotoport=17/1701
 also=roadwarrior
 
 conn roadwarrior
 pfs=no
 left=150.150.150.150
 leftnexthop=150.150.150.1
 right=%any
 rightsubnet=vhost:%no,%priv
 auto=add
 # Disable Opportunistic Encryption
 include /etc/ipsec.d/examples/no_oe.conf

Het ip-adres “150.150.150.150” dien je te vervangen door je externe IP-adres, “150.150.150.1” vervang je door de default gateway.
Wijzig het bestand “/etc/ipsec.secrets” and typ het volgende:

 vi /etc/ipsec.secrets
 150.150.150.150 %any: PSK "sleuteltje"

Ook hier verander je “150.150.150.150.” naar je externe IP-adres.

L2tpd installatie en configuratie

Installeren van l2tpd en de patch toepassen:

 cd /usr/local/src
 tar zxf l2tpd-0.69.tar.gz
 mv l2tpd-0.69.sysv.patch l2tpd-0.69/
 mv l2tpd /etc/rc.d/init.d/
 cd l2tpd-0.69
 patch < l2tpd-0.69.sysv.patch
 make
 cp l2tpd /usr/sbin
 chmod 755 /usr/sbin/l2tpd

Start configuratie in orde brengen:

 chmod 755 /etc/rc.d/init.d/l2tpd
 chkconfig --add l2tpd
 chkconfig l2tpd on

De map "/etc/l2tpd" aanmaken en configuratiebestand erin stoppen (l2tpd.conf).

 [global]
 port = 1701
 [lns default]
 ip range = 192.168.1.101-192.168.1.254
 local ip = 192.168.1.100
 require chap = yes
 refuse pap = yes
 require authentication = yes
 name = LinuxVPN
 ppp debug = yes
 pppoptfile = /etc/ppp/options.l2tpd
 length bit = yes

PPP configuratie.
In "/etc/ppp/options.l2tpd"

 ipcp-accept-local
 ipcp-accept-remote
 noccp
 auth
 crtscts
 idle 1800
 mtu 1410
 mru 1410
 nodefaultroute
 debug
 lock
 proxyarp
 connect-delay 5000
 silent

"/etc/ppp/chap-secrets" wijzigen:
(voorbeeld van invoer)

 # Secrets for authentication using CHAP
 # client        server           secret            IP addresses
 username     *                 "wachtwoord"      192.168.1.0/24
 *                 username     "wachtwoord"      192.168.1.0/24

Nu kan je de VPN configuratie testen.

Informatie afkomstig van https://nl.wikibooks.org Wikibooks NL.
Wikibooks NL is onderdeel van de wikimediafoundation.