I'm trying to get a L2TP VPN working using npppd; I think I'm most of the
way there but packets just aren't quite flowing. I'm not sure why, but I
think I might be missing something or misunderstanding something with pf.

I've got ipsec=YES and isakmpd_flags="-K" in rc.conf.local,  and
/etc/ipsec.conf configured as:

-----
ike passive esp transport \
        proto udp from 96.251.22.154 to any port 1701 \
        psk "somesekretkeyhere"
-----

My /etc/npppd/npppd.conf is:

-----
authentication LOCAL type local {
        users-file "/etc/npppd/npppd-users"
}

tunnel L2TP_ipv4 protocol l2tp {
        listen on 96.251.22.154
}

ipcp IPCP {
        pool-address 10.128.120.2-10.128.120.254
        dns-servers 10.128.0.4
}

interface pppx0 address 10.128.120.1 ipcp IPCP
bind tunnel from L2TP_ipv4 authenticated by LOCAL to pppx0
-----

I currently have the following in pf.conf:

-----
pass quick proto { esp, ah } from any to any
pass in quick on em1 proto udp from any to 96.251.22.154 port {500, 4500,
1701} keep state
set skip on enc0
set skip on pppx0
-----

I'm pretty sure I have the ipsec/npppd pieces correct, as I am successfully
able to connect to the VPN:

-----
2014-02-26 15:35:01:NOTICE: l2tpd ctrl=2 logtype=Started RecvSCCRQ
from=134.71.203.230:644
68/udp tunnel_id=2/6 protocol=1.0 winsize=4 hostname=Dogbert vendor=(no
vendorname) firm=0
000
2014-02-26 15:35:01:INFO: l2tpd ctrl=2 SendSCCRP
2014-02-26 15:35:01:INFO: l2tpd ctrl=2 RecvSCCN
2014-02-26 15:35:01:INFO: l2tpd ctrl=2 SendZLB
2014-02-26 15:35:01:INFO: l2tpd ctrl=2 call=21438 RecvICRQ session_id=3388
2014-02-26 15:35:01:INFO: l2tpd ctrl=2 call=21438 SendICRP session_id=21438
2014-02-26 15:35:01:INFO: l2tpd ctrl=2 call=21438 RecvICCN session_id=3388
calling_number=
 tx_conn_speed=1000000 framing=async
2014-02-26 15:35:01:NOTICE: l2tpd ctrl=2 call=21438 logtype=PPPBind ppp=1
2014-02-26 15:35:01:INFO: ppp id=1 layer=base logtype=Started
tunnel=L2TP_ipv4(134.71.203.
230:64468)
2014-02-26 15:35:01:INFO: l2tpd ctrl=2 call=21438 SendZLB
2014-02-26 15:35:04:INFO: ppp id=1 layer=lcp logtype=Opened mru=1360/1360
auth=MS-CHAP-V2 
magic=c638067d/52525adf
2014-02-26 15:35:04:INFO: ppp id=1 layer=chap proto=mschap_v2
logtype=Success username="he
nson" realm=LOCAL
2014-02-26 15:35:04:INFO: ppp id=1 layer=ipcp IP Address peer=0.0.0.0
our=10.128.120.160.
2014-02-26 15:35:04:INFO: ppp id=1 layer=base unhandled protocol ipv6cp,
32855(8057)
2014-02-26 15:35:04:INFO: ppp id=1 layer=base unhandled protocol acsp,
33333(8235)
2014-02-26 15:35:04:INFO: ppp id=1 layer=ccp CCP is stopped
2014-02-26 15:35:04:INFO: ppp id=1 layer=ipcp logtype=Opened
ip=10.128.120.160 assignType=
dynamic
2014-02-26 15:35:04:NOTICE: ppp id=1 layer=base logtype=TUNNELSTART
user="henson" duration
=4sec layer2=L2TP_ipv4 layer2from=134.71.203.230:64468 auth=MS-CHAP-V2
ip=10.128.120.160 
iface=pppx0
2014-02-26 15:35:04:NOTICE: ppp id=1 layer=base Using pipex=yes
-----

