DHCP for Linux: Difference between revisions

From KlavoWiki
Jump to navigationJump to search
Created page with "<pre> yum -y install dhcp chkconfig dhcpd on </pre> <pre> vi /etc/dhcp/dhcpd.conf </pre> <pre> subnet 10.17.1.0 netmask 255.255.255.0 { default-lease-time ..."
 
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
== For Linux Servers ==
<pre>
<pre>
yum -y install dhcp
yum -y install dhcp
Line 8: Line 9:
</pre>
</pre>


The details of client devices with IP address will be entered into the file:
<pre>
/var/lib/dhcpd/dhcpd.leases
</pre>
== Debian ==
<pre>
apt-get install isc-dhcp-server
service isc-dhcp-server status
</pre>
<pre>
/etc/dhcp/dhcpd.conf
</pre>
The details of client devices with IP address will be entered into the file:
<pre>
/var/lib/dhcp/dhcpd.leases
</pre>
== ArchLinux ==
<pre>
pacman -S dhcp
systemctl enable dhcpd4.service
systemctl start dhcpd4.service
</pre>
<pre>
vi /etc/dhcpd.conf
</pre>
The details of client devices with IP address will be entered into the file:
<pre>
/var/lib/dhcp/dhcpd.leases
</pre>
== Common Configuration File ==
'''dhcpd.conf'''
<pre>
<pre>
authoritative;
option tftp150 code 150 = string;
option tftp66 code 66 = string;
subnet 10.17.1.0 netmask 255.255.255.0
subnet 10.17.1.0 netmask 255.255.255.0
   {
   {
Line 14: Line 59:
         max-lease-time                  86400;
         max-lease-time                  86400;


         option tftp66 code 66 =        10.17.1.5;
         option tftp66                   "10.17.1.5";


         option routers                  10.17.1.254;
         option routers                  10.17.1.254;
Line 20: Line 65:


         option domain-name              "mydomain.com";
         option domain-name              "mydomain.com";
         option domain-name-servers       10.17.1.254;
         option domain-name-servers     10.17.1.254;


         option time-offset              36000;  # Australian Eastern Standard Time in Seconds
         option time-offset              36000;  # Australian Eastern Standard Time in Seconds
Line 28: Line 73:
</pre>
</pre>


The details of client devices with IP address will be entered into the file:
=== Setting a Static Address ===
<pre>
<pre>
/var/lib/dhcpd/dhcpd.leases
host david
  {
              hardware ethernet 33:d6:44:04:a8:32;
                  fixed-address 192.168.1.15;
      option domain-name-servers 192.168.1.254;
            option domain-search "klaverstyn.com", "devices.klaversrtyn.com";
  }
</pre>
</pre>


[[Category : Linux]]
[[Category : Linux]]

Latest revision as of 23:10, 13 March 2018

For Linux Servers

yum -y install dhcp
chkconfig dhcpd on
vi /etc/dhcp/dhcpd.conf

The details of client devices with IP address will be entered into the file:

/var/lib/dhcpd/dhcpd.leases

Debian

apt-get install isc-dhcp-server
service isc-dhcp-server status
/etc/dhcp/dhcpd.conf

The details of client devices with IP address will be entered into the file:

/var/lib/dhcp/dhcpd.leases

ArchLinux

pacman -S dhcp

systemctl enable dhcpd4.service
systemctl start dhcpd4.service
vi /etc/dhcpd.conf

The details of client devices with IP address will be entered into the file:

/var/lib/dhcp/dhcpd.leases

Common Configuration File

dhcpd.conf

authoritative;

option tftp150 code 150 = string;
option tftp66 code 66 = string;

subnet 10.17.1.0 netmask 255.255.255.0
   {
        default-lease-time              86400;   # Seconds, 86400 =  24 Hours
        max-lease-time                  86400;

        option tftp66                   "10.17.1.5";

        option routers                  10.17.1.254;
        option subnet-mask              255.255.255.0;

        option domain-name              "mydomain.com";
        option domain-name-servers      10.17.1.254;

        option time-offset              36000;   # Australian Eastern Standard Time in Seconds

        range 10.17.1.101 10.17.1.150;
   }

Setting a Static Address

host david
   {
               hardware ethernet 33:d6:44:04:a8:32;
                   fixed-address 192.168.1.15;
      option domain-name-servers 192.168.1.254;
            option domain-search "klaverstyn.com", "devices.klaversrtyn.com";
   }