This article will describe installing dhcp and running DHCP server.
Table of Contents
1 Install dhcp-server
Install dhcp-server with zypper.
> sudo zypper -n in dhcp-server > sudo systemctl enable dhcpd
You must set DHCPD_INTERFACE in /etc/sysconfig/dhcpd. Set interface name which is displayed by /sbin/ifconfig. This article uses "eth0".
> sudo sed -e 's/^DHCPD_INTERFACE=.*/DHCPD_INTERFACE="eth0"/g' \ -i /etc/sysconfig/dhcpd
2 /etc/dhcpd.conf
Define domain name, DHCP server and gateway. Mapping MAC address 52:54:00:5e:7a:a4 to IP address 192.168.11.254.
> cat <<EOF | sudo tee /etc/dhcpd.conf subnet 192.168.11.0 netmask 255.255.255.0 { option domain-name "hiroom2.com"; option domain-name-servers 192.168.11.2, 192.168.11.1; option routers 192.168.11.1; } host opensuse-14-dhcp-client { hardware ethernet 52:54:00:5e:7a:a4; fixed-address 192.168.11.254; } EOF
Restart dhcpd.
> sudo systemctl restart dhcpd
3 Execution result
Checking IP address on client machine.
IP address is provided.
> ip a s <snip> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 52:54:00:5e:7a:a4 brd ff:ff:ff:ff:ff:ff inet 192.168.11.254/24 brd 192.168.11.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::5054:ff:fe5e:7aa4/64 scope link valid_lft forever preferred_lft forever
DNS information is provided.
> cat /etc/resolv.conf <snip> search hiroom2.com nameserver 192.168.11.2 nameserver 192.168.11.1