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
piaakitAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Webinar: Cyber Crime Becomes Big Business

The rising threat of malware-as-a-service is not one to be overlooked. Malware-as-a-service is growing and easily purchased from a full-service cyber-criminal store in a “Virus Depot” fashion. Join us in our upcoming webinar as we discuss how to best defend against these attacks!

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CentOS

From novice to tech pro — start learning today.