1

Temat: Skrypt do openvpn.

Witam. Proszę o pomoc przy skrypcie. Jestem laikiem w dziedzinie linuxa dlatego proszę o wyrozumiałość.
Mam co jakiś czas zatrzymanie vpn i chciałbym zrobić skrypt który będzie wznawiał automatycznie połączenie. W terminalu wpisałem:

# touch /bin/tester.sh
# chmod 755 /bin/tester.sh

Nie wiem dlaczego nie utworzyło tester.sh , więc utworzyłem go ręcznie w winSCP. Edytowałem go i wpisałem w nim:

#!/bin/sh
/etc/init.d/openvpn restart
exit 0

I nie wiem co dalej z tym zrobić żeby to działało sad

2

Odp: Skrypt do openvpn.

Dodaj zadanie do crona.
Choć Twoje rozwiązanie jest nieco niedopracowane. Wypadałoby sprawdzać czy VPN działa, jeśli nie to wtedy zresetować połączenie.

WinISO.pl - Archiwum polskich wersji systemów Windows, Windows Serwer i Office

3

Odp: Skrypt do openvpn.

A dokładnie jak ma wyglądać treść tego zadania, które trzeba wstawić w cron, tak żeby po zerwaniu połączenia uruchomił skrypt?

4

Odp: Skrypt do openvpn.

https://eko.one.pl/?p=openwrt-3g#automa … rtpoczenia
Zamiast ifup wan wpisujesz /etc/init.d/openvpn restart, i ewentualnie ustawiasz inny adres do pingowania.

5

Odp: Skrypt do openvpn.

Zrobiłem według instrukcji i nie działa ten skrypt.

