Results 1 to 10 of 26

Thread: Nework Diagnosis-Script

Threaded View

  1. #1
    Join Date
    May 2006
    Location
    Boston
    Beans
    1,918
    Distro
    Ubuntu 12.04 Precise Pangolin

    Nework Diagnosis-Script

    This is a script to get a diagnosis of your network to help yourself in case of trubleshoting ( Wi-Fi/Lan). 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 attachment:net.sh

    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 the file
    net.sh
    Code:
    #!/bin/bash
    clear
    # Document to get a diagnosis of network's trubleshoting ( Wi-Fi/Lan)
    
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"> results.
    txt
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++System-Info+++++++++++++++++++++++++++++++++++++++++++++++\n">> resul
    ts.txt
    less /etc/lsb-release >> results.txt
    uname -a |less >> results.txt
    
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">> results
    .txt
    printf "\n++++++++++++++++++++++++++++++++++++++++++++++ifconfig+++++++++++++++++++++++++++++++++++++++++++++++++\n">> resul
    ts.txt
    sudo ifconfig |tee >> results.txt
    
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">> results
    .txt
    printf "\n++++++++++++++++++++++++++++++++++++++++++++++iwconfig+++++++++++++++++++++++++++++++++++++++++++++++++\n">>result
    s.txt
    sudo iwconfig |tee >> results.txt
    
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">> results
    .txt
    printf "\n++++++++++++++++++++++++++++++++++++++++++++++iwlist-scan++++++++++++++++++++++++++++++++++++++++++++++\n">>result
    s.txt
    sudo iwlist scan | 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++++++++++++++++++++++++++/lib/firmware/+++++++++++++++++++++++++++++++++\n">> results.txt
    
    ls -la /lib/firmware/ | grep ucode | tee >> results.txt
    
    
    
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">> results.txt
    printf "\n++++++++++++++++++++++++++++++++++++++++++++++lswh+++++++++++++++++++++++++++++++++++++++++++++++++++++\n">>results.txt
    # print only the network class
    sudo lshw -c network |tee >> results.txt
    #sudo lshw -c network |tee >> log_lshw.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
    done
    
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">>results.txt
    printf "\n++++++++++++++++++++++++++++++++++++++++++++++lsusb++++++++++++++++++++++++++++++++++++++++++++++++++++\n">> results.txt
    
    lsusb -v |tee >> results.txt
    
    
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">>results.txt
    printf "\n++++++++++++++++++++++++++++++++++++++++++++++dmesg++++++++++++++++++++++++++++++++++++++++++++++++++++\n">> results.txt
    # print error msg lines containing the name of the drivers(found in lspci and in lshw) 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) # list of drivers found in lspci
    #dmesg | grep $greps -e radio -e net -e wlan -e " eth"   |less >> results.txt
    
    #print full dmesg 
    dmesg |less >> results.txt
    
    
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">>results.txt
    printf "\n++++++++++++++++++++++++++++++++++++++++++++++/var/log/syslog++++++++++++++++++++++++++++++++++++++++++++++++++++\n">> results.txt
    less /var/log/syslog >> results.txt
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">>results.txt
    printf "\n++++++++++++++++++++++++++++++++++++++++++++++/etc/resolv.conf+++++++++++++++++++++++++++++++++++++++++\n">> results.txt
    less /etc/resolv.conf >> results.txt
    
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">>results.txt
    printf "\n+++++++++++++++++++++++++++++++++++++++/etc/modprobe.d/blacklist.conf++++++++++++++++++++++++++++++++++\n">> results.txt
    less /etc/modprobe.d/blacklist.conf >> results.txt 
    
    
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">>results.txt
    printf "\n++++++++++++++++++++++++++++++++++++++++++++++lsmod++++++++++++++++++++++++++++++++++++++++++++++++++++\n">> results.txt
    # uncomment to make lsmod lists only lines containing the names of the network drivers found from lspci($grep list). Not advaiced if you want to check for installation of ndswrapper or other unkown driver confilcts
    #lsmod | grep $greps | less >> results.txt  
    
    # list full lsmod with no filters
    lsmod | less >> results.txt
    
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++">>results.txt
    printf "\n+++++++++++++++++++++++++++++++++++++++++++++++++END+++++++++++++++++++++++++++++++++++++++++++++++++++\n">> resul:
    ps. I will be more than glad to edit/add the script under suggestions to make it more useful.
    Attached Files Attached Files
    Last edited by fdrake; September 1st, 2011 at 08:56 AM.

    blog
    Donations BTC : 12FwoB7uAM5FnweykpR1AEEDVFaTLTYFkS
    DOUBLEPLUSGOOD!!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •