In these steps, we'll configure Linux and Windows machines to act as DNS clients. We start with client setup because it's the most common task. Provisioning virtual machines to a VLAN offers several challenges, including configuring the network gateway and the DNS servers you want to use. It's difficult for the cloud provider to know the gateway and DNS settings for your VLAN, so that you typically need to do this part yourself. First we'll explain the steps for configuring network and hostname settings for a Linux virtual machine on a VLAN. The client in this example was provisioned from the base Red Hat Enterprise Linux (RHEL) version 6.2 virtual machine image in the SCE image library.
If your goal is to configure a DNS server, these steps are also good to try out manually if your goal is to automate them. You may want to revisit this section after performing the steps in the later section "DNS Server Setup."
The steps in this section assume the following:
- You already have a DNS server and know its IP address. (Ask your administrative contact, if necessary.)
- You have a virtual machine and an SSH key to connect to it.
If you're the administrative contact and you haven't set up your own DNS server yet, you can begin with the cloud provider's public DNS server. You can determine whether this will work by provisioning a virtual machine to the Internet and checking the DNS system that it's configured to use.
Several conventions are used in the following sections related to commands:
> The right angle bracket (>) represents a command-line prompt on a local workstation.
$ The dollar sign ($) represents a command-line prompt on a Linux VM, executed by a regular user (idcuser).
# The number sign (#) represents a command-line prompt on a Linux VM, executed by the root user.
The text after the command is the output from the command. We include it only when there's something particular to note in the output. In cases where the command is vi, the text following the command is the contents of a file for editing.
Step 1: Configure the Gateway
In this step, you'll configure your Linux virtual machine to point at the proper network gateway. Set the gateway to the private IP of the gateway server for the VLAN and restart the network service. As root, edit the files shown in Listing 1.
Listing 1Configuring the gateway on the RHEL 6 virtual machine on a VLAN.
# vi /etc/sysconfig/network-scripts/route-eth0 . . . default table route_eth0 via <gateway> dev eth0 # vi /etc/sysconfig/network-scripts/ifcfg-eth0 . . . GATEWAY=<gateway> # /sbin/service network restart
Replace the <gateway> values in Listing 1 with the values for your own environment.
Test that you can reach a public server, such as a Yahoo! server, by using curl:
$ curl 18.104.22.168
You should see the HTML page returned from curl.
Step 2: Configure DNS Resolution
Client network settings are configured in the resolv.conf file in Linux. Edit the /etc/resolv.conf file as shown in Listing 2; add a line using the IP address of your own DNS server, and substituting the names of your own domain and DNS server IP.
Listing 2Configuring a DNS client.
# vi /etc/resolv.conf domain sceexample.com nameserver <dns_server_ip>
Test the settings by using the nslookup or dig command on the VM with the BIND server using a well-known website, such as Yahoo! (http://www.yahoo.com). Basic use of the nslookup command is as follows:
$ nslookup http://www.yahoo.com Name: ds-sg-fp3.wg1.b.yahoo.com Address: 22.214.171.124 . . .
The result of this nslookup command shows that the IP address 126.96.36.199 of the Yahoo! server was found.
Step 3: Add Compatible Entries for the Local Server
The hostname settings for the virtual machine itself are contained in the /etc/hosts file. Edit the /etc/hosts file to add a line as shown :
# vi /etc/hosts . . . 10.128.105.47 vm-10-128-105-47 vm-10-128-105-47.scexample.com 10.128.105.47 myserver myserver.scexample.com
Substitute the hostname of your own virtual machine and your own domain name.
Using nslookup as shown below, test that you can look up the address of your own server, including the newly configured domain and some other servers that are on the same VLAN:
# nslookup vm-10-128-105-47 . . . Name: vm-10-128-105-47.sceexample.com Address: 10.128.105.47 # nslookup vm-10-128-105-48 . . . Name: vm-10-128-105-48.sceexample.com Address: 10.128.105.48
This completes the configuration of the Linux machine as a DNS client.
Configuring a Windows Client
It can be convenient to set up your Windows client workstation to use the same DNS server as your cloud-based virtual machines. The configuration for Windows Server is similar. You can configure these settings to use the nameserver with the dialog in Figure 3.
Figure 3 Windows DNS configuration.