|
Simple DHCP server
HDFS cluster is created when deep / etc / hosts configuration added inconvenience inconsistent easily lead to errors, a large workload.
Or create a convenient dhcp server in the LAN. Official documents: https: //help.Ubuntu.com/community/isc-dhcp-server
Create a KVM virtual machine, OS of Ubuntu 12.04.
Then install dhcp3 server
apt-get install isc-dhcp-server
Edit the file / etc / default / isc-dhcp-server
Fill eth0
INTERFACES = "eth0"
Edit the file: /etc/dhcp/dhcpd.conf
Example.org modify the original settings are:
# 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, datanode3.hadoop.cn, datanode4.had
oop.cn, datanode5.hadoop.cn, datanode6.hadoop.cn;
Increase the lease time:
default-lease-time 6000;
max-lease-time 72000;
Edit the file: /etc/dhcp/dhcpd.conf
Example.org modify the original settings are:
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, broadcast IP address.
Service command:
service isc-dhcp-server start
Note that the address dhcp eth0 and must be used in a network. Otherwise it will fail to start.
Created based on Virutal IP
Because I actually want to be able to use DHCP to assign addresses, so creating a new virtual IP address in another network in / etc / network / interfaces file:
Not eth0: 1 this way.
# 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 inside
INTERFACES = "eth0"
Then dhcpd.conf above all 192.168.1.X are replaced 192.168.4.X can. Restart success! |
|
|
|