You are not logged in.
I am probably not the only Arch user that has network trouble from time to time. What I normally do to find the problem, is ping some servers, ping my gateway, check if devices are up, etc. This can be very tedious.
What I propose is a community project that automates network checks. These checks start from the bottom and stop when an issue is detected. For example, the software first checks if devices are up, then sees if the devices have an IP, if a gateway is specified et cetera.
I want to do it in bash and my bash skills are not that great. If however, some of you want to join development I am sure we can make this work. One of the first things we must do is make a list of the checks, from the bottom up.
What do you guys think about such a project?
edit: I have named the project nd, which stands for network diagnostics. It is hosted here. Click here for the AUR package.
Last edited by Revelation60 (2011-04-01 16:56:21)
Offline
Nice idea:
- add some Warning / ErrMsgs e.g. when ifconfig doesn't return an IP address or use 'ifconfig -a' to find all interfaces,
- you can use some other useful commands,
- use $() instead of backticks :-)
Offline
I like it, I don't know why I haven't thought of this before!
1) Functions should return 0 (success) or non-zero (failure) so the status can be reported to the user in context, rather than a generic message in the function itself.
2) I'd suggest using the iproute2 commands (eg, ip address show, ip route show etc) as iproute2 is supposed to be replacing ifconfig/route etc AFAIK.
EDIT: Think of a cool name, create a git repo and I'll fork it
Last edited by fukawi2 (2011-04-01 00:42:54)
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
I have named the project nd, which stands for network diagnostics. I guess that will do as a working title
Everyone, feel free to contribute!
Offline
Done What would be important to check next? I am thinking of checking if devices are up, and if it's wireless a wireless connection, check if it is associated.
Offline
Network connectivity is a sketchy thing. It all comes down to how you define it.
Does an interface exist? Does it have a carrier? It might be connected to an AP that requires authentication (and you don't have auth)
Does it have an IP address? If it was staticly assigned, there's no guarantee that it does anything.
Do you have a route to where you want to go? Is there a VPN/SSH tunnel that's required to get there? Is there proxying involved midway?
Even if you can get satisfactory functional verification of all of the above (and there's more -- just think of OSI), you're then still dependent on the end point responding to your request. As much as you can check, I've discovered the hard way that attempting to programatically determine whether or not have you a network connection is a flawed premise. There's too much involved.
Don't get me wrong -- I'm not trying to discourage you, just point out what you're battling here.
Offline
This isn't very important but using www.example.com and 192.0.32.10 instead of google would probably be better.
Offline
Great app! Thanks!
Offline
You're welcome I've added some checks to see if devices are up, if a device is a wireless and if so, if it is associated. I still have some fine tuning to do to filter out Ethernet devices. But that's something for tomorrow.
Offline
Find it useful and fast, nice script, very handy.
dank je , thank you
There are no foreign lands. It is the traveler only who is foreign. --R.L Stevenson
Offline
Nice! I use something similar at work and at home but with a gui. At home it appears as part of my status bars. I always look at connectivity as a dependency based problem. That is: Can I ping my router, if so can I ping my adsl modem, if so can I ping a internet based IP ( I normally use Google Public DNS or OpenDNS's server), if so does DNS resolving work, next check VPN and tunnels, etc. Works for me.
One small issue for me is that the output of nd.sh is garbled when it does the ping steps. This is caused by an entry in my PATH for a color wrapping utility that colorizes the output of common commands. It doesn't play well with scripts though. There are two ways to fix this:
1. Use the full PATH to executables in your script.
2. Set a sane PATH at the top of your script. This is a good idea for security anyways.
Offline
I have added a default search path. Is it working now?
Offline
This sounds like something that would go well with netcfg, since they're both network bash scripts.
Offline
Ping is not working through my corporate proxy so it kind of defeat this. I guess if this is the net connectivity we want to check a telnet on port 80 would be more reliable.
Edit: But the interface cannot be selected then.
Last edited by X-dark (2011-04-08 12:59:13)
Cedric Girard
Offline
Edit: But the interface cannot be selected then.
You can specify your own interface as an argument to nd.
Ping is not working through my corporate proxy so it kind of defeat this. I guess if this is the net connectivity we want to check a telnet on port 80 would be more reliable.
I'll check it out!
Offline
Edit: But the interface cannot be selected then.
You can specify your own interface as an argument to nd.
I was speaking about telnet.
Ping is not working through my corporate proxy so it kind of defeat this. I guess if this is the net connectivity we want to check a telnet on port 80 would be more reliable.
I'll check it out!
After some thinking, I'm not sure it is the easiest thing to do. You would need to parse the output to see if the connection have been established and then send a signal to kill it.
Cedric Girard
Offline
Your firewall admins need a boot up the arse, especially if they are blocking ICMP while allowing port 80!!
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Has anyone got some more ideas for things to check?
Offline
Your firewall admins need a boot up the arse, especially if they are blocking ICMP while allowing port 80!!
I've stopped trying to understand how someone can configure a firewall so badly ... We are many to tunnel a lot of thing through a ssh connection (on port 443) in order to have a usable environment.
Cedric Girard
Offline
Sometimes when I run nd, I see messages like:
grep: 7986: No such file or directory
grep: 14010/cmdline: No such file or directory
What is causing that and how could I stop those messages?
Offline
Interesting... That's a part I did. Next time that happens, can you post the output of the following commands?
pgrep '^(dhcp|dhclient)'
ps -ef | grep -E '(dhcp|dhclient)'
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
~ $ nd
* Link OK
* Interface is UP
grep: 1481/cmdline: No such file or directory
Local IP: 192.168.1.64
DHCP: no
* Default gateway: 192.168.1.254
Responded to ping in 0.792 ms
* Testing external IP...
Responded to ping in 13.7 ms
* Testing DNS resolver...
Hostname was resolved.
You seem to have a working internet connection!
~ $ pgrep '^(dhcp|dhclient)'
1450
1481
~ $ ps -ef | grep -E '(dhcp|dhclient)'
root 1450 1391 0 07:26 ? 00:00:00 [dhcpcd] <defunct>
root 1481 1 0 07:26 ? 00:00:00 /sbin/dhcpcd eth0 -h kevin-desktop
kevin 2047 1990 0 07:32 pts/0 00:00:00 grep -E (dhcp|dhclient)
Offline
I didn't think about multiple dhcp processes, whoops. Thanks for the output
Fixed and pull request sent to benruijl
https://github.com/benruijl/nd/pull/3
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline