LINUX.ORG.RU
ФорумAdmin

xl2tp не поднимается при потере соединения

 , ,


1

1

Здравствуйте, дорогие Линуксойды!
Имеется проблема - раз в неделю отваливается интернет на шлюзе. Для возобновления требуется ручное вмешательство:

# ifdown eth1 && ifup eth1 && sleep 10 && systemctl restart xl2tpd.service

Аналогично при ручном выдергивание кабеля.

WAN (он же eth1) - поднимается и получает IP.
L2TP сервер провайдера и внутренние DNS-ы пингуются - т.е. route add default gw 10.65.16.1 все еще работает
Команда xl2tp переподключения не спасает: systemctl restart xl2tpd.service

Прошу помощи в лечение данного недуга!

Статус xl2tpd.service выдает следующее:

# systemctl status xl2tpd.service
● xl2tpd.service - LSB: layer 2 tunelling protocol daemon
   Loaded: loaded (/etc/init.d/xl2tpd)
   Active: active (running) since Wed 2017-03-08 05:47:42 CET; 2min 6s ago
  Process: 1580 ExecStop=/etc/init.d/xl2tpd stop (code=exited, status=0/SUCCESS)
  Process: 1584 ExecStart=/etc/init.d/xl2tpd start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/xl2tpd.service
           ├─ 805 /usr/sbin/pppd passive nodetach : name 0895239246 debug file /etc/ppp/options.xl2tp /dev/pts/0
           ├─1351 /usr/sbin/pppd passive nodetach : name 0895239246 debug file /etc/ppp/options.xl2tp /dev/pts/2
           └─1588 /usr/sbin/pppd passive nodetach : name 0895239246 debug file /etc/ppp/options.xl2tp /dev/pts/3

Mar 08 05:48:45 cubieboard2 pppd[1588]: Failed to open /dev/pts/3: No such file or directory
Mar 08 05:48:45 cubieboard2 pppd[1588]: Failed to open /dev/pts/3: No such file or directory
Mar 08 05:48:52 cubieboard2 pppd[805]: Failed to open /dev/pts/0: No such file or directory
Mar 08 05:49:08 cubieboard2 pppd[1351]: Failed to open /dev/pts/2: No such file or directory

А при подключенном соединение:
# systemctl status xl2tpd.service
● xl2tpd.service - LSB: layer 2 tunelling protocol daemon
   Loaded: loaded (/etc/init.d/xl2tpd)
   Active: active (running) since Wed 2017-03-08 05:51:26 CET; 39s ago
  Process: 1766 ExecStop=/etc/init.d/xl2tpd stop (code=exited, status=0/SUCCESS)
  Process: 1770 ExecStart=/etc/init.d/xl2tpd start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/xl2tpd.service
           ├─ 805 /usr/sbin/pppd passive nodetach : name 0895239246 debug file /etc/ppp/options.xl2tp /dev/pts/0
           ├─1351 /usr/sbin/pppd passive nodetach : name 0895239246 debug file /etc/ppp/options.xl2tp /dev/pts/2
           ├─1588 /usr/sbin/pppd passive nodetach : name 0895239246 debug file /etc/ppp/options.xl2tp /dev/pts/3
           ├─1773 /usr/sbin/xl2tpd
           └─1774 /usr/sbin/pppd passive nodetach : name 0895239246 debug file /etc/ppp/options.xl2tp /dev/pts/4

Mar 08 05:51:30 cubieboard2 pppd[1774]: sent [IPCP ConfReq id=0x3 <addr 196.44.162.116>]
Mar 08 05:51:30 cubieboard2 pppd[1774]: rcvd [IPCP ConfAck id=0x3 <addr 196.44.162.116>]
Mar 08 05:51:30 cubieboard2 pppd[1774]: replacing old default route to eth1 [10.65.16.1]
Mar 08 05:51:30 cubieboard2 pppd[1774]: local  IP address 196.44.162.116
Mar 08 05:51:30 cubieboard2 pppd[1774]: remote IP address 194.186.92.72
Mar 08 05:51:30 cubieboard2 pppd[1774]: Script /etc/ppp/ip-up started (pid 1785)
Mar 08 05:51:30 cubieboard2 pppd[1774]: Script /etc/ppp/ip-up finished (pid 1785), status = 0x0
Mar 08 05:51:38 cubieboard2 pppd[1351]: Failed to open /dev/pts/2: No such file or directory
Mar 08 05:51:45 cubieboard2 pppd[1588]: Failed to open /dev/pts/3: No such file or directory
Mar 08 05:51:52 cubieboard2 pppd[805]: Failed to open /dev/pts/0: No such file or directory

# nano /etc/network/interfaces
auto lo eth0 eth1
iface lo inet loopback

iface eth0 inet static
   address 192.168.0.1
   netmask 255.255.255.0

