OPS335 Lab 1 draft

From CDOT Wiki
Revision as of 15:27, 10 January 2016 by Andrew (talk | contribs) (Linux network connection configuration troubleshooting)
Jump to: navigation, search

Basic network configuration

Remember how you set up the network interfaces in your virtual machines in OPS235? You're expected to know that inside out by now. All the services we're configuring in this course require a working network connection so it will be hard for you to get anything done if you don't know how to set a static IP address or change your DNS server or default gateway.

This lab is a crash course of the material from labs 6 and 7 from OPS235

Check current settings

In OPS235 you've used the ifconfig and route commands. In this course we'll use the ip command instead (you're welcome to use the old commands but you're expected to know the new ones too).

  • To get the IP address and subnet mask for all the interfaces:
    • Old: ifconfig
    • New: ip address
  • To get your default gateway:
    • Old: route -n
    • New: ip route
  • To check what DNS server you're using:
    • Old and new: resolv.conf
  • To check your hostname:
    • Old and new: uname -n

Make persistent changes

For the IP address, subnet mask, default gateway, and DNS server you edit a file in /etc/sysconfig/network-scripts/

You'll need a file that describes the settings for a network interface. The association between a specific network interface and the configuration file is made using (from least to most important):

  • The name of the file (ifcfg-interfacename)
  • The "NAME" setting inside the file
  • The "DEVICE" setting inside the file
  • The "HWADDR" setting inside the file

To set the hostname you use the hostnamectl command.

Set static IP addresses on vm1, vm2, and vm3

Except for the host all the machines in this course will have static network configuration. That means you need to be able to perform said configuration and debug problems quickly. If the following steps aren't 100% clear - make sure to practice them.

  1. Edit each of your VMs to use a static IP address. vm1 should use the first available address in the subnet, vm2 the second and vm3 the third.
  2. Don't forget to set the default gateway and DNS server. You can use your host's IP address as a DNS server (libvirt will proxy the requests to the real DNS server).
  3. Make note of the files used and entries required.
  4. Restart each VM and run the following command to ensure they still have the network configuration you set.
  5. Test connectivity by pinging each of your VMs.
  6. Try to ssh from the guest to the host machine, then from the host to the guest.
  7. Try to ping matrix and google from your host machine.
  8. Try to ping matrix and google from each of your VM's to ensure you can reach the outside world.

If everything works - great. If not, move on to the next section.

Linux network connection configuration troubleshooting

If the network works in your host but not in the VM, the following are the usual steps you go through to troubleshoot the problem, starting with the first two rules of troubleshooting:

  1. Is it plugged in? On a physical network you would check whether the cable is plugged in and the link light is on on your network card. In a virtual network environment you don't have that - you'll need to check the NIC settings in the virtual machine details. In there it will tell you which virtual network your virtual network card is connected to.
  2. Is it turned on? This is a problem more common with virtual networks than physical networks. Check in your VirtManager->ConnectionDetails->VirtualNetworks that your network is active.
  3. Do you have an IP address? Run ip address to check.
  4. Can you ping the host by IP? (by its internal IP address). If not - check all of the above, check if you have an IP address conflict, check that your subnet mask is correct.
  5. Can you ping 8.8.8.8? If all of the above work - check that your default gateway is set correctly with ip route and that you can ping the default gateway.
  6. Can you resolve google.ca? Run host google.ca. If it doesn't come back with an IP address, and all of the above worked - check that your DNS server is configured correctly and that you can ping it.

There is a number of other problems that could prevent your network connection from functioning but the above are the most common ones. You should be able to go through the troubleshooting process pretty quickly. Setting up the network in this course is never a primary task, but it's almost always a prerequisite for anything else we're going to do. You can't have a working web server (or any other kind of server) if you don't have a working network connection.

ssh & ssh keys rsync & cron