Mon Oct 28 14:56:29 2019 daemon.notice netifd: wan (2069): udhcpc: sending renew to 10.9.143.254
Mon Oct 28 15:01:51 2019 kern.debug kernel: [69459.362438] ieee80211 phy1: Mac80211 start BA b4:cd:27:a3:ed:01
Mon Oct 28 15:01:53 2019 kern.debug kernel: [69460.690957] ieee80211 phy1: Mac80211 start BA b4:cd:27:a3:ed:01
Mon Oct 28 15:06:21 2019 daemon.notice openvpn(custom_config)[12562]: [nl-131.protonvpn.com] Inactivity timeout (--ping-restart), restarting
Mon Oct 28 15:06:21 2019 daemon.notice openvpn(custom_config)[12562]: SIGUSR1[soft,ping-restart] received, process restarting
Mon Oct 28 15:06:21 2019 daemon.notice openvpn(custom_config)[12562]: Restart pause, 5 second(s)
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: TCP/UDP: Preserving recently used remote address: [AF_INET]46.166.142.216:80
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: Socket Buffers: R=[163840->327680] S=[163840->327680]
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: UDP link local: (not bound)
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: UDP link remote: [AF_INET]46.166.142.216:80
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: TLS: Initial packet from [AF_INET]46.166.142.216:80, sid=c5d87aa0 1896f804
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: VERIFY OK: depth=2, C=CH, O=ProtonVPN AG, CN=ProtonVPN Root CA
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: VERIFY OK: depth=1, C=CH, O=ProtonVPN AG, CN=ProtonVPN Intermediate CA 1
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: VERIFY KU OK
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: Validating certificate extended key usage
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: VERIFY EKU OK
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: VERIFY OK: depth=0, CN=nl-131.protonvpn.com
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: Control Channel: TLSv1.2, cipher TLSv1/SSLv3 ECDHE-RSA-AES256-GCM-SHA384, 4096 bit RSA
Mon Oct 28 15:06:26 2019 daemon.notice openvpn(custom_config)[12562]: [nl-131.protonvpn.com] Peer Connection Initiated with [AF_INET]46.166.142.216:80
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: SENT CONTROL [nl-131.protonvpn.com]: 'PUSH_REQUEST' (status=1)
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1,dhcp-option DNS 10.8.8.1,sndbuf 524288,rcvbuf 524288,explicit-exit-notify,comp-lzo no,route-gateway 10.8.0.1,topology subnet,ping 10,ping-restart 60,ifconfig 10.8.0.19 255.255.255.0,peer-id 24,cipher AES-256-GCM'
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: Pushed option removed by filter: 'dhcp-option DNS 10.8.8.1'
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: timers and/or timeouts modified
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: explicit notify parm(s) modified
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: compression parms modified
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: --sndbuf/--rcvbuf options modified
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: Socket Buffers: R=[327680->327680] S=[327680->327680]
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: --ifconfig/up options modified
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: route options modified
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: route-related options modified
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: peer-id set
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: adjusting link_mtu to 1657
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: data channel crypto options modified
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: Data Channel: using negotiated cipher 'AES-256-GCM'
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: Preserving previous TUN/TAP instance: tun0
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: NOTE: Pulled options changed on restart, will need to close and reopen TUN/TAP device.
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route del -net 46.166.142.216 netmask 255.255.255.255
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route del -net 0.0.0.0 netmask 128.0.0.0
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route del -net 128.0.0.0 netmask 128.0.0.0
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: Closing TUN/TAP interface
Mon Oct 28 15:06:27 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/ifconfig tun0 0.0.0.0
Mon Oct 28 15:06:27 2019 daemon.notice netifd: Network device 'tun0' link is down
Mon Oct 28 15:06:27 2019 daemon.notice netifd: Interface 'vpn' has link connectivity loss
Mon Oct 28 15:06:27 2019 daemon.notice netifd: Interface 'vpn' is now down
Mon Oct 28 15:06:27 2019 daemon.notice netifd: Interface 'vpn' is disabled
Mon Oct 28 15:06:28 2019 daemon.notice openvpn(custom_config)[12562]: TUN/TAP device tun0 opened
Mon Oct 28 15:06:28 2019 daemon.notice openvpn(custom_config)[12562]: TUN/TAP TX queue length set to 100
Mon Oct 28 15:06:28 2019 daemon.notice openvpn(custom_config)[12562]: do_ifconfig, tt->did_ifconfig_ipv6_setup=0
Mon Oct 28 15:06:28 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/ifconfig tun0 10.8.0.19 netmask 255.255.255.0 mtu 1500 broadcast 10.8.0.255
Mon Oct 28 15:06:28 2019 daemon.notice netifd: Interface 'vpn' is enabled
Mon Oct 28 15:06:28 2019 daemon.notice netifd: Network device 'tun0' link is up
Mon Oct 28 15:06:28 2019 daemon.notice netifd: Interface 'vpn' has link connectivity
Mon Oct 28 15:06:28 2019 daemon.notice netifd: Interface 'vpn' is setting up now
Mon Oct 28 15:06:28 2019 daemon.notice netifd: Interface 'vpn' is now up
Mon Oct 28 15:06:28 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route add -net 46.166.142.216 netmask 255.255.255.255 gw 10.9.147.254
Mon Oct 28 15:06:28 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route add -net 0.0.0.0 netmask 128.0.0.0 gw 10.8.0.1
Mon Oct 28 15:06:28 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route add -net 128.0.0.0 netmask 128.0.0.0 gw 10.8.0.1
Mon Oct 28 15:06:28 2019 daemon.notice openvpn(custom_config)[12562]: Initialization Sequence Completed
Mon Oct 28 15:06:28 2019 user.notice firewall: Reloading firewall due to ifup of vpn (tun0)
Mon Oct 28 15:06:28 2019 daemon.err modprobe: xt_set is already loaded
Mon Oct 28 15:06:28 2019 daemon.err modprobe: ip_set is already loaded
Mon Oct 28 15:06:28 2019 daemon.err modprobe: ip_set_hash_ip is already loaded
Mon Oct 28 15:06:29 2019 user.notice vpnbypass [14188]: service started with TID: 200; FW_MARK: 0x010000
Mon Oct 28 15:06:29 2019 user.notice vpnbypass [14188]: service monitoring interfaces: wan vpn  ✓
Mon Oct 28 15:06:29 2019 daemon.err modprobe: xt_set is already loaded
Mon Oct 28 15:06:29 2019 daemon.err modprobe: ip_set is already loaded
Mon Oct 28 15:06:29 2019 daemon.err modprobe: ip_set_hash_ip is already loaded
Mon Oct 28 15:06:29 2019 user.notice vpnbypass [14491]: service started with TID: 200; FW_MARK: 0x010000
Mon Oct 28 15:06:29 2019 user.notice vpnbypass [14491]: service monitoring interfaces: wan vpn  ✓
Mon Oct 28 15:06:53 2019 daemon.err uhttpd[1961]: luci: accepted login on / for root from 192.168.1.123
Mon Oct 28 15:07:37 2019 daemon.notice openvpn(custom_config)[12562]: [nl-131.protonvpn.com] Inactivity timeout (--ping-restart), restarting
Mon Oct 28 15:07:37 2019 daemon.notice openvpn(custom_config)[12562]: SIGUSR1[soft,ping-restart] received, process restarting
Mon Oct 28 15:07:37 2019 daemon.notice openvpn(custom_config)[12562]: Restart pause, 5 second(s)
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: TCP/UDP: Preserving recently used remote address: [AF_INET]46.166.142.216:80
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: Socket Buffers: R=[163840->327680] S=[163840->327680]
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: UDP link local: (not bound)
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: UDP link remote: [AF_INET]46.166.142.216:80
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: TLS: Initial packet from [AF_INET]46.166.142.216:80, sid=b64066ae 1f49d1b0
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: VERIFY OK: depth=2, C=CH, O=ProtonVPN AG, CN=ProtonVPN Root CA
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: VERIFY OK: depth=1, C=CH, O=ProtonVPN AG, CN=ProtonVPN Intermediate CA 1
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: VERIFY KU OK
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: Validating certificate extended key usage
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: VERIFY EKU OK
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: VERIFY OK: depth=0, CN=nl-131.protonvpn.com
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: Control Channel: TLSv1.2, cipher TLSv1/SSLv3 ECDHE-RSA-AES256-GCM-SHA384, 4096 bit RSA
Mon Oct 28 15:07:42 2019 daemon.notice openvpn(custom_config)[12562]: [nl-131.protonvpn.com] Peer Connection Initiated with [AF_INET]46.166.142.216:80
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: SENT CONTROL [nl-131.protonvpn.com]: 'PUSH_REQUEST' (status=1)
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1,dhcp-option DNS 10.8.8.1,sndbuf 524288,rcvbuf 524288,explicit-exit-notify,comp-lzo no,route-gateway 10.8.0.1,topology subnet,ping 10,ping-restart 60,ifconfig 10.8.0.15 255.255.255.0,peer-id 3,cipher AES-256-GCM'
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: Pushed option removed by filter: 'dhcp-option DNS 10.8.8.1'
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: timers and/or timeouts modified
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: explicit notify parm(s) modified
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: compression parms modified
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: --sndbuf/--rcvbuf options modified
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: Socket Buffers: R=[327680->327680] S=[327680->327680]
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: --ifconfig/up options modified
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: route options modified
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: route-related options modified
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: peer-id set
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: adjusting link_mtu to 1657
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: OPTIONS IMPORT: data channel crypto options modified
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: Data Channel: using negotiated cipher 'AES-256-GCM'
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: Preserving previous TUN/TAP instance: tun0
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: NOTE: Pulled options changed on restart, will need to close and reopen TUN/TAP device.
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route del -net 46.166.142.216 netmask 255.255.255.255
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route del -net 0.0.0.0 netmask 128.0.0.0
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route del -net 128.0.0.0 netmask 128.0.0.0
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: Closing TUN/TAP interface
Mon Oct 28 15:07:43 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/ifconfig tun0 0.0.0.0
Mon Oct 28 15:07:43 2019 daemon.notice netifd: Network device 'tun0' link is down
Mon Oct 28 15:07:43 2019 daemon.notice netifd: Interface 'vpn' has link connectivity loss
Mon Oct 28 15:07:43 2019 daemon.notice netifd: Interface 'vpn' is now down
Mon Oct 28 15:07:43 2019 daemon.notice netifd: Interface 'vpn' is disabled
Mon Oct 28 15:07:44 2019 daemon.notice openvpn(custom_config)[12562]: TUN/TAP device tun0 opened
Mon Oct 28 15:07:44 2019 daemon.notice openvpn(custom_config)[12562]: TUN/TAP TX queue length set to 100
Mon Oct 28 15:07:44 2019 daemon.notice openvpn(custom_config)[12562]: do_ifconfig, tt->did_ifconfig_ipv6_setup=0
Mon Oct 28 15:07:44 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/ifconfig tun0 10.8.0.15 netmask 255.255.255.0 mtu 1500 broadcast 10.8.0.255
Mon Oct 28 15:07:44 2019 daemon.notice netifd: Interface 'vpn' is enabled
Mon Oct 28 15:07:44 2019 daemon.notice netifd: Network device 'tun0' link is up
Mon Oct 28 15:07:44 2019 daemon.notice netifd: Interface 'vpn' has link connectivity
Mon Oct 28 15:07:44 2019 daemon.notice netifd: Interface 'vpn' is setting up now
Mon Oct 28 15:07:44 2019 daemon.notice netifd: Interface 'vpn' is now up
Mon Oct 28 15:07:44 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route add -net 46.166.142.216 netmask 255.255.255.255 gw 10.9.147.254
Mon Oct 28 15:07:44 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route add -net 0.0.0.0 netmask 128.0.0.0 gw 10.8.0.1
Mon Oct 28 15:07:44 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route add -net 128.0.0.0 netmask 128.0.0.0 gw 10.8.0.1
Mon Oct 28 15:07:44 2019 daemon.notice openvpn(custom_config)[12562]: Initialization Sequence Completed
Mon Oct 28 15:07:45 2019 user.notice firewall: Reloading firewall due to ifup of vpn (tun0)
Mon Oct 28 15:07:45 2019 daemon.err modprobe: xt_set is already loaded
Mon Oct 28 15:07:45 2019 daemon.err modprobe: ip_set is already loaded
Mon Oct 28 15:07:45 2019 daemon.err modprobe: ip_set_hash_ip is already loaded
Mon Oct 28 15:07:45 2019 user.notice vpnbypass [14827]: service started with TID: 200; FW_MARK: 0x010000
Mon Oct 28 15:07:45 2019 user.notice vpnbypass [14827]: service monitoring interfaces: wan vpn  ✓
Mon Oct 28 15:07:45 2019 daemon.err modprobe: xt_set is already loaded
Mon Oct 28 15:07:45 2019 daemon.err modprobe: ip_set is already loaded
Mon Oct 28 15:07:45 2019 daemon.err modprobe: ip_set_hash_ip is already loaded
Mon Oct 28 15:07:45 2019 user.notice vpnbypass [15101]: service started with TID: 200; FW_MARK: 0x010000
Mon Oct 28 15:07:45 2019 user.notice vpnbypass [15101]: service monitoring interfaces: wan vpn  ✓
Mon Oct 28 15:08:12 2019 daemon.err openvpn(custom_config)[12562]: event_wait : Interrupted system call (code=4)
Mon Oct 28 15:08:12 2019 daemon.notice openvpn(custom_config)[12562]: SIGTERM received, sending exit notification to peer
Mon Oct 28 15:08:14 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route del -net 46.166.142.216 netmask 255.255.255.255
Mon Oct 28 15:08:14 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route del -net 0.0.0.0 netmask 128.0.0.0
Mon Oct 28 15:08:14 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/route del -net 128.0.0.0 netmask 128.0.0.0
Mon Oct 28 15:08:14 2019 daemon.notice openvpn(custom_config)[12562]: Closing TUN/TAP interface
Mon Oct 28 15:08:14 2019 daemon.notice openvpn(custom_config)[12562]: /sbin/ifconfig tun0 0.0.0.0
Mon Oct 28 15:08:14 2019 daemon.notice netifd: Network device 'tun0' link is down
Mon Oct 28 15:08:14 2019 daemon.notice netifd: Interface 'vpn' has link connectivity loss
Mon Oct 28 15:08:14 2019 daemon.notice netifd: Interface 'vpn' is now down
Mon Oct 28 15:08:14 2019 daemon.notice netifd: Interface 'vpn' is disabled
Mon Oct 28 15:08:14 2019 daemon.notice openvpn(custom_config)[12562]: SIGTERM[soft,exit-with-notification] received, process exiting
Mon Oct 28 15:08:15 2019 daemon.err modprobe: xt_set is already loaded
Mon Oct 28 15:08:15 2019 daemon.err modprobe: ip_set is already loaded
Mon Oct 28 15:08:15 2019 daemon.err modprobe: ip_set_hash_ip is already loaded
Mon Oct 28 15:08:15 2019 user.notice vpnbypass [15364]: service started with TID: 200; FW_MARK: 0x010000
Mon Oct 28 15:08:15 2019 user.notice vpnbypass [15364]: service monitoring interfaces: wan vpn  ✓