However, from the VPN client I cannot ping 10.128.120.1, the server
endpoint, and from the server I cannot ping 10.128.120.160, the client
endpoint. When I try to ping the client, I can see traffic on the ethernet
interface:

16:07:56.431711 esp bart.pbhware.com >
host-134-71-203-230.allocated.csupomona.edu spi 0x04e9efec seq 32 len 148
(DF)
16:07:57.441732 esp bart.pbhware.com >
host-134-71-203-230.allocated.csupomona.edu spi 0x04e9efec seq 33 len 148
(DF)
16:07:58.451762 esp bart.pbhware.com >
host-134-71-203-230.allocated.csupomona.edu spi 0x04e9efec seq 34 len 148
(DF)

And on the enc0 interface:

16:07:52.391543 (authentic,confidential): SPI 0x04e9efec:
bart.pbhware.com.l2tp > host-134-71-203-230.allocated.csupomona.edu.51118:
l2tp:[LS](8/3432)Ns=21,Nr=65535[hdlc|][|l2tp]
16:07:53.401575 (authentic,confidential): SPI 0x04e9efec:
bart.pbhware.com.l2tp > host-134-71-203-230.allocated.csupomona.edu.51118:
l2tp:[LS](8/3432)Ns=22,Nr=65535[hdlc|][|l2tp]

Conversely, when I try to ping the server from the client:

16:09:42.857872 esp host-134-71-203-230.allocated.csupomona.edu >
bart.pbhware.com spi 0x506039f8 seq 96 len 148
16:09:42.857875 esp host-134-71-203-230.allocated.csupomona.edu >
bart.pbhware.com spi 0x506039f8 seq 96 len 148
16:09:43.855422 esp host-134-71-203-230.allocated.csupomona.edu >
bart.pbhware.com spi 0x506039f8 seq 97 len 148

16:09:43.855454 (authentic,confidential): SPI 0x506039f8:
host-134-71-203-230.allocated.csupomona.edu.51118 > bart.pbhware.com.l2tp:
l2tp:[L](1/12490)[hdlc|][|l2tp]
16:09:44.855469 (authentic,confidential): SPI 0x506039f8:
host-134-71-203-230.allocated.csupomona.edu.51118 > bart.pbhware.com.l2tp:
l2tp:[L](1/12490)[hdlc|][|l2tp]
16:09:45.855498 (authentic,confidential): SPI 0x506039f8:
host-134-71-203-230.allocated.csupomona.edu.51118 > bart.pbhware.com.l2tp:
l2tp:[L](1/12490)[hdlc|][|l2tp]

Ideally, I would like to completely disable pf at this point to confirm that
is the problem, but unfortunately it is a production router and I can't
really do that 8-/.

Am I missing something in either the ipsec, npppd, or pf configuration?

For this rule "pass quick proto { esp, ah } from any to any", does it really
need to be any to any with no interface defined? Wouldn't all of the ipsec
traffic be on the WAN interface to/from the WAN IP? While I think this piece
is working, I'd rather have the rule exactly match what is needed than be
extra generic.

Regarding this rule "pass in quick on em1 proto udp from any to
96.251.22.154 port {500, 4500, 1701} keep state", it looks like the
connection to the l2tp port is over the ipsec tunnel and hence via enc0, not
em1? So it doesn't seem 1701 needs to be allowed in on this rule, I removed
it and it continued to work, at least as far as successfully connecting but
not passing traffic over the VPN link <sigh>.

In the various postings and how-tos I came across, some of them said to use
"set skip on enc0", others had explicit if-bound pass in and pass out rules.
I tried the latter first, but the packets still seemed to be being blocked
by my default block rule, so I ended up using skip. Not sure if that's best.

In the examples I was reviewing, I didn't see any specific rules for pppx,
but I noticed packets being blocked:

Feb 26 15:38:16.304766 rule 38/(match) block out on pppx0: 10.128.120.1 >
10.128.120.160: icmp: echo request

So I added "set skip on pppx0", but it still didn't work, although I don't
see any blocked packets being logged.

So. Any thoughts?

Thanks.

Reply via email to