# FreeBSD + MPD 5.6 Bad provider



## CrueL (Jun 16, 2013)

Not connected to the VPN, below configs in mdp.conf all lines through the tabs, and not through the gaps, sh files up.sh and down.sh with human performance, they are executed as will be seen below, please help!

up.sh 

```
#!/bin/sh
gw=`10.176.12.1` 
route delete $4    
route add $4 $gw    
route delete default 
route add default $4 

echo $4  > /tmp/mpd_dr 
sleep 20
```
down.sh

```
#!/bin/sh 
dr=`cat /tmp/mpd_dr` 
gw=`10.176.12.1`    
route delete $dr 
route delete default    
route add default $gw 
rm -f /tmp/mpd_dr
```
mpd.conf

```
startup: 
	set user <*****> <*****> admin 
	set console self 127.0.0.1 5005            
	set console open        
	set web self 127.0.0.1 5006         
	set web open                  
default: 
	load L2TP 
L2TP:            
	create bundle static L2TP
	set ipcp no vjcomp
	set iface idle 0
	set iface enable nat
	set iface enable tcpmssfix
	set iface up-script /usr/local/etc/mpd5/up.sh
	set iface down-script /usr/local/etc/mpd5/down.sh
	create link static L2 l2tp
	set link action bundle L2TP
	set link mtu 1400
	set link latency 0
	set link max-redial 0
	set link redial-delay 60
	set link accept chap
	set link keep-alive 10 75
	set l2tp peer tp.internet.beeline.ru
	set auth authname *****
	set auth password *****
	open
```
rc.conf

```
hostname="FreeBSD"
keymap="ru.koi8-r.kbd"
ftpd_enable="YES"
ifconfig_dc0=" inet 192.168.0.1 netmask 255.255.255.0"
defaultrouter="10.176.12.1"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
ifconfig_fxp0="DHCP"

mpd_enable="YES"
mpd_flags="-b"
```
Here is what the demon MPD

```
[CMD=root@FreeBSD:/usr/local/etc/mpd5 #]mpd5[/CMD]
Multi-link PPP daemon for FreeBSD

process 2376 started, version 5.6 (root@localhost 00:04 13-Apr-2013)
CONSOLE: listening on 127.0.0.1 5005
web: listening on 127.0.0.1 5006
[L2TP] Bundle: Interface ng0 created
[L2] [L2] Link: OPEN event
[L2] LCP: Open event
[L2] LCP: state change Initial --> Starting
[L2] LCP: LayerStart
L2TP: Initiating control connection 0x28806108 0.0.0.0 0 <-> 172.18.224.14 1701
L2TP: Control connection 0x28806108 10.176.14.186 47786 <-> 172.18.224.14 1701 connected
[L2] L2TP: Incoming call #1880000 via control connection 0x28806108 initiated
[L2] L2TP: Call #1880000 connected
[L2] Link: UP event
[L2] LCP: Up event
[L2] LCP: state change Starting --> Req-Sent
[L2] LCP: SendConfigReq #1
[L2] MRU 1500
[L2] LCP: rec'd Configure Request #1 (Req-Sent)
[L2] MRU 1460
[L2] AUTHPROTO PAP
[L2] MAGICNUM ce701c7e
[L2] LCP: SendConfigRej #1
[L2] MAGICNUM ce701c7e
[L2] LCP: rec'd Configure Ack #1 (Req-Sent)
[L2] MRU 1500
[L2] LCP: state change Req-Sent --> Ack-Rcvd
[L2] LCP: rec'd Configure Request #2 (Ack-Rcvd)
[L2] MRU 1460
[L2] AUTHPROTO PAP
[L2] LCP: SendConfigNak #2
[L2] AUTHPROTO CHAP MD5
[L2] LCP: rec'd Configure Request #3 (Ack-Rcvd)
[L2] MRU 1460
[L2] AUTHPROTO CHAP MD5
[L2] LCP: SendConfigAck #3
[L2] MRU 1460
[L2] AUTHPROTO CHAP MD5
[L2] LCP: state change Ack-Rcvd --> Opened
[L2] LCP: auth: peer wants CHAP, I want nothing
[L2] LCP: LayerUp
[L2] CHAP: rec'd CHALLENGE #1 len: 33
[L2] Name: "bras254.nnov"
[L2] CHAP: Using authname "0897284072"
[L2] CHAP: sending RESPONSE #1 len: 31
[L2] CHAP: rec'd SUCCESS #1 len: 4
[L2] LCP: authorization successful
[L2] Link: Matched action 'bundle "L2TP" ""'
[L2] Link: Join bundle "L2TP"
[L2TP] Bundle: Status update: up 1 link, total bandwidth 64000 bps
[L2TP] IPCP: Open event
[L2TP] IPCP: state change Initial --> Starting
[L2TP] IPCP: LayerStart
[L2TP] IPCP: Up event
[L2TP] IPCP: state change Starting --> Req-Sent
[L2TP] IPCP: SendConfigReq #1
[L2TP] IPADDR 10.176.14.186
[L2TP] IPCP: rec'd Configure Request #1 (Req-Sent)
[L2TP] IPADDR 92.242.92.246
[L2TP] 92.242.92.246 is OK
[L2TP] IPCP: SendConfigAck #1
[L2TP] IPADDR 92.242.92.246
[L2TP] IPCP: state change Req-Sent --> Ack-Sent
[L2TP] IPCP: rec'd Configure Nak #1 (Ack-Sent)
[L2TP] IPADDR 212.92.138.236
[L2TP] 212.92.138.236 is OK
[L2TP] IPCP: SendConfigReq #2
[L2TP] IPADDR 212.92.138.236
[L2TP] IPCP: rec'd Configure Ack #2 (Ack-Sent)
[L2TP] IPADDR 212.92.138.236
[L2TP] IPCP: state change Ack-Sent --> Opened
[L2TP] IPCP: LayerUp
[L2TP] 212.92.138.236 -> 92.242.92.246
[L2TP] IFACE: Up event
[L2] LCP: rec'd Terminate Request #4 (Opened)
[L2] LCP: state change Opened --> Stopping
[L2] Link: Leave bundle "L2TP"
[L2TP] Bundle: Status update: up 0 links, total bandwidth 9600 bps
[L2TP] IPCP: Close event
[L2TP] IPCP: state change Opened --> Closing
[L2TP] IPCP: SendTerminateReq #3
[L2TP] IPCP: LayerDown
[L2TP] IFACE: Down event
[L2TP] IPCP: Down event
[L2TP] IPCP: LayerFinish
[L2TP] Bundle: No NCPs left. Closing links...
[L2TP] IPCP: state change Closing --> Initial
[L2] LCP: SendTerminateAck #2
[L2] LCP: LayerDown
[L2] L2TP: call #1880000 terminated: result=2 error=6 errmsg="Locally generated disconnect" :bang:
[L2] Link: DOWN event
[L2] LCP: Down event
[L2] LCP: state change Stopping --> Starting
[L2] Link: reconnection attempt 1 in 62 seconds
L2TP: Control connection 0x28806108 terminated: 0 (no more sessions exist in this tunnel) :bang:
L2TP: Control connection 0x28806108 destroyed
[L2] Link: reconnection attempt 1
```
Plus it

```
[CMD=root@FreeBSD:/etc #]netstat -rn[/CMD]
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
10.0.0.0/8         10.176.12.1        UGS         0       47   fxp0
10.176.12.0/22     link#6             U           0        3   fxp0
10.176.14.189      link#6             UHS         0        0    lo0
78.107.196.0/22    10.176.12.1        UGS         0        0   fxp0
127.0.0.1          link#9             UH          0        0    lo0
192.168.0.0/24     link#7             U           0     1098    dc0
192.168.0.1        link#7             UHS         0        0    lo0

Internet6:
Destination                       Gateway                       Flags      Netif Expire
::/96                             ::1                           UGRS        lo0
::1                               link#9                        UH          lo0
::ffff:0.0.0.0/96                 ::1                           UGRS        lo0
fe80::/10                         ::1                           UGRS        lo0
fe80::%dc0/64                     link#7                        U           dc0
fe80::208:a1ff:fe9a:1e7d%dc0      link#7                        UHS         lo0
fe80::%lo0/64                     link#9                        U           lo0
fe80::1%lo0                       link#9                        UHS         lo0
ff01::%dc0/32                     fe80::208:a1ff:fe9a:1e7d%dc0  U           dc0
ff01::%lo0/32                     ::1                           U           lo0
ff02::/16                         ::1                           UGRS        lo0
ff02::%dc0/32                     fe80::208:a1ff:fe9a:1e7d%dc0  U           dc0
ff02::%lo0/32                     ::1                           U           lo0

[CMD=root@FreeBSD:/etc #]ifconfig[/CMD]
fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=2009<RXCSUM,VLAN_MTU,WOL_MAGIC>
        ether 00:0c:76:17:fe:b7
        inet 10.176.14.189 netmask 0xfffffc00 broadcast 10.176.15.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
dc0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80008<VLAN_MTU,LINKSTATE>
        ether 00:08:a1:9a:1e:7d
        inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255
        inet6 fe80::208:a1ff:fe9a:1e7d%dc0 prefixlen 64 scopeid 0x7
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
plip0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> metric 0 mtu 1500
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x9
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
ng0: flags=8890<POINTOPOINT,NOARP,SIMPLEX,MULTICAST> metric 0 mtu 1500
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
ng1: flags=8890<POINTOPOINT,NOARP,SIMPLEX,MULTICAST> metric 0 mtu 1500
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
```


----------



## CrueL (Jun 18, 2013)

Here is the configuration for those who have a similar problem! The problem was up.sh.

up.sh working:

```
#!/bin/sh
gw=`netstat -rn | awk '$1=="default"{print $2}'`
route delete $4
route add $4 $gw
route delete default
route add $8 $gw
route add default $4
echo $4 > /tmp/mpd_dr
echo $gw > /tmp/mpd_gw
sleep 20
```
If anyone should put all the configurations..


----------