6

Odp: Skrypt do openvpn.

Przecież podnosi ci sie openvpn (a wcześniej rozłącza ci się co chwilę).

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

7

Odp: Skrypt do openvpn.

Tak on się podnosi ale trwa to bardzo długo. O 15.01 zerwał połączenie, a dopiero o 15.08 dopiero wróciło połączenie. Chciałbym żeby ta przerwa była krótsza.

8

Odp: Skrypt do openvpn.

I właśnie to tego jest skrypt. Jak odpalisz go co minutę to będzie to robił.

I oczywiście nie pingujesz googli tylko coś co jest po drugiej stronie tunelu lub coś co nie da się pingować jak nie ma tunelu.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

9

Odp: Skrypt do openvpn.

A w jaki sposób sprawdzić czy ten skrypt w ogóle działa?

10

Odp: Skrypt do openvpn.

Uruchom go po prostu.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

11

Odp: Skrypt do openvpn.

Przepraszam,tak jak pisałem jestem laikiem i możesz powiedzieć dokładniej jak go uruchomić? Zrobiłem tak jak mi mówiono,a więc dodałem do crona

# echo "*/1 * * * * /bin/tester.sh" >> /etc/crontabs/root

12

Odp: Skrypt do openvpn.

Mam nadzieję że bez tego #..
Wpisz w konsoli po prostu:

