Troubleshooting ethernet network
|
Posts: 403
Threads: 26
Joined: Aug 2015
Reputation:
39
[Not Solved]
Aug 11, 2015, 07:34 PM
Hi
I need some advice on how to troubleshoot my network. (External access)
My network connection on my RPI 2 with minibian has been working flawless for months until 2-3 day ago. I can access my pi locally with ssh but I can't access external networks or ping external sites.
- My pi is connected with a wired cable to my router (dhcp)
- When the external network drops I can access the pi through ssh from my laptop.
- I have a usb hard drive connected to my pi. Why I mention this is if this can be a power issue? if the network drops due to low power? But if that would be the case my internal network should drop to?
- I also run OpenVPN. Can any downtime at my VPN provider cause the external network drops on my pi?
- My power adapter: 2,1 Amp 5V
Yesterday I could restart the network to get a external connection with this command:
sudo /etc/init.d/networking restart
Today my network dropped again and a restart of the network didn't work. I had to restart the pi to make it work.
I need help finding out the cause and some basic troubleshooting guides. Can I see in any logs when the external network dropped?
Regard
manne
Posts: 21
Threads: 1
Joined: Jul 2015
Reputation:
6
[Not Solved]
Aug 11, 2015, 09:20 PM
So the issue is that your pi cannot connect to the Internet.
Seems like Open VPN could be a cause, have you tested without VPN? Generally you should be able to bypass VPN when it's down and connect normally.
Power shouldn't be an issue, if it drops the whole thing generally drops.
Regards,
Desgyz
Sent from my iPhone using Tapatalk
Posts: 1,646
Threads: 2
Joined: Aug 2015
Reputation:
42
[Not Solved]
Aug 11, 2015, 09:45 PM
(Aug 11, 2015, 09:20 PM)Desgyz Wrote: So the issue is that your pi cannot connect to the Internet.
Seems like Open VPN could be a cause, have you tested without VPN? Generally you should be able to bypass VPN when it's down and connect normally.
Power shouldn't be an issue, if it drops the whole thing generally drops.
Regards,
Desgyz
Sent from my iPhone using Tapatalk
I believe the VPN is the newest addition to his setup (we have communicated a lot through email) and I think it is the VPN connection that is dropping. If you can still SSH into the Pi then the network adapter is getting enough power. What is probably happening is the VPN is getting messed up.
You can look into creating watchdog script or monit service to watch the openvpn service and restart it if it fails. Next time it happens open an SSH session and run top | grep openvpn to see if anything shows up (there is a smarter way to do this that I can't recall atm). If the OpenVPN service is still running you will need to look at the log files for OpenVPN then you can create a watchdog, monit or something to monitor log files and restart OpenVPN based on some trigger.
Posts: 403
Threads: 26
Joined: Aug 2015
Reputation:
39
[Not Solved]
Aug 11, 2015, 09:46 PM
(This post was last modified: Aug 11, 2015, 10:05 PM by manne.)
(Aug 11, 2015, 09:20 PM)Desgyz Wrote: So the issue is that your pi cannot connect to the Internet.
Seems like Open VPN could be a cause, have you tested without VPN? Generally you should be able to bypass VPN when it's down and connect normally.
Power shouldn't be an issue, if it drops the whole thing generally drops.
Regards,
Desgyz
Sent from my iPhone using Tapatalk
Correct, no Internet access. But the local network works.
Can I just stop the openvpn service or do I need to do more?
Skickat från min SM-G925F via Tapatalk
Posts: 21
Threads: 1
Joined: Jul 2015
Reputation:
6
[Not Solved]
Aug 11, 2015, 10:11 PM
If I read what Mike said correctly; this should help
http://support.vpnsecure.me/articles/fre...sconnected
Sent from my iPhone using Tapatalk
Posts: 403
Threads: 26
Joined: Aug 2015
Reputation:
39
[Not Solved]
Aug 12, 2015, 03:53 AM
(This post was last modified: Aug 12, 2015, 03:55 AM by manne.)
(Aug 11, 2015, 10:11 PM)Desgyz Wrote: If I read what Mike said correctly; this should help
http://support.vpnsecure.me/articles/fre...sconnected
Sent from my iPhone using Tapatalk
Thank you Mike and Desgyz.
Mike: I will check the TOP command next time the network drops.
A question about the script: (Provided from the link)
Below is a bash script that you can setup with cron to monitor your linux openvpn daemon and restart if the connection happens to fail.
#!/bin/bash
ps -ef | grep -v grep | grep openvpn
if [ $? -eq 1 ] ; then
/usr/sbin/openvpn --config username.ovpn --daemon --script-security 3 system
fi
- How do I setup the bash script and run the cron to monitor the openvpn?
- Where do I store the file?
I've done this so far:
1. sudo nano checkopenvpn.sh
2. entered the script and saved it
3. sudo chmod +x filename.sh
I guess the file is on my home folder? Where do I preferably store my file? And what do I do next? How do I use cron?
(Can I edit the fonts here in the forum? Use bold text, paste code syntax? where do I activate it? :p)
Posts: 21
Threads: 1
Joined: Jul 2015
Reputation:
6
[Not Solved]
Aug 12, 2015, 11:41 AM
(This post was last modified: Aug 12, 2015, 11:42 AM by Desgyz.)
I by far advise you to try Mikes method first but if you would like to follow the link try this:
Make sure you have crontabs package installed.
Then type:
Sudo crontab -e
Then add this line:
0 * * * * /path/to/bashscript.sh
If I remember crontab properly it will run the script every hour. Which I think is what the link is implying.
Regards,
Desgyz
Sent from my iPhone using Tapatalk
Posts: 403
Threads: 26
Joined: Aug 2015
Reputation:
39
[Not Solved]
Aug 12, 2015, 11:53 AM
Is the 0 a Typo? In the beginning of the path?
Mike. Can you please make a guide or something for the watchdog script?
Or do you first want to know if the openvpn is running with the top command?
Skickat från min SM-G925F via Tapatalk
Posts: 1,646
Threads: 2
Joined: Aug 2015
Reputation:
42
[Not Solved]
Aug 12, 2015, 12:01 PM
(Aug 12, 2015, 11:53 AM)manne Wrote: Is the 0 a Typo? In the beginning of the path?
Mike. Can you please make a guide or something for the watchdog script?
Or do you first want to know if the openvpn is running with the top command?
Skickat från min SM-G925F via Tapatalk
The 0 isn't a typo, crontabs have a time column format represented by the 0 * * * * (have to do with minute, hour, day, week etc). So the 0 means at the top of the hour to run the script (every hour, every day, every week etc represented by the *s)
I have had the idea for a watchdog script but haven't had a personal need for it yet so it hasn't been a priority. If you do manage to get a watchdog script working then let me know and I'll make it into a guide.
The crontab running the bash script every hour will essentially do the same thing, you can increase the interval by making the 0 */5 which will run the check script every 5 minutes instead.
Posts: 403
Threads: 26
Joined: Aug 2015
Reputation:
39
[Not Solved]
Aug 12, 2015, 12:10 PM
So I don't change the 0****, I have it as it is?
Do I add the 0 */5 in the if statement instead of 1?
Skickat från min SM-G925F via Tapatalk
|
|
|