Lesson 5

Dates: 2/15/2017
Linux networking
Linux System Administration


Exercises: Configuring Linux on a network


  • Start both, kvm3 and CentOS7 VMs:
    virsh start kvm3
    virsh start CentOS7
    
  • Login to console of kvm3:
    virsh console kvm3
    
  • Bring up another command prompt on the desktop and login to CentOS7
    virsh console CentOS7
    
  • On each VM, execute command ifconfig to read the IP address:
    ifconfig eth0
    
  • Try pinging CentOS7 from kvm3 and vise versa by the IP address, for example:
    ping -c 3 192.168.122.79
    
  • Become root on both the VMs
    sudo -s
    

  • Reconfigure eth0 network interface on kvm3:
    ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up
    
  • Verify the network settings:
    ifconfig eth0 
    
  • Ping CentOS7 by the IP address:
    ping -c 3 192.168.1.6
    
  • Try ssh to CentOS7:
    ssh hostadm@192.168.1.6
    
  • Reconfigure eth0 network interface on CentOS7:
    ifconfig eth0 192.168.1.6 netmask 255.255.255.0 up
    
  • Verify the network settings:
    ifconfig eth0        
    
  • Ping kvm3 by the IP address:
    ping -c 3 192.168.1.5 
    
  • Check who is login to the system:
    who
    
  • Reset the network setting to the default on the both VMs:
    ifdown eth0
    ifup eth0
    
  • Check the updated network settings on the both VMs:
    ifconfig eth0
    

    Static IP configuration on the VMs.
  • On kvm3, edit file /etc/network/interfaces and put the following settings for the static IP configuration there:
    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet static
    address 192.168.1.5
    netmask 255.255.255.0
    
  • Reset the network setting to the new default:
    ifdown eth0
    ifup eth0
    
  • Ping CentOS7 by the IP address:
    ping -c 3 192.168.1.6
    
  • On CentOS7, edit file /etc/sysconfig/network-scripts/ifcfg-eth0 and put the following settings for the static IP configuration there:
    DEVICE=eth0
    TYPE=Ethernet
    ONBOOT=yes
    BOOTPROTO=none
    IPADDR=192.168.1.6
    NETMASK=255.255.255.0
    NETWORK=192.168.1.0
    BROADCAST=192.168.1.255
    
  • Reset the network setting to the new default:
    ifdown eth0
    ifup eth0
    
  • Ping kvm3 by the IP address:
    ping -c 3 192.168.1.5
    

  • Restore the interface settings to DHCP on the both VMs.
  • On kvm3, edit file /etc/network/interfaces and put the following settings for DHCP configuration:
    auto lo
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto eth0
    iface eth0 inet dhcp
    
    
  • Reset the network setting to the new default:
    ifdown eth0
    ifup eth0
    
  • Verify the network settings:
    ifconfig eth0
    
  • On CentOS7, edit file /etc/sysconfig/network-scripts/ifcfg-eth0 and put the following settings for DHCP configuration:
    NETWORKING=yes
    DEVICE=eth0
    TYPE=Ethernet
    ONBOOT=yes
    BOOTPROTO=dhcp
    
  • Reset the network setting to the new default:
    ifdown eth0
    ifup eth0
    
  • Verify the network settings:
    ifconfig eth0
    
    The interface should acquire IP address on 192.168.122.0 network.



  • Take me to the Course Website