• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

Centos 7 L2TP problem

Dear all

                   I,m getting below error when running "IPsec setup start" , and bottom is the ipsec.conf , any help would be appreciated !


====================================================
[root@LinuxHomeServer ipsec.d]# ipsec setup start
cannot load config '/etc/ipsec.conf': /etc/ipsec.conf:48: syntax error, unexpected KEYWORD, expecting $end [virtual_private]
cannot load config '/etc/ipsec.conf': /etc/ipsec.conf:48: syntax error, unexpected KEYWORD, expecting $end [virtual_private]
cannot load config '/etc/ipsec.conf': /etc/ipsec.conf:48: syntax error, unexpected KEYWORD, expecting $end [virtual_private]
unknown stack
Redirecting to: systemctl start ipsec.service
Job for ipsec.service failed because the control process exited with error code. See "systemctl status ipsec.service" and "journalctl -xe" for details.
============================================================


vim /etc/ipsec.conf

virtual_private=%v4:192.168.0.0/16

conn=L2TP-PSK-NAT
rightsubnet=vhost:%priv
also=L2TP-PSK-noNAT
conn L2TP-PSK-noNAT
authby=secret
pfs=no
auto=add
keyingtries=3
dpddelay=30
dpdtimeout=120
dpdaction=clear
rekey=no
ikelifetime=8h
keylife=1h
type=transport
left=XX.XX.XX.XX
leftprotoport=17/1701
right=%any
rightprotoport=17/%any
0
piaakit
Asked:
piaakit
  • 2
  • 2
  • 2
2 Solutions
 
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Well something's certainly off.

The error message you get relates to line #48 + your conf file you posted only has 21 lines.

Might be unprintable characters in the file (vim + :set list will show these)...

Maybe http://www.golinuxhub.com/2012/10/unexpected-keyword-expecting-end-type.html is the correct fix for your problem too.

Your lines seem to be left justified, rather than containing the required leading TAB character (for many lines).

If you still can't find the problem, attach your complete config file (as-is, no modifications) + likely someone can determine a fix.
0
 
piaakitAuthor Commented:
vim /etc/ipsec.conf

virtual_private=%v4:192.168.0.0/16        <----- this is the sentence detected has problem,

conn=L2TP-PSK-NAT
rightsubnet=vhost:%priv
also=L2TP-PSK-noNAT
conn L2TP-PSK-noNAT
authby=secret
pfs=no
auto=add
keyingtries=3
dpddelay=30
dpdtimeout=120
dpdaction=clear
rekey=no
ikelifetime=8h
keylife=1h
type=transport
left=XX.XX.XX.XX
leftprotoport=17/1701
right=%any
rightprotoport=17/%any
0
 
nociSoftware EngineerCommented:
it should look like:
config setup
    ....
    virtual_private=...

conn L2TP-PSK-NAT
    rightsubnet=vhost:%priv
    also=L2TP-PSK-noNAT
    conn L2TP-PSK-noNAT
   ....

Open in new window


if everything is left aligned it will not work.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
piaakitAuthor Commented:
I,m still getting the same error, now already not aligned to left

[root@LinuxHomeServer ~]# ipsec setup start
cannot load config '/etc/ipsec.conf': /etc/ipsec.conf:58: syntax error, unexpected KEYWORD, expecting $end [virtual_private]
cannot load config '/etc/ipsec.conf': /etc/ipsec.conf:58: syntax error, unexpected KEYWORD, expecting $end [virtual_private]
unknown stack
Redirecting to: systemctl start ipsec.service
Job for ipsec.service failed because the control process exited with error code. See "systemctl status ipsec.service" and "journalctl -xe" for details.


===========================================
virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12,%v4:25.0.0.0/8,%v4:100.64.0.0/10,%v6:fd00::/8,%v6:fe80::/10
conn L2TP-PSK-NAT
    rightsubnet=vhost:%priv
    also=L2TP-PSK-noNAT
#conn L2TP-PSK-noNAT
        authby=secret
        pfs=no
        auto=add
        keyingtries=3
        dpddelay=30
        dpdtimeout=120
        dpdaction=clear
        rekey=no
        ikelifetime=8h
        keylife=1h
        type=transport
        left=xx.xx.xx.xx
        leftprotoport=17/1701
        right=%any
        rightprotoport=17/%any
0
 
nociSoftware EngineerCommented:
The virtual private in your output seems to be left aligned.... it needs to be indented under config.

the unindented comment will cause a break in the conn. specification as well.
0
 
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Poster has stopped posting.

Flagged two answers, which provided same information.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now