Nework Diagnosis

This is a script to get a diagnosis of network’s trubleshoting ( Wi-Fi/Lan) in  your linux machine.  If you are using USB- network adapters is highly suggest that you run a lsusb command next to the scripts. Since i did not include any usb scan for network devices I suggest to use a different script or to change this one to meet your needs.

How-To:

1.download net.sh link:http://ubuntuforums.org/showthread.php?p=11194893#post11194893

2.sudo chmod +x net.sh

3.sudo ./net.sh

4. After you run the script, a file named ‘results.txt’ will be created.

content of file net.sh


#!/bin/bash
clear
# Document to get a diagnosis of network's trubleshoting ( Wi-Fi/Lan)

printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"> results.txt
printf "\n+++++++++++++++++++++++++++++++++++++++++++++Sysyem-Info+++++++++++++++++++++++++++++++++++++++++++++++\n">> results.txt
less /etc/lsb-release >> results.txt
uname -a |less >> results.txt

printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">> results.txt
printf "\n++++++++++++++++++++++++++++++++++++++++++++++ifconfig+++++++++++++++++++++++++++++++++++++++++++++++++\n">> results.txt
sudo ifconfig |tee >> results.txt

printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">> results.txt
printf "\n++++++++++++++++++++++++++++++++++++++++++++++iwconfig+++++++++++++++++++++++++++++++++++++++++++++++++\n">>results.txt
sudo iwconfig |tee >> results.txt

printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">> results.txt
printf "\n+++++++++++++++++++++++++++++++++++++++++/pro/net/wireless+++++++++++++++++++++++++++++++++++++++++++++\n">> results.txt
less  /proc/net/wireless |tee >> results.txt

printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">> results.txt
printf "\n++++++++++++++++++++++++++/var/lib/NetworkManager/NetworkManager.state+++++++++++++++++++++++++++++++++\n">> results.txt

less /var/lib/NetworkManager/NetworkManager.state >> results.txt
printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">> results.txt
printf "\n++++++++++++++++++++++++++++++++++++++++++++++lswh+++++++++++++++++++++++++++++++++++++++++++++++++++++\n">>results.txt
# print only the network class
sudo lshw -c network |tee >> results.txt

printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">>results.txt
printf "\n++++++++++++++++++++++++++++++++++++++++++++++lspci++++++++++++++++++++++++++++++++++++++++++++++++++++\n">> results.txt
# print verbose output that belongs to the "Ethernet Controller"
driver=""
lspci | grep "Ethernet controller:" | cut -d " " -f 1 |tee >> log.txt
cat log.txt | while read line;
do
sudo lspci -vvvs $line |tee >> results.txt
driver=$(sudo lspci -vvvs $line | grep "Kernel driver in use:" |cut -d " " -f 5)
echo "-e $driver " >> driver.txt
printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">>results.txt
printf "\n++++++++++++++++++++++++++++++++++++++++++++++dmesg++++++++++++++++++++++++++++++++++++++++++++++++++++\n">> results.txt
# print error msg lines containing the name of the drivers used by the network devices,"lan", "net", and "radio" words.
#sed -e :a -e N -e 's/\n/ /' -e ta driver.txt > log1.txt
greps=$(cat driver.txt | tr -d "\n" | less)

dmesg | grep $greps -e radio -e net -e wlan -e " eth"   |less >> results.txt

printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">>results.txt
printf "\n++++++++++++++++++++++++++++++++++++++++++++++lsmod++++++++++++++++++++++++++++++++++++++++++++++++++++\n">> results.txt
# lsmod lists only lines containing the names of the network drivers.
lsmod | grep $greps | less >> results.txt

Advertisements

3 responses to “Nework Diagnosis

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s