Здравствуйте, господа!
У меня такая проблема с mpd. Если линк оборвался и восстановился - MPD нормально стартует, но не создается туннель. Если MPD убить и стартовать заново вручную, то всё будет в порядке.
Вот примерно, что происходит.При первом запуске (или при загрузке системы, либо вручную) mpd -b всё нормально. MPD стартует и создает интерфейс ng0.
mpd: 89.178.172.22 -> 195.14.38.18
mpd: [vpn] IFACE: Up event
mpd: [vpn] setting interface ng0 MTU to 1460 bytes
mpd: [vpn] exec: /sbin/ifconfig ng0 89.178.172.22 195.14.38.18 netmask 0xffffffff -link0
mpd: [vpn] exec: /sbin/route add 89.178.172.22 -iface lo0
mpd: [vpn] exec: /usr/local/etc/mpd/link-up.sh ng0 inet 89.178.172.22 195.14.38.18 user
mpd: [vpn] IFACE: Up event
ng0: flags=88d1<UP,POINTOPOINT,RUNNING,NOARP,SIMPLEX,MULTICAST> mtu 1460
inet 89.178.127.220 --> 195.14.38.13 netmask 0xffffffff
При обрыве связи.
mpd: pptp0: read: Operation timed out
mpd: pptp0: killing connection with 195.14.38.18:1723
mpd: pptp0-0: killing channel
mpd: [vpn] PPTP call terminated
mpd: [vpn] IPCP: LayerDown
mpd: [vpn] IFACE: Down event
mpd: [vpn] exec: /usr/local/etc/mpd/link-down.sh ng0 inet kotov111
mpd: [vpn] exec: /sbin/route delete 89.178.172.22 -iface lo0
mpd: [vpn] exec: /sbin/ifconfig ng0 down delete -link0
mpd: [vpn] LCP: LayerDown
mpd: [vpn] device: OPEN event in state DOWN
ng0: flags=8890<POINTOPOINT,NOARP,SIMPLEX,MULTICAST> mtu 1500
При восстановлении связи.
mpd: [vpn] IFACE: Up event
mpd: [vpn] setting interface ng0 MTU to 1460 bytes
mpd: [vpn] exec: /sbin/ifconfig ng0 89.178.177.92 195.14.38.18 netmask 0xffffffff -link0
--Мне кажется, что здесь косяк--
mpd: [vpn] exec: command returned 256
mpd: [vpn] exec: /sbin/route add 89.178.177.92 -iface lo0
mpd: [vpn] exec: /usr/local/etc/mpd/link-up.sh ng0 inet 89.178.177.92 195.14.38.18 user
mpd: [vpn] IFACE: Up event
ng0: flags=88d1<UP,POINTOPOINT,RUNNING,NOARP,SIMPLEX,MULTICAST> mtu 1460
Интерфейс поднят, но туннеля нет. Интернета, соответсвенно, тоже!
[root@serv /usr/local/etc/mpd]# netstat -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 195.14.38.18 UGS 0 614 rl0
10 10.215.0.17 UGS 0 0 rl0
10.215/16 link#1 UC 0 0 rl0
10.215.0.17 00:15:fa:69:aa:c7 UHLW 5 0 rl0 1199
10.215.51.162 00:20:ed:bb:c9:21 UHLW 1 0 rl0 1179
10.215.253.1 00:15:58:07:dd:08 UHLW 1 0 rl0 1173
83.102/16 10.215.0.17 UGS 0 0 rl0
85.21/16 10.215.0.17 UGS 0 0 rl0
89.178.177.92 lo0 UHS 0 631 lo0
127.0.0.1 127.0.0.1 UH 0 0 lo0
192.168.0 link#2 UC 0 0 rl1
192.168.0.200 00:02:44:26:b7:24 UHLW 1 1330 rl1 809
195.14.38.18 10.215.0.17 UGHS 1 64 rl0
Тут вроде всё верно.
Привожу конфиги MPD
[root@serv /usr/local/etc/mpd]# cat mpd.conf
default:
load vpn
vpn:
new -i ng0 vpn vpn
set bundle disable multilink
set bundle authname user
set bundle password pass
set iface idle 0
set iface up-script /usr/local/etc/mpd/link-up.sh
set iface down-script /usr/local/etc/mpd/link-down.sh
set link keep-alive 60 300
set link accept chap
set link no pap
set bundle disable compression
set ccp yes mpp-e40
set ccp no mpp-e128
set bundle disable crypt-reqd
set ccp no mpp-stateless
set ipcp no vjcomp
set link mtu 1460
open
[root@serv /usr/local/etc/mpd]# cat mpd.links
vpn:
set link type pptp
set pptp peer vpn.spb.corbina.net
set pptp enable originate incoming outcall
[root@serv /usr/local/etc/mpd]# cat link-up.sh
#!/bin/sh
route delete $4
route add $4 10.215.0.17
default_route_old=`route -n get default 2>&1 | grep gateway | awk '{print $2}'`
if [ $default_route_old ]; then
echo $default_route_old > /var/tmp/default_route
route -nq change default $4
else
rm -f /var/tmp/default_route
route -nq add default $4
fi
/sbin/pfctl -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp >> /var/tmp/link_up 2>&1
/sbin/pfctl -g -f /etc/pf.clear.conf >> /var/tmp/link_up
[root@serv /usr/local/etc/mpd]# cat link-down.sh
#!/bin/sh
if [ -r /var/tmp/default_route ]; then
default_route_old=`cat /var/tmp/default_route`
rm -f /var/tmp/default_route
route -nq change default $default_route_old
else
route -nq delete default
fi
/sbin/pfctl -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp >> /var/tmp/link_down 2>&1
/sbin/pfctl -g -f /etc/pf.clear.conf >> /var/tmp/link_down
Система FreeBSD 6.2-PRERELEASE
[admin@serv ~]$ mpd -v
Version 3.18
Заранее спасибо за помощь.