iface eth1 inet dhcp
   up route add default gw 10.65.16.1


# route при потери соединения:

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.65.16.1      0.0.0.0         UG    0      0        0 eth1
10.0.0.0        10.65.16.1      255.0.0.0       UG    0      0        0 eth1
10.65.16.0      *               255.255.248.0   U     0      0        0 eth1
78.107.196.0    10.65.16.1      255.255.252.0   UG    0      0        0 eth1
172.24.0.144    10.65.16.1      255.255.255.240 UG    0      0        0 eth1
172.24.1.64     10.65.16.1      255.255.255.224 UG    0      0        0 eth1
172.24.1.128    10.65.16.1      255.255.255.224 UG    0      0        0 eth1
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0

# route при рабочем интернет соединение:

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         *               0.0.0.0         U     0      0        0 ppp0
10.0.0.0        10.65.16.1      255.0.0.0       UG    0      0        0 eth1
10.65.16.0      *               255.255.248.0   U     0      0        0 eth1
78.107.196.0    10.65.16.1      255.255.252.0   UG    0      0        0 eth1
172.24.0.144    10.65.16.1      255.255.255.240 UG    0      0        0 eth1
172.24.1.64     10.65.16.1      255.255.255.224 UG    0      0        0 eth1
172.24.1.128    10.65.16.1      255.255.255.224 UG    0      0        0 eth1
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
vpn253.Khabarov *               255.255.255.255 UH    0      0        0 ppp0
# ifconfig
eth0      Link encap:Ethernet  HWaddr 02:ce:07:c1:b2:47
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::ce:7ff:fec1:b247/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7137385 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8203776 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:980240331 (934.8 MiB)  TX bytes:2499517236 (2.3 GiB)
          Interrupt:48

