% Network Diagnostics: Finding and fixing problems % Ian! D. Allen -- -- [www.idallen.com] % Winter 2013 - January to April 2013 - Updated 2018-04-09 10:04 EDT - [Course Home Page] - [Course Outline] - [All Weeks] - [Plain Text] Introduction -- Host O/S and VMware users ========================================= This file helps resolve these problems: - unable to access the Internet - unable to connect to the Course Linux Server - can't resolve host - connection aborted - connection closed - unable use SSH into a Linux Virtual Machine from your host O/S The first two sections of this document apply to your **host O/S networking**. The remainder of the file is for **VMware** users. As a system technician you will need to know what kinds of network problems cause what kinds of errors. This is made more complex in a Virtual Machine environment, since problems can occur in both the host machine and in the Virtual Machine as well as the guest O/S, and in the connections between them. Start with your host machine (the machine running the software that runs your nested Virtual Machines) and work in from there. Check Host Computer Networking ============================== Make sure your host machine has a working network connection before you try to fix the network in your virtual machines: 1. Plug your host computer into a wall socket and disable your host computer wireless network. Wireless is not reliable at Algonquin College. 2. Make sure your host network cable is plugged in and the Link light (if you have one) is on. 3. Use a browser on your host to open web pages both on- and off-campus. (Make sure your browser is not simply showing you cached pages! Use **SHIFT+Refresh** to re-load each page you test.) Use various known host names, e.g. `idallen.com`, `idallen.org`, `google.ca`, `gnu.org`, `youtube.com`, etc. Make sure that your system can resolve these names. If you get "unknown host" or "host not found" errors, your host computer DNS is not working and you need to fix that, first. Consult the manual for your host computer and get that working. Connecting to Algonquin Wireless -------------------------------- > Algonquin College wireless often causes problems. Avoid it. For best > results, wire your host machine into the campus network and *disable* > wireless when you are at Algonquin College. If you must use wireless at Algonquin College, make sure your host computer is connected to the **ACSecure** wireless network. The **Guest** network will not let you access everything and connections will abort or time out. The settings to connect a machine to the Algonquin College **ACSecure** wireless network are these: Connection Name (SSID): ACSecure Wireless Security: WPA & WPA2 Enterprise Authentication: PEAP (Protected EAP) CA certificate: none PEAP version: automatic Inner authentication: MSCHAPv2 Username: abcd0001 # use your own Algonquin network userid and password Password: ************ On a Linux machine, the network properties box may look similar to this: ![Algonquin College ACSecure] ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- **The rest of this file is for debugging VMware and virtual machine problems.** ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- Check Host Computer VMware Virtual Wireless Adapters ==================================================== If your host computer can load web pages from various places, you know your host computer networking is mostly working. Continue with this section. If you run a Microsoft Windows O/S, make sure you have **enabled** all the VMware network adapters in your **Network Settings**, e.g. `vmnet0`,`vmnet1`, `vmnet2`, `vmnet8` (and any others, if present). - See [Appendix I] - In Windows, make sure your **VMware Network Adapter VMnet8** Properties, Internet Protocol Version 4, Properties, is set to "Obtain IP address automatically". - Rumour has it that ITS will disable your VMware network adapters when they install your free 5GHz USB network adapter . (The install CD is rumoured to do this, as well.) Tell them not to do that. Start VMware and open the VMware **Virtual Network Editor** (in the **Edit** menu) and confirm that you have both a **bridged** `vmnet0` and a **NAT** `vmnet8` network adapter: ![VMware Virtual Network Editor] - Make sure your **vmnet8** is: `NAT`, `NAT`, `vmnet8`, `yes` -- DHCP must be turned **on** for the NAT adapter. - If that doesn't work, try "reset to defaults" in your VMware Network Editor. (This may lose some configuration done in other courses, so be careful using it.) You may have to pause your virtual machines and restart VMware after making changes to the Windows network adapters. If this doesn't work, consult a Windows guru. Use VMware to open the **Network Adapter** for your virtual machine and make sure it is set to "Connect at power on" and uses a **Network Connection** of **NAT** (preferred) or **Bridged**: ![VMware Network Adapter] **NAT** is preferred, since it lets your Linux machine keep the same IP address no matter to which network your host computer is connected. Using **Bridged** networking requires you to restart your Linux networking every time you move your computer to a new host network. Check VM IP address =================== *This document uses the traditional interface names such as `eth0`. It doesn't apply to Linux installations using **systemd** that use much more complex interface names and different commands to manipulate them.** Once your host machine has a working network connection, proceed to troubleshooting your Virtual Machine(s) and the virtual Network Adapters. Before you can use networking, your Linux network adapter (usually called `eth0`) needs an IP address. Make sure your Virtual Machine has been given an IP address by running `ifconfig` and looking at the `eth0` network device. You are looking for a valid IP address beside `inet addr:`, e.g. # ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:04:75:8d:6e:52 inet addr:192.168.9.250 Bcast:192.168.9.255 Mask:255.255.255.0 ... If you don't have an `eth0` visible, check your system log messages and find out which adapter Linux is using. It might be `eth1` or some other higher number if you have copied your virtual machine. (See below how to fix your VM to use `eth0` again.) Does the IP address given to your machine seem reasonable for the network your host computer is on? (If you are using **NAT** networking, the address will be a private one unrelated to your host computer's network.) If the address is missing or incorrect, try restarting the network by running (as `root`): `service network restart` Refresh VM Networking: Bridged / NAT ==================================== When you resume a Linux Virtual Machine or change locations, you may need to refresh the network settings for your new location by running (as `root`): `service network restart` - If you are unable to make networking work using VMware **Bridged** Networking, try using VMware **NAT** (*Network Address Translation*) networking instead (or vice-versa): a. Go to the VMware menu **VM \| Settings** and **Hardware** and **Network Adapter**. b. Change your VMware networking from **Bridged** to **NAT** (or vice-versa). c. Save the VMware settings. d. In Linux, run as `root`: `service network restart` If restarting the network doesn't give you an IP address, try changing your [Bridged/NAT] networking type and then restarting again. You must be able to ping your own IP address (the one attached to `eth0`) successfully: # ifconfig eth0 | grep 'inet addr' inet addr:192.168.9.250 Bcast:192.168.9.255 Mask:255.255.255.0 # ping -c 4 192.168.9.250 PING 192.168.9.250 (192.168.9.250) 56(84) bytes of data. 64 bytes from 192.168.9.250: icmp_req=1 ttl=64 time=0.036 ms 64 bytes from 192.168.9.250: icmp_req=2 ttl=64 time=0.067 ms 64 bytes from 192.168.9.250: icmp_req=3 ttl=64 time=0.057 ms 64 bytes from 192.168.9.250: icmp_req=4 ttl=64 time=0.053 ms --- 192.168.9.250 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 2997ms rtt min/avg/max/mdev = 0.036/0.053/0.067/0.012 ms If you don't have a working IP address, nothing else will work. You must have an IP address. Missing network interface `eth0` ================================ If you move or copy a Virtual Machine, VMware will invent a new virtual network interface for the machine, with a new MAC address. This new MAC will cause a Linux virtual machine to think you are using a new network adapter, so it will create a new device such as `eth1` for the new MAC, instead of using the default `eth0`. Since everything has been set up in Linux to use `eth0`, your networking may break. To find out which network adapter(s) Linux has found, use: $ netstat -ia | grep eth eth2 1500 0 53217 0 0 0 38282 0 0 0 If you see a higher number than `eth0`, you must follow this link to [rename your Linux network interface]. (If you use **systemd**, you have a different network problem, not covered here.) When you are finished, make sure that `ifconfig eth0` doesn't give any errors. Check VM default gateway ======================== Once you have a valid IP address on your `eth0` network interface for the network you are on, check your default gateway. Run the command `ip route` and look at the gateway address in the line that begins with `default`, e.g. # ip route | grep default default via 192.168.9.254 dev eth0 Try using `ping` on that default gateway on `eth0`: # ping -c4 192.168.9.254 PING 192.168.9.254 (192.168.9.254) 56(84) bytes of data. 64 bytes from 192.168.9.254: icmp_req=1 ttl=64 time=0.882 ms 64 bytes from 192.168.9.254: icmp_req=2 ttl=64 time=0.760 ms 64 bytes from 192.168.9.254: icmp_req=3 ttl=64 time=0.615 ms 64 bytes from 192.168.9.254: icmp_req=4 ttl=64 time=0.663 ms --- 192.168.9.254 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3001ms rtt min/avg/max/mdev = 0.615/0.730/0.882/0.102 ms (Note that Algonquin College, `ping` may be blocked from working, so you can't use it reliably on-campus to test a bridged connection. It should work fine on a NAT connection.) If you don't have a working default gateway, nothing else will work. You must have a working gateway. Check DNS resolution ==================== If you have an IP address and a working gateway, but see `failure in name resolution` or other DNS-related error, then your system is not able to use a **DNS** to turn host names into IP addresses. # host google.ca ;; connection timed out; no servers could be reached - Look for the IP addresses of the **DNS** servers in file `/etc/resolv.conf`: # cat /etc/resolv.conf ... nameserver 10.254.21.22 nameserver 10.254.21.21 - Use `ping` on each of the addresses listed in that file. (Note that Algonquin College, `ping` may be blocked.) If you can't ping the **DNS** servers, your **DNS** won't work and you can't use host names. Try restarting your networking or switching from **Bridged** to **NAT** networking. Don't use wireless! Appendix I -- Windows VMware Network Adapter VMnet8 =================================================== This is from Kevin Jimena: *Here are the steps I took to be able to SSH into my CentOS 6.5 using puTTy on Windows 7:* Step 1: From Network and Sharing Center, click the highlighted item (VMware Network Adapter VMnet8). ![Windows VMware Network Adapter VMnet8] Step 2: A window called VMware Network Adapter VMnet8 Status appears. Click on the highlighted item (Properties). ![Windows VMware Network Adapter VMnet8 Properties] Step 3: Double-click on the highlighted item (Internet Protocol Version 4 (TCP/IPv4)). ![Windows VMware Network Adapter VMnet8 IPv4] Step 4: A window called Internet Protocol Version 4 (TCP/IPv4) Properties appears. If "Use the following IP address:" and "Use the following DNS server addresses:" are selected, this is wrong and you must change it: ![Windows VMware Network Adapter VMnet8 -- Use Address] Step 5: Select "Obtain an IP address automatically" and "Obtain DNS server address automatically", then click the highlighted item (OK). ![Windows VMware Network Adapter VMnet8 -- Obtain Address] Hopefully this helps those who are having problems SSH into CentOS 6. Appendix II -- Windows VMware Network Adapters: `VMnet?` ======================================================== In your Windows host O/S, open up networking and find your VMware Network Adapters with names such as `vmnet0` through `vmnet8` and make sure none of them are listed as **Disabled**. Enable them. -- | Ian! D. Allen, BA, MMath - idallen@idallen.ca - Ottawa, Ontario, Canada | Home Page: http://idallen.com/ Contact Improv: http://contactimprov.ca/ | College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/ | Defend digital freedom: http://eff.org/ and have fun: http://fools.ca/ [Plain Text] - plain text version of this page in [Pandoc Markdown] format [www.idallen.com]: http://www.idallen.com/ [Course Home Page]: .. [Course Outline]: course_outline.pdf [All Weeks]: indexcgi.cgi [Plain Text]: 000_network_diagnostics.txt [Algonquin College ACSecure]: common/linux_wireless_network.png "Algonquin College ACSecure" [Appendix I]: #appendix-i-windows-vmware-network-adapter-vmnet8 [VMware Virtual Network Editor]: data/virtual_network_editor.png "VMware Virtual Network Editor" [VMware Network Adapter]: data/network_adapter.png "VMware Network Adapter" [Bridged/NAT]: #refresh-vm-networking-bridged-nat [rename your Linux network interface]: ../../../cst8207/15w/notes/000_centos_install.html#appendix-renaming-network-interfaces-eth0-eth1 [Windows VMware Network Adapter VMnet8]: data/windows_vmnet_1.jpg "Windows VMware Network Adapter VMnet8" [Windows VMware Network Adapter VMnet8 Properties]: data/windows_vmnet_2.jpg "Windows VMware Network Adapter VMnet8" [Windows VMware Network Adapter VMnet8 IPv4]: data/windows_vmnet_3.jpg "Windows VMware Network Adapter VMnet8" [Windows VMware Network Adapter VMnet8 -- Use Address]: data/windows_vmnet_4.jpg "Windows VMware Network Adapter VMnet8" [Windows VMware Network Adapter VMnet8 -- Obtain Address]: data/windows_vmnet_5.jpg "Windows VMware Network Adapter VMnet8" [Pandoc Markdown]: http://johnmacfarlane.net/pandoc/