This lab will step you through the following:
The DHCP server on your MacMini is configured to hand out specific IP addresses to VMs with specific MAC addresses. The DNS server BIND on the MacMini maintains entries for each IP address provided by our DHCP server so that virtual machines can be reached by name.
Let's first review where we set IP addresses for virtual machines on our backbone. Use the xterm in your X Window Desktop to do the following on your MacMini. If you turned off your X Window Desktop see the prior excercises to restart reconnect:
# less /etc/dhcp/dhcpd.ws.conf
Now let's find the entry for host1.ws.nsrc.org. On your keyboard press the "/" (forward slash) key and type in "host1" and press enter. You should see:
host host1 {
hardware ethernet 52:54:0a:0a:00:01;
fixed-address 10.10.0.1;
}
at the top of your screen. Make a note of the MAC address (hardware ethernet) entry of:
52:54:0a:0a:00:01
Now type "q" to exit from the less command.
Look in our main BIND database file for the domain ws.nsrc.org:
$ less /etc/bind/db.ws.nsrc.org
Now let's find the entry for host1.ws.nsrc.org. On your keyboard press the "/" (forward slash) key and type in "host" and press enter. Press the "n" key once to go the next entry and you should see:
$GENERATE 1-99 host$ IN A 10.10.0.$
This is a fancy way to tell bind to generate 100 entries of the form:
host1 IN A 10.10.0.1
host2 IN A 10.10.0.2
host3 IN A 10.10.0.3
...
...
...
host97 IN A 10.10.0.97
host98 IN A 10.10.0.98
host99 IN A 10.10.0.99
So, as you can see the IP address 10.10.0.1 will be given the name host1.ws.nsrc.org. Now let's change our VM's MAC address to see this in action.
In your X Window Desktop make sure to start your virtual machine
One you are in the VM's console type the command you can log in as user sysadm and do:
$ ifconfig
You are interested in the "inet addr:" item and the "HWaddr" item. Make a note of both. Now press Shut Down in your console window to stop your VM. Right click in the upper corner of the console window to close the window.
In the virt-manager interface highlight your virtual machine
Now start your VM and open a console, log in and check the IP address and the MAC address:
host1 login: sysadm
Password:
$ ifconfig
$ hostname
You should see that the IP address is now 10.10.0.1, the MAC address is 52:54:0a:0a:00:01 and the host name is now host1.ws.nsrc.org. This is pretty cool!
You can check this by opening a terminal session on one of your laptops, or connecting to the MacMini and verifying that host1 is now up and on the network:
$ ping host1.ws.nsrc.org
$ dig host1.ws.nsrc.org
In this case using the command line virsh utility might be much quicker to make a change like this. In your xterm or in an ssh session to your MacMini you could simply do:
$ virsh shutdown <SOME_FUN_NAME>
$ virsh edit <SOME_FUN_NAME>
Then search for the string "