/bin/tester.sh
Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

13

Odp: Skrypt do openvpn.

root@OpenWrt:~# /bin/tester.sh
-ash: /bin/tester.sh: not found

A więc on nie widzi tego pliku. Nie wiem dlaczego on się nie tworzy pisząc polecenie

touch /bin/tester.sh

Ja utworzyłem go ręcznie,ale go nie widzi. Jak to zrobić?

14

Odp: Skrypt do openvpn.

Pokaz wynik polecenia

ls -al /bin/tester.sh

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

15

Odp: Skrypt do openvpn.

root@OpenWrt:~# ls -al /bin/tester.sh
-rwxr-xr-x    1 root     root           119 Oct 28 19:34 /bin/tester.sh

16

Odp: Skrypt do openvpn.

A teraz

cat /bin/tester.sh

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

17

Odp: Skrypt do openvpn.

root@OpenWrt:~# cat /bin/tester.sh
#!/bin/sh
    if ! ping -q -c 1 -W 5 195.154.179.11 > /dev/null; then
        (/etc/init.d/openvpn restart) &
    firoot@OpenWrt:~#

18

Odp: Skrypt do openvpn.

Po za faktem że nie masz na końcu znaku nowej linii to wygląda ok. Jeszcze raz wpisz

/bin/tester.sh

