0

I want to create multiple pptp client with docker, every pptp docker instance should have independent ppp network interface, so docker --network parameter must be [bridge],but i got trouble[LCP: timeout sending Config-Requests] when instance starting.

Dockerfile

FROM golang:1.9-alpine as source
MAINTAINER wlw

RUN apk add --no-cache \
            --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \
            pptpclient

COPY entrypoint.sh /entrypoint.sh
RUN mkdir -p /go/src/pptp
WORKDIR /go/src/pptp
COPY . /go/src/pptp
RUN go build -o app
#RUN echo 1 > /proc/sys/net/netfilter/nf_conntrack_helper
ENTRYPOINT ["/entrypoint.sh"]

CMD ["/bin/bash"]

entrypoint.sh

#!/bin/sh
#echo  net.ipv4.ip_forward=1 /etc/sysctl.conf
echo 1 > /proc/sys/net/netfilter/nf_conntrack_helper
 modprobe nf_conntrack_pptp
cat > /etc/ppp/peers/${TUNNEL} <<_EOF_
pty "pptp ${SERVER} --nolaunchpppd"
name "${USERNAME}"
password "${PASSWORD}"
remotename PPTP
file /etc/ppp/options.pptp
ipparam "${TUNNEL}"
_EOF_

cat > /etc/ppp/ip-up <<"_EOF_"
#!/bin/sh
ip route add 0.0.0.0/1 dev $1
ip route add 128.0.0.0/1 dev $1
_EOF_

cat > /etc/ppp/ip-down <<"_EOF_"
#!/bin/sh
ip route del 0.0.0.0/1 dev $1
ip route del 128.0.0.0/1 dev $1
_EOF_
 modprobe nf_conntrack_pptp
exec pon ${TUNNEL} debug dump logfd 2 nodetach persist "$@"

main.go [test pptp client ip]

package main

import (
    "fmt"
    "io/ioutil"
    "net/http"
    "time"
)

func main() {
    count := 0
    for {
        fmt.Println("count:",count)
        time.Sleep(time.Second *2)
        req, err := http.NewRequest(http.MethodGet, "http://45.40.198.155:1234", nil)
        if err != nil {
            panic(err)
        }
        res, err := http.DefaultClient.Do(req)
        if err != nil {
            panic(err)
        }
        data, err := ioutil.ReadAll(res.Body)
        fmt.Println(string(data))
    }

}

I changed centos version,and docker version, but also got the same error. By the way, centos runing on VMware Fusion,which version is 7.2,and docker version is 19.03.1

Docker run command

docker run -it  --restart always --privileged -e SERVER=hb660.3322.org -e TUNNEL=vps -e USERNAME=xe5602 -e PASSWORD=621  --network=bridge   pptp:test

Here is the log

pppd options in effect:
debug       # (from command line)
nodetach        # (from command line)
persist     # (from command line)
logfd 2     # (from command line)
dump        # (from command line)
noauth      # (from /etc/ppp/options.pptp)
refuse-pap      # (from /etc/ppp/options.pptp)
refuse-chap     # (from /etc/ppp/options.pptp)
refuse-mschap       # (from /etc/ppp/options.pptp)
refuse-eap      # (from /etc/ppp/options.pptp)
name xe5602     # (from /etc/ppp/peers/vps)
password ??????     # (from /etc/ppp/peers/vps)
remotename PPTP     # (from /etc/ppp/peers/vps)
        # (from /etc/ppp/options.pptp)
pty pptp hb660.3322.org --nolaunchpppd      # (from /etc/ppp/peers/vps)
ipparam vps     # (from /etc/ppp/peers/vps)
nobsdcomp       # (from /etc/ppp/options.pptp)
nodeflate       # (from /etc/ppp/options.pptp)
using channel 1
Using interface ppp0
Connect: ppp0 <--> /dev/pts/1
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x9cb1e5f2> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x9cb1e5f2> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x9cb1e5f2> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x9cb1e5f2> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x9cb1e5f2> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x9cb1e5f2> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x9cb1e5f2> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x9cb1e5f2> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x9cb1e5f2> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x9cb1e5f2> <pcomp> <accomp>]
LCP: timeout sending Config-Requests
Connection terminated.
Modem hangup

After macvlan,Two other questions have appeared

rcvd [CHAP Success id=0x1 "S=040A411772569943A96B9311C0FDA2AF5746BC47"]
CHAP authentication succeeded
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 192.168.101.202>]
rcvd [IPCP ConfReq id=0x1 <addr 200.6.211.68>]
sent [IPCP ConfAck id=0x1 <addr 200.6.211.68>]
rcvd [IPV6CP ConfReq id=0x1 <addr fe80::0000:0000:00f0:3213>]
Unsupported protocol 'IPv6 Control Protocol' (0x8057) received
sent [LCP ProtRej id=0x3 80 57 01 01 00 0e 01 0a 00 00 00 00 00 f0 32 13]
rcvd [proto=0x8281] 01 01 00 04
Unsupported protocol 'MPLSCP' (0x8281) received
sent [LCP ProtRej id=0x4 82 81 01 01 00 04]
rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
sent [IPCP ConfReq id=0x2 <addr 192.168.101.202>]
rcvd [IPCP ConfNak id=0x2 <addr 200.6.212.239>]
sent [IPCP ConfReq id=0x3 <addr 200.6.212.239>]
rcvd [IPCP ConfAck id=0x3 <addr 200.6.212.239>]
local  IP address 200.6.212.239
remote IP address 200.6.211.68
W.alieen
  • 1
  • 1
  • Not sure if it is the reason, but you are missing `--device=/dev/ppp` – Aron Aug 16 '19 at 01:26
  • Thank you for answer,it's same error when I add `--device=/dev/ppp`.I try to capture with tcpdump in container, and I found GRE can't arrive remote server,but i have no way to solve this problem – W.alieen Aug 17 '19 at 06:31
  • I was finding a similar problem. Seems that the `bridge` network driver does not support GRE, you either need to use `host` (which will change host network), or use `macvlan`. – Aron Aug 18 '19 at 06:51
  • Actually I think I've found your problem. The GRE packets aren't being NATed because by default Linux does not NAT that.. see https://www.google.com/url?sa=t&source=web&rct=j&url=https://unix.stackexchange.com/questions/274785/pptp-vpn-not-working-with-linux-router&ved=2ahUKEwj8sZTSgY3kAhVXFYgKHfKWCEgQjjgwAHoECAcQAQ&usg=AOvVaw03C1vBj3FLoLCFvEOwYtxl – Aron Aug 18 '19 at 18:09
  • Thank you! The `GRE` problem seems to be solved by using `macvlan`,But I got two other questions,`Unsupported protocol 'IPv6 Control Protocol' (0x8057) received` and `Unsupported protocol 'MPLSCP' (0x8281) received`,I add 'net.ipv6.conf.all.disable_ipv6=1' to `/etc/sysctl.conf` but still the same problem – W.alieen Aug 18 '19 at 18:29

0 Answers0