1. Install the client software using XL2TPD,PPP
Yum Install-y xl2tpd PPP
2. Configure XL2TPD
Vim/etc/xl2tpd/xl2tpd.conf
Append the following code at the bottom
[Lac Gomez]
Name = Aomeng
LNS = www.gomezddup.com
Pppoptfile =/etc/ppp/peers/gomez.l2tpd
PPP debug = No
Save
Description
Gomez is the connection name, which is required after the control connection
Name is the user name of the account, assigned by the server
LNS is the server IP address
Pppoptfile for connection options
3. Configure option Data
Vim/etc/ppp/peers/gomez.l2tpd
Add the following code:
RemoteName Gomez
User "Aomeng"
Password "123qwe"
Unit 0
Lock
Debug
Kdebug 1
MTU 1000
Lcp-echo-interval 10
Lcp-echo-failure 10
Nobsdcomp
Nodeflate
Noaccomp
Nopcomp
Novj
Defaultroute
Save
4. Start
Execute the following two commands
Service XL2TPD Start
Echo ' C Gomez ' >/var/run/xl2tpd/l2tp-control
5. Check if the connection is established
Execute command
Ifconfig
If the PPP0 network card is already established connection, otherwise there is an error, check the/var/log/message log troubleshooting issues
6. Add the xxx LAN route
Route add-net 172.172.0.0/16 Dev ppp0
7. Maintenance
Connection:
Service XL2TPD Restart
Echo ' C Gomez ' >/var/run/xl2tpd/l2tp-control
To disconnect PVN:
Echo ' d Gomez ' >/var/run/xl2tpd/l2tp-control
8. Problems encountered
Every 1.4 minutes automatically disconnects,/var/log/message log as follows
Jul 5 19:47:43 gomezddup xl2tpd[3511]: Maximum retries exceeded for tunnel 47411. Closing.
Jul 5 19:47:43 gomezddup xl2tpd[3511]: Connection 65153 closed to 192.168.21.123, Port 1701 (Timeout)
Jul 5 19:47:4 3 Gomezddup pppd[3513]: terminating on signal
Jul 5 19:47:43 gomezddup pppd[3513]: Modem hangup
Jul 5 19:47:43 Go Mezddup pppd[3513]: Connect time 1.4 minutes.
Jul 5 19:47:43 gomezddup pppd[3513]: Sent 0 bytes, received 0 bytes.
Jul 5 19:47:43 gomezddup pppd[3513]: Connection terminated.
Jul 5 19:47:44 gomezddup pppd[3513]: Exit.
The above questions the author after Google, Baidu search a lot of data also failed to solve, after man pppd carefully read, bold to make a guess, xl2tpd connection XXX server, call PPPD to dial, after establishing a connection, Echo-request requests are sent to the server every few seconds, and if the server is not responding in time for some reason (only for network reasons), PPPD will automatically break the link after sending several requests. and/etc/ppp/peers/gomez.l2tpd in Lcp-echo-interval lcp-echo-failure These two configuration is to set this. According to the information on the Internet, the author changed it to 0. This issue still occurs when you dial the connection again. Mans PPPD
Lcp-echo-failure N
If this option is given, pppd'll presume the peer to being dead if n LCP echo-requests is sent without receiving a valid L CP echo-reply. If this happens, pppd'll terminate the connection. Use of
This option requires a Non-zero value for the Lcp-echo-interval parameter. This option can is used to enable PPPD to terminate after the physical connection have been broken (e.g., the modem has
Hung up) in situations where no hardware modem control lines is available.
English is not very good, but probably translated one of the words seems to be the value of this option should be not 0. So try to change it a little bit bigger. Redial, view the log, or disconnect after a few minutes. Finally after several attempts to modify, found that only the Lcp-echo-interval lcp-echo-failure these two values are set to 10, will not be disconnected, I do not understand why now? (If anyone knows, you can leave a message to enlighten me)
Linux L2TP client Configuration and resolve PPPD disconnection issues