YouTube - :)

DHCP CentOS Ubuntu

IP - Linux

5

! , DHCP- Linux CentOS Linux Ubuntu. !

DHCP CentOS Ubuntu

DHCP- CentOS Ubuntu

DHCP- Linux, , :

# yum install dhcp		              #CentOS
$ sudo apt install isc-dhcp-server	#Ubuntu

, , DHCP , /etc/default/isc-dhcp-server /etc/sysconfig/dhcpd.

# vim /etc/sysconfig/dhcpd		               #CentOS
$ sudo vim /etc/default/isc-dhcp-server	 #Ubuntu

, , DHCPD eth0, .

DHCPDARGS=eth0

.


DHCP- CentOS Ubuntu

DHCP /etc/dhcp/dhcpd.conf, , , , .

, :

  • : , , DHCP-.
  • : , , .

DHCP-.

------------ CentOS ------------ 
# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf	
# vi /etc/dhcp/dhcpd.conf	

------------ Ubuntu ------------
$ sudo vim /etc/dhcp/dhcpd.conf		

, , . :

option domain-name "merionet.ru";
option domain-name-servers ns1.merionet.ru, ns2.merionet.ru;
default-lease-time 3600; 
max-lease-time 7200;
authoritative;

:

subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers                  192.168.1.1;
        option subnet-mask              255.255.255.0;
        option domain-search            " merionet.ru ";
        option domain-name-servers      192.168.1.1;
        range   192.168.10.10   192.168.10.100;
        range   192.168.10.110   192.168.10.200;
}

:

  • subnet , ;
  • option routers -;
  • option subnet-mask ;
  • range IP-;
  • option domain-name-servers DNS-;
  • option domain-name ;
  • option broadcast-address ;
  • default-lease-time, max-lease-time , DHCP- ;

, , , c.

 
man dhcp-options

, DHCP-, , , , .

------------ CentOS ------------ 
# systemctl start dhcpd
# systemctl enable dhcpd
# systemctl enable dhcpd

------------ Ubuntu ------------
$ sudo systemctl start isc-dhcp-server
$ sudo systemctl enable isc-dhcp-server
$ sudo systemctl enable isc-dhcp-server

DHCP , 67/UDP, .

------------ CentOS ------------ 
# firewall-cmd --zone=public --permanent --add-service=dhcp
# firewall-cmd --reload 

#------------ Ubuntu ------------
$ sudo ufw allow 67/udp
$ sudo ufw reload

DHCP

, , DHCP. IP- .

, IP-.


DHCP CentOS

CentOS /etc/sysconfig/network-scripts/.

# vim /etc/sysconfig/network-scripts/ifcfg-eth0

:

DEVICE=eth0
BOOTPROTO=dhcp
TYPE=Ethernet
ONBOOT=yes

( ).

# systemctl restart network

DHCP- Ubuntu

Ubuntu 16.04 /etc/network/interfaces.

$ sudo vi /etc/network/interfaces

:

auto  eth0
iface eth0 inet dhcp

( ).

$ sudo systemctl restart networking

Ubuntu 18.04 Netplan. , , /etc/netplan/

$ sudo vim /etc/netplan/01-netcfg.yaml

dhcp4 , , ethernet, ens0, , IP:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens0:
      dhcp4: yes

, .

$ sudo netplan apply

dhcpd dhcpd.conf.

$ man dhcpd
$ man dhcpd.conf

! , DHCP- CentOS Ubuntu Linux.


?


: