When a simple DHCPserver creates an HDFS cluster, it is inconvenient to add the configuration in/etc/hosts. inconsistency may cause errors and heavy workload. It is also convenient to create a dhcp server in the LAN. Official documentation: Workshop
Simple DHCP server
When creating an HDFS cluster, I deeply feel that it is inconvenient to add the configuration in/etc/hosts. inconsistency may cause errors and heavy workload.
It is also convenient to create a dhcp server in the LAN. Official documents: https://help.Ubuntu.com/community/isc-dhcp-server
First, create a KVM virtual machine. The OS is Ubuntu 12.04.
Then install the dhcp3 server
Apt-get install isc-dhcp-server
Edit the/etc/default/isc-dhcp-server File
Enter eth0
INTERFACES = "eth0"
Edit the file:/etc/dhcp/dhcpd. conf
Modify the original example.org settings:
# Option definitions common to all supported networks...
Option domain-name "Hadoop.cn ";
Option domain-name-servers dhcp.hadoop.cn, namenode1.hadoop.cn, namenode2.hadoop.cn, datanode1.hadoop.cn, datanode2.hadoop.cn, region, datanode4.had \
Oop.cn, datanode5.hadoop.cn, datanode6.hadoop.cn;
Added lease period:
Default-lease-time 6000;
Max-lease-time 72000;
Edit the file:/etc/dhcp/dhcpd. conf
Modify the original example.org settings:
Option routers 192.168.1.1;
Subnet 192.168.1.0 netmask 255.255.255.0 {
Range 192.168.1.10 192.168.1.100;
Option domain-name-servers 192.168.1.1;
Option broadcast-address 192.168.1.255;
}
Including the router address, IP address range, DNS server IP address, and broadcast IP address.
Service command:
Service isc-dhcp-server start
Note that the IP address used by dhcp must be in the same CIDR block as eth0. Otherwise, the startup will fail.
Related reading:
Build DHCP server http://www.linuxidc.com/Linux/2013-06/86531.htm in Linux System
Configure master-slave DNS server and DDNS http://www.linuxidc.com/Linux/2013-06/85634.htm under DHCP in CentOS
SUSE Linux 11 pxe + DHCP + tftp + ftp unattended installation http://www.linuxidc.com/Linux/2013-06/85481.htm
The process of setting up DHCP server in Linux and the test http://www.linuxidc.com/Linux/2013-05/84832.htm
Linux previous step to implement DHCP server http://www.linuxidc.com/Linux/2013-04/82244.htm
Create Based on Virutal IP
Because I actually want to assign an IP address using DHCP in another network segment, create a new virtual IP address in the/etc/network/interfaces file:
Eth0: 1 is not required.
# The primary network interface
Auto eth0
Iface eth0 inet static
Address 192.168.1.111
Netmask 255.255.255.0
Network 192.168.1.0
Broadcast 192.168.1.255
Gateway 192.168.1.1
# Dns-* options are implemented by the resolvconf package, if installed
Dns-nameservers 8.8.8.8
Dns-search defaultdomain
Iface eth0 inet static
Address 192.168.4.1
Netmask 255.255.255.0
Then in/etc/default/isc-dhcp-server
INTERFACES = "eth0"
Replace all 192.168.1.X in dhcpd. conf with 192.168.4.X. Restarted successfully!
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2014-05/101579.htm