Lab 1: Network Troubleshooting Tools Name
Total Page:16
File Type:pdf, Size:1020Kb
Lab 1: Network Troubleshooting Tools Name: Subject: Network Troubleshooting Tools Approved Lecturer: Jirawat Thaenthong Organization: Faculty of Technology and Environment, PSU, Phuket Campus. Date: 19/5/60 Version: 1.0 Objective: 1. Trainees study and practice network troubleshooting tools. 2. Trainees study case studies and discuss with the others. Instructions& Prerequisites: - Trainees should have basic skill of Linux commands. - Linux virtual machine (VirtualBox/VMware) Task 1: Practice basic network troubleshooting tools 1. Link detection/verification with ‘ethtool’ With this command, we can do much more as follows: • Auto-negotiation • The speed of the device • Display all NIC settings • Display auto-negotiation, RX, and TX settings • Display network statistics for a specific NIC • Troubleshoot ethernet connections • Blink the LED of a specific NIC 1.1. Install ‘ethtool’ package. If you have already, skip this step. ------------------------------------------------------------------------------------------------------------------- $ ethtool –h ß Please verify if you have it or not. $ sudo apt install ethtool ßInstall ethtool ------------------------------------------------------------------------------------------------------------------- Ubuntu Networking Part I Page 1 Lab 1: Network Troubleshooting Tools Name: 1.2. Verify how many network interfaces you have. ------------------------------------------------------------------------------------------------------------------- $ ifconfig –a ßList all network interfaces ------------------------------------------------------------------------------------------------------------------- 1.3. Detect which network interface connected to LAN ------------------------------------------------------------------------------------------------------------------- $ ethtool enp0s3 ßAssume this interface is connected to LAN. ------------------------------------------------------------------------------------------------------------------- <Sample output> You will see ‘Link detected: yes’ Ubuntu Networking Part I Page 2 Lab 1: Network Troubleshooting Tools Name: 1.4. Show the NIC statistics ------------------------------------------------------------------------------------------------------------------- $ ethtool –S enp0s3 ------------------------------------------------------------------------------------------------------------------- <Sample output> If you find ethtool reporting-specific errors on a card, there's a problem. 1.5. Locating a specific NIC ------------------------------------------------------------------------------------------------------------------- $ sudo ethtool –p enp0s3 15 ßLED blinking on the specific NIC. ------------------------------------------------------------------------------------------------------------------- It is useful if you have a server with multiple NICs, but you do know which one is correct. Ubuntu Networking Part I Page 3 Lab 1: Network Troubleshooting Tools Name: 1.6. Testing your NIC ------------------------------------------------------------------------------------------------------------------- $ sudo ethtool –t enp0s3 online ------------------------------------------------------------------------------------------------------------------- <Sample output> Online - tests nvram and a link test Offline - tests register, memory, loopback, interrupt ß Some NIC does not support function Practice by yourself Ubuntu Networking Part I Page 4 Lab 1: Network Troubleshooting Tools Name: 2. IP addressing 2.1. When you assign network configuration with ifconfig and route command, If you no longer use temporary network configuration, you can remove or purge with command ------------------------------------------------------------------------------------------------------------------- $ sudo ip addr flush enp0s3 ------------------------------------------------------------------------------------------------------------------- 2.2. Release IP address assigned by DHCP server ------------------------------------------------------------------------------------------------------------------- $ sudo dhclient –r ------------------------------------------------------------------------------------------------------------------- 2.3. Renew IP address from DHCP server ------------------------------------------------------------------------------------------------------------------- $ sudo dhclient enp0s3 ß Assume your computer get IP address on this interface. ------------------------------------------------------------------------------------------------------------------- 2.4. Sdf 3. Wi-Fi Troubleshooting 3.1. Wireless connection troubleshooter 3.1.1. lshw command (H/W list) ------------------------------------------------------------------------------------------------------------------- $ lshw ------------------------------------------------------------------------------------------------------------------- 3.1.2. lspci command (Wireless PCI) ------------------------------------------------------------------------------------------------------------------- $ lspci ------------------------------------------------------------------------------------------------------------------- Ubuntu Networking Part I Page 5 Lab 1: Network Troubleshooting Tools Name: 3.1.3. lsusb command (Wireless USB adapter) ------------------------------------------------------------------------------------------------------------------- $ lsusb ------------------------------------------------------------------------------------------------------------------- 3.2. Increase Wi-Fi Signal Strength. Try this if you have Ubuntu host (not virtual machine). 3.2.1. Install Wireless Tool ------------------------------------------------------------------------------------------------------------------- $ sudo apt install wireless-tools ------------------------------------------------------------------------------------------------------------------- 3.2.2. Verify your wireless NIC info. ------------------------------------------------------------------------------------------------------------------- $ ifconfig ------------------------------------------------------------------------------------------------------------------- 3.2.3. Increase Wi-Fi signal strength. ------------------------------------------------------------------------------------------------------------------- $ iw reg set BO $ iwconfig wlan0 txpower 30 ß Assume you have wireless NIC ‘wlan0’ ------------------------------------------------------------------------------------------------------------------- <if it doesn’t work> Let try ------------------------------------------------------------------------------------------------------------------- $ ifconfig wlan0 down $ iw reg set BO $ ifconfig wlan0 up $ iwconfig wlan0 channel xx ß if needed $ iwconfig wlan0 txpower 30 ------------------------------------------------------------------------------------------------------------------- Ubuntu Networking Part I Page 6 Lab 1: Network Troubleshooting Tools Name: 4. Network monitoring and troubleshooting Normally, we use ‘top’ program to overview all the processes or threads running in the system. However, it just the program from the old-style. We have some list of monitoring tools that works for admin as follows: 4.1. Htop Htop is essentially an enhanced version of top. It comes with visual-style and built-in commands are needed for admin. 4.1.1. Try ‘htop’ ------------------------------------------------------------------------------------------------------------------- $ sudo apt install htop $ htop ------------------------------------------------------------------------------------------------------------------- <Sample output> 4.1.2. Test ‘htop’ with F1 – F10 Ubuntu Networking Part I Page 7 Lab 1: Network Troubleshooting Tools Name: 4.2. Try ‘atop’, ‘powertop’, ‘iotop’, and ‘apachetop’ Make your own note. 4.3. iftop iftop is similar to top, but it concerns only to network traffic on selected network interfaces and displays a table of current usage. You can find the answer why your Internet is very slow sometime. 4.3.1. Try ‘iftop’ ------------------------------------------------------------------------------------------------------------------- $ sudo apt install iftop $ sudo iftop ------------------------------------------------------------------------------------------------------------------- <Sample output> Ubuntu Networking Part I Page 8 Lab 1: Network Troubleshooting Tools Name: 4.3.2. Toggle ‘t’ to see what’s happening? Ubuntu Networking Part I Page 9 Lab 1: Network Troubleshooting Tools Name: 4.4. nethogs Nethogs display network traffic per protocol or per subnet. 4.4.1. Try ‘nethogs’ ------------------------------------------------------------------------------------------------------------------- $ sudo apt install nethogs $ sudo nethogs ------------------------------------------------------------------------------------------------------------------- <Sample output> 4.5. Try ‘ntopng’ and ‘jnettop’, Make your own note. Ubuntu Networking Part I Page 10 Lab 1: Network Troubleshooting Tools Name: 4.6. Bmon Bmon monitors and helps you debug networks. You can also interact with bmon through curses or through scripting. 4.6.1. Try ‘bmon’ ------------------------------------------------------------------------------------------------------------------- $ sudo apt install bmon $ sudo bmon ------------------------------------------------------------------------------------------------------------------- <Sample output>, toggle