eth1      Link encap:Ethernet  HWaddr 00:00:00:00:22:eb
          inet addr:10.65.16.2  Bcast:255.255.255.255  Mask:255.255.248.0
          inet6 addr: fe80::200:ff:fe00:22eb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4592884 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3957696 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2084286962 (1.9 GiB)  TX bytes:649918309 (619.8 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:104 (104.0 B)  TX bytes:104 (104.0 B)

ppp0      Link encap:Point-to-Point Protocol
          inet addr:196.44.162.116  P-t-P:196.186.92.72  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1456  Metric:1
          RX packets:4328 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3480 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:5293135 (5.0 MiB)  TX bytes:306188 (299.0 KiB)
# cat /etc/xl2tpd/xl2tpd.conf
[global]
access control = yes

[lac beeline]
name = 0895239246
lns = tp.internet.beeline.ru
require pap = no
require chap = yes
require authentication = no
redial = yes
redial timeout = 1
max redials = 1000
pppoptfile = /etc/ppp/options.xl2tp
autodial = yes
ppp debug = yes

Ответ на: комментарий от mky

Выдернул/воткнул кабель - немного подождал - восстановил соединение командой /etc/init.d/xl2tpd stop (start)

# journalctl
Mar 09 01:05:59 cubieboard2 pppd[4548]: pppd 2.4.6 started by root, uid 0
Mar 09 01:05:59 cubieboard2 pppd[4548]: Script /bin/true finished (pid 4549), status = 0x0
Mar 09 01:05:59 cubieboard2 pppd[4548]: Serial connection established.
Mar 09 01:05:59 cubieboard2 pppd[4548]: using channel 11
Mar 09 01:05:59 cubieboard2 pppd[4548]: Using interface ppp0
Mar 09 01:05:59 cubieboard2 pppd[4548]: Connect: ppp0 <--> /dev/pts/2
Mar 09 01:06:00 cubieboard2 xl2tpd[4530]: Can not find tunnel 31553 (refhim=0)
Mar 09 01:06:00 cubieboard2 xl2tpd[4530]: network_thread: unable to find call or tunnel to handle packet.  call = 866, tunnel = 31553 Dumping.
Mar 09 01:06:00 cubieboard2 pppd[4548]: sent [LCP ConfReq id=0x1 <mru 1460> <asyncmap 0x0> <magic 0x8c9d7bd5>]
Mar 09 01:06:00 cubieboard2 pppd[4548]: rcvd [LCP ConfRej id=0x1 <asyncmap 0x0>]
Mar 09 01:06:00 cubieboard2 pppd[4548]: sent [LCP ConfReq id=0x2 <mru 1460> <magic 0x8c9d7bd5>]
Mar 09 01:06:00 cubieboard2 pppd[4548]: rcvd [LCP ConfNak id=0x2 <mru 1456>]
Mar 09 01:06:00 cubieboard2 pppd[4548]: sent [LCP ConfReq id=0x3 <mru 1456> <magic 0x8c9d7bd5>]
Mar 09 01:06:00 cubieboard2 pppd[4548]: rcvd [LCP ConfAck id=0x3 <mru 1456> <magic 0x8c9d7bd5>]
Mar 09 01:06:02 cubieboard2 pppd[4548]: rcvd [LCP ConfReq id=0x9e <mru 1456> <auth chap MD5> <magic 0x2c69b3fd>]
Mar 09 01:06:02 cubieboard2 pppd[4548]: sent [LCP ConfAck id=0x9e <mru 1456> <auth chap MD5> <magic 0x2c69b3fd>]
Mar 09 01:06:02 cubieboard2 pppd[4548]: sent [LCP EchoReq id=0x0 magic=0x8c9d7bd5]
Mar 09 01:06:02 cubieboard2 pppd[4548]: rcvd [CHAP Challenge id=0x1 <de0b47d961e7fd0304b193d47339f1b4>, name = "vpn253.khabarovsk"]
Mar 09 01:06:02 cubieboard2 pppd[4548]: sent [CHAP Response id=0x1 <c6445b85abdcd0f83d29b547c36e6a0b>, name = "0895239246"]
Mar 09 01:06:02 cubieboard2 pppd[4548]: rcvd [LCP EchoRep id=0x0 magic=0x2c69b3fd]
Mar 09 01:06:03 cubieboard2 pppd[4548]: rcvd [CHAP Success id=0x1 "CHAP authentication success, unit 1562"]
Mar 09 01:06:03 cubieboard2 pppd[4548]: CHAP authentication succeeded: CHAP authentication success, unit 1562
Mar 09 01:06:03 cubieboard2 pppd[4548]: CHAP authentication succeeded
Mar 09 01:06:03 cubieboard2 pppd[4548]: sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0>]
Mar 09 01:06:03 cubieboard2 pppd[4548]: rcvd [IPCP ConfReq id=0x67 <addr 194.186.92.72>]
Mar 09 01:06:03 cubieboard2 pppd[4548]: sent [IPCP ConfAck id=0x67 <addr 194.186.92.72>]
Mar 09 01:06:03 cubieboard2 pppd[4548]: rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
Mar 09 01:06:03 cubieboard2 pppd[4548]: sent [IPCP ConfReq id=0x2 <addr 0.0.0.0>]
Mar 09 01:06:03 cubieboard2 pppd[4548]: rcvd [IPCP ConfNak id=0x2 <addr 196.44.162.116>]
Mar 09 01:06:03 cubieboard2 pppd[4548]: sent [IPCP ConfReq id=0x3 <addr 196.44.162.116>]
Mar 09 01:06:03 cubieboard2 pppd[4548]: rcvd [IPCP ConfAck id=0x3 <addr 196.44.162.116>]
Mar 09 01:06:03 cubieboard2 pppd[4548]: replacing old default route to eth2 [10.65.16.1]
Mar 09 01:06:03 cubieboard2 pppd[4548]: local  IP address 196.44.162.116
Mar 09 01:06:03 cubieboard2 pppd[4548]: remote IP address 194.186.92.72
Mar 09 01:06:03 cubieboard2 pppd[4548]: Script /etc/ppp/ip-up started (pid 4559)
Mar 09 01:06:03 cubieboard2 pppd[4548]: Script /etc/ppp/ip-up finished (pid 4559), status = 0x0
Mar 09 01:06:03 cubieboard2 xl2tpd[4530]: Can not find tunnel 31553 (refhim=0)
Mar 09 01:06:03 cubieboard2 xl2tpd[4530]: network_thread: unable to find call or tunnel to handle packet.  call = 866, tunnel = 31553 Dumping.
Mar 09 01:06:04 cubieboard2 ntpd[772]: Listen normally on 22 ppp0 196.44.162.116 UDP 123
Mar 09 01:06:04 cubieboard2 ntpd[772]: 46.8.40.31 interface 10.65.16.5 -> 196.44.162.116
Mar 09 01:06:04 cubieboard2 ntpd[772]: 81.95.131.132 interface 10.65.16.5 -> 196.44.162.116
Mar 09 01:06:04 cubieboard2 ntpd[772]: 37.139.41.250 interface 10.65.16.5 -> 196.44.162.116
Mar 09 01:06:04 cubieboard2 ntpd[772]: 194.190.168.1 interface 10.65.16.5 -> 196.44.162.116
Mar 09 01:06:04 cubieboard2 ntpd[772]: peers refreshed
Mar 09 01:06:04 cubieboard2 ntpd[772]: 46.8.40.31 interface 196.44.162.116 -> 10.65.16.5
Mar 09 01:06:06 cubieboard2 xl2tpd[4530]: Can not find tunnel 31553 (refhim=0)
Mar 09 01:06:06 cubieboard2 xl2tpd[4530]: network_thread: unable to find call or tunnel to handle packet.  call = 866, tunnel = 31553 Dumping.
Mar 09 01:06:09 cubieboard2 xl2tpd[4530]: Can not find tunnel 31553 (refhim=0)
Mar 09 01:06:09 cubieboard2 xl2tpd[4530]: network_thread: unable to find call or tunnel to handle packet.  call = 866, tunnel = 31553 Dumping.
Mar 09 01:06:12 cubieboard2 xl2tpd[4530]: Can not find tunnel 31553 (refhim=0)
Mar 09 01:06:12 cubieboard2 xl2tpd[4530]: network_thread: unable to find call or tunnel to handle packet.  call = 866, tunnel = 31553 Dumping.
Mar 09 01:06:15 cubieboard2 xl2tpd[4530]: Can not find tunnel 31553 (refhim=0)
Mar 09 01:06:15 cubieboard2 xl2tpd[4530]: network_thread: unable to find call or tunnel to handle packet.  call = 866, tunnel = 31553 Dumping.
Mar 09 01:06:18 cubieboard2 xl2tpd[4530]: Can not find tunnel 31553 (refhim=0)
Mar 09 01:06:18 cubieboard2 xl2tpd[4530]: network_thread: unable to find call or tunnel to handle packet.  call = 866, tunnel = 31553 Dumping.
Mar 09 01:06:21 cubieboard2 xl2tpd[4530]: Can not find tunnel 31553 (refhim=0)
Mar 09 01:06:21 cubieboard2 xl2tpd[4530]: network_thread: unable to find call or tunnel to handle packet.  call = 866, tunnel = 31553 Dumping.
Mar 09 01:06:22 cubieboard2 pppd[4181]: Failed to open /dev/pts/0: No such file or directory
Mar 09 01:06:24 cubieboard2 xl2tpd[4530]: Can not find tunnel 31553 (refhim=0)
Mar 09 01:06:24 cubieboard2 xl2tpd[4530]: network_thread: unable to find call or tunnel to handle packet.  call = 866, tunnel = 31553 Dumping.
Mar 09 01:06:27 cubieboard2 xl2tpd[4530]: Can not find tunnel 31553 (refhim=0)
Mar 09 01:06:27 cubieboard2 xl2tpd[4530]: network_thread: unable to find call or tunnel to handle packet.  call = 0, tunnel = 31553 Dumping.
Mar 09 01:06:32 cubieboard2 pppd[4548]: sent [LCP EchoReq id=0x1 magic=0x8c9d7bd5]
Mar 09 01:06:32 cubieboard2 pppd[4548]: rcvd [LCP EchoRep id=0x1 magic=0x2c69b3fd]
softwider ()
Ответ на: комментарий от softwider

Временное решение применил такое:

#!/bin/bash
while test 1
do
echo "ping -c 5 8.8.8.8"
PING=`ping -c 5 8.8.8.8`
ret=$?
if [ "$ret" -ne "0" ]; then
killall pppd
/etc/init.d/xl2tpd stop
sleep 10s
/etc/init.d/xl2tpd start
fi
sleep 1m
done
Спасибо за скрипт mag_box2

softwider ()
Ответ на: комментарий от softwider

Я проверяю наличие интерфейса в выхлопе ifconfig

if ! /sbin/ifconfig $IF 1>/dev/null 2>&1; then....
в конфиге xl2tpd redial = no

Работает как и pptp так и l2tp уже много лет. Скрипт проверки запускаю в кроне.

Судя по тому что интерфейс у вас падает, это лучший вариант, чем постоянно насиловать 8.8.8.8

anc ★★★★★ ()
25 июня 2017 г.
Ответ на: комментарий от softwider

Извращенный и не правильный вариант.
По пунктам
1. killall pppd
Зачем? Вы проверяете именно конкретный интерфейс выше ppp0 А если у вас больше одного соединения просто убьете все соединения.
2. ifdown eth1 && ifup eth1
Это-то вообще зачем?

anc ★★★★★ ()
20 сентября 2017 г.
Ответ на: комментарий от anc

Извращение - и не говорите!
1. Домашний сервер - всегда один pppd
2. ifdown eth1 && ifup eth1 - pppd принципиально не поднимается обычным перезапуском xl2tp.

softwider ()
Ответ на: комментарий от softwider

1. У вас вроде как прописан /etc/init.d/xl2tpd stop он разве не кильнет pppd нужный pppd?
2. Для истории это в каком дистре такая фигня?

ЗЫ У меня схема чуть сложнее (несколько соединений) запускаю своим скриптом.
Запуск xl2tpd -c /path-to/config -p /path-to/file-with-pid
Киляю по pid
Остановка kill $(cat /path-to/file-with-pid)
Где /path-to/file-with-pid - /var/run/xl2tpd/$IF.pid

anc ★★★★★ ()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.