PS - jak zrobiłes plik? Pod openwrt czy pod windows?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

19

Odp: Skrypt do openvpn.

Pod windows  przy pomocy winSCP

root@OpenWrt:~# /bin/tester.sh
-ash: /bin/tester.sh: not found

20

Odp: Skrypt do openvpn.

To zainstaluj sobie edytor nano i zrób go pod openwrt.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

21

Odp: Skrypt do openvpn.

root@OpenWrt:~# nano /bin/tester.sh
root@OpenWrt:~# /bin/tester.sh
root@OpenWrt:~# cat /bin/tester.sh
#!/bin/sh
    if ! ping -q -c 1 -W 5 195.154.179.11 > /dev/null; then
        (/etc/init.d/openvpn restart) &
    fi
root@OpenWrt:~# /bin/tester.sh
root@OpenWrt:~#

Zainstalowałem, edytowałem plik tester.sh i uruchomiłem go. I teraz już on działa i jest OK?

22

Odp: Skrypt do openvpn.

Zrób

/etc/init.d/openvpn stop
/bin/tester.sh

Jak ci sie uruchomi openvpn ponownie to działa.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

23

Odp: Skrypt do openvpn.

Nie uruchomił się.

24

Odp: Skrypt do openvpn.

Wynik

sh -x /bin/tester.sh

pokaż.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

25

Odp: Skrypt do openvpn.

root@OpenWrt:~# sh -x /bin/tester.sh
+ ping -q -c 1 -W 5 195.154.179.11