I have a host with XenServer 6.5 (based on CentOS 5) that is currently set up using a static IP by following the procedure here. I have been provided with an IP address, netmask and gateway - I entered these in the fields shown in figure 6 in the above link.
Overview of setup:
XenServer is installed on the host. There are 4 virtual machines that reside on the host as above. I have been assigned one static IP address. I assigned it to the host. Now, I need to set up a DHCP server on the host that I can use to provide IP addresses to all 4 virtual machines (clients). I was given the following static IP information:
Static IP: 156.74.180.143
Netmask: 255.255.255.224
DNS: 156.74.20.10, 156.189.111.61
Gateway: 156.74.180.225
Internal IPs*: 10.0.0.254, 127.0.0.1
*Internal IPs found using ifconfig | perl -nle'/dr:(\S+)/ && print $1'
.
DHCP Server - main problem
The host appears to be successfully connecting to the internet. I can ping the gateway and google as shown below:
[ABCD@localhost ~]# ping -c 4 -n 10.0.0.254
PING 10.0.0.254 (10.0.0.254) 56(84) bytes of data.
64 bytes from 10.0.0.254: icmp_seq=1 ttl=64 time=0.061 ms
64 bytes from 10.0.0.254: icmp_seq=2 ttl=64 time=0.037 ms
64 bytes from 10.0.0.254: icmp_seq=3 ttl=64 time=0.033 ms
64 bytes from 10.0.0.254: icmp_seq=4 ttl=64 time=0.059 ms
--- 10.0.0.254 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2997ms
rtt min/avg/max/mdev = 0.033/0.047/0.061/0.014 ms
[ABCD@localhost ~]# ping -c 4 -n 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=57 time=2.87 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=57 time=2.71 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=57 time=2.81 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=57 time=2.69 ms
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 2.699/2.777/2.879/0.082 ms
dhcpd.conf file settings
XenServer 6.5 is based on CentOS 5 so I followed a tecadmin article to install dhcp
. Then I would configure my dhcpd.conf
file.
First, I backed up the default dhcpd.conf
file using:
$ yum -y install dhcp
$ cp --backup /etc/dhcpd.conf /etc/dhcpd.conf.back #backup file
$ cp -f /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
In the 3rd line above, this will use the sample dhcpd.conf
file as template; in next step (below), I will make changes to template.
Okay, so then I started to customize my dhcpd.conf
file and this is where I am having trouble. Here is the dhcpd.config
file I am working with, based on this:
# line 4: specify your network and subnetmask
subnet 10.0.0.0 netmask 255.255.255.0 {
# line 7 : specify default gateway
option routers 156.74.180.143;
# line 8: specify subnetmask
option subnet-mask 255.255.255.0;
# line 12: specify IP address of DNS
option domain-name-servers 156.74.20.10, 156.189.111.61;
# line 14: comment out
option time-offset-18000;
# line 21: specify the range of IP addresses for clients
range 10.0.0.200 10.0.0.254;
# line 22: default terms of lease
default-lease-time 21600;
# line 23: maximun terms of lease
max-lease-time 43200;
After setting up this configuration, I started the dhcp
service using:
$ service dhcpd stop
$ service dhcpd start
This gives me:
Starting dhcpd: [FAILED]
Based on this, I would believe that my problem is isolated to my dhcpd configuration and should not be related to the XenServer host itself. Actually, it appears that the dhcp server is not able to start.
Questions
option routers
- this is the gateway to be used by clients but, should this be the static IP address that I was given?range
- How do I pick the range of IP addresses? Should these be internal IP addresses eg. such as 10.0.0.1 - 10.0.0.54?- I have not entered the static ip address of the host, netmask or gateway that I was given with the static IP. Are these needed in the
dhcpd.conf
file? netmask
- I used a subnet of 255.255.255.0. I was given 255.255.255.224 - do I need to use this or is 255.255.255.0 correct?- Is there something else I need to specify in order to successfully turn on the
dhcpd
service?
EDIT: Additional Information
I posted this question here as per here, but if it would be best to ask this elsewhere, feel free to let me know. Thanks.