0

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

  1. option routers - this is the gateway to be used by clients but, should this be the static IP address that I was given?
  2. 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?
  3. 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?
  4. 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?
  5. 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.

edesz
  • 101
  • 3
  • XenServer is stripped down a lot. No security patch got pushed there for other thing than xen service. You cant have a 5th VM to provide such functionality? (like pfsense or such) – yagmoth555 Jul 30 '16 at 02:59
  • Thanks for your reply. Unfortunately, I can't add more VMs to the host and we can't add network storage either. For the host, it seems that I have installed the package correctly and all the required files are present...it is just not letting me start the service and I think it is being caused by an incorrect `dhcpd.conf` file. However, do you mean that it is not possible to set up a dhcp server on a XenServer host? Is there a reason why it is not possible to do this? – edesz Jul 30 '16 at 03:17
  • Another question that I am finding difficult to understand: Is there another file that I need to change, besides `dhcpd.conf` or is a system restart required in order to get the DHCP server started correctly? – edesz Jul 30 '16 at 19:29
  • I cant tell sorry, Iam not a linux guru. I know xen, but only it standard option. – yagmoth555 Jul 30 '16 at 22:08
  • You should look at your dhcpd logs to determine what the problem is. – user9517 Jul 31 '16 at 08:34
  • Thank Iain. I have tried these `journalctl | grep -Ei 'dhcp'`, `cat /var/log/syslog | grep -Ei 'dhcp'` and `cat /var/log/dhcpd.log` as per [here](http://superuser.com/questions/944687/how-to-see-what-dhcp-client-does). The first one returns `-bash: journalctl: command not found` and the other 2 both return `No such file or directory`. I couldn't find info on where CentOS logs this. Do you know where the `dhcp` logs can be retrieved from? – edesz Aug 01 '16 at 03:08

0 Answers0