Привет! Есть скрипт запуска vpn канала:
#!/bin/bash
iptables -F
pon vpn2
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sleep 20
route add -net 192.168.212.0 netmask 255.255.255.0 dev ppp0
sleep 10
# разрешаем доступ локальной сети к vpn каналу
iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o ppp0 -j MASQUERADE
При ручном запуске или перезагрузке машинки скрипт отрабатывает.
При запуске из под крона. Не работает.
00 11 * * * /bin/bash /usr/local/bin/vpn2.sh
00 11 * * * /usr/local/bin/vpn2.sh
Логи.
Канал не поднимается:
using channel 7
Using interface ppp0
Connect: ppp0 <--> /dev/pts/0
sh: 1: pptp: not found
Modem hangup
Connection terminated.
Script pptp vpn2.test.ru --nolaunchpppd finished (pid 2760), status = 0x7f
При ручном запуске. Канал поднялся:
using channel 8
Using interface ppp0
Connect: ppp0 <--> /dev/pts/0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xeb0e2b2d> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x0 <mru 1400> <auth chap MS-v2> <magic [br] 0x573603ef> <pcomp> <accomp> <callback CBCP> <mrru 1614> <endpoint [local:7d.90.61.80.ae.c2.4a.$
sent [LCP ConfRej id=0x0 <callback CBCP> <mrru 1614>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xeb0e2b2d> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <mru 1400> <auth chap MS-v2> <magic 0x573603ef> <pcomp> <accomp> <endpoint [local:7d.90.61.80.ae.c2.4a.a3.94.54.11.b9.7d.e1.74.f3.0$
sent [LCP ConfAck id=0x1 <mru 1400> <auth chap MS-v2> <magic 0x573603ef> <pcomp> <accomp> <endpoint [local:7d.90.61.80.ae.c2.4a.a3.94.54.11.b9.7d.e1.74.f3.0$
rcvd [CHAP Challenge id=0x0 <93a26deae08e4ad261ae90e9c006d4b6>, name = "MVPN2"]
sent [CHAP Response id=0x0 <ea28b54f3ce788d5099e2e0a67a1efe50000000000000000f1d319ce9fe36fb611b85f1194b366714d7bb3a34af6ed7000>, name = "ch"]
rcvd [CHAP Success id=0x0 "S=D55E1E70A92800A1BEC50E7A07FAAC4564B722E6"]
CHAP authentication succeeded
sent [CCP ConfReq id=0x1 <mppe +H -M +S -L -D -C>]
rcvd [CCP ConfReq id=0x3 <mppe +H -M -S -L -D +C>]
sent [CCP ConfNak id=0x3 <mppe +H -M +S -L -D -C>]
rcvd [IPCP ConfReq id=0x4 <addr 10.0.0.61>]
sent [IPCP TermAck id=0x4]
rcvd [CCP ConfAck id=0x1 <mppe +H -M +S -L -D -C>]
rcvd [CCP ConfReq id=0x5 <mppe +H -M +S -L -D -C>]
sent [CCP ConfAck id=0x5 <mppe +H -M +S -L -D -C>]
MPPE 128-bit stateless compression enabled
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0>]
rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
sent [IPCP ConfReq id=0x2 <addr 0.0.0.0>]
rcvd [IPCP ConfNak id=0x2 <addr 10.0.0.67>]
sent [IPCP ConfReq id=0x3 <addr 10.0.0.67>]
rcvd [IPCP ConfAck id=0x3 <addr 10.0.0.67>]
rcvd [IPCP ConfReq id=0x6 <addr 10.0.0.61>]
sent [IPCP ConfAck id=0x6 <addr 10.0.0.61>]
local IP address 10.0.0.67
remote IP address 10.0.0.61
Script /etc/ppp/ip-up started (pid 2801)
Script /etc/ppp/ip-up finished (pid 2801), status = 0x0