LINUX学生会linux学习

Linux基础之DHCP服务篇

2017-07-26  本文已影响119人  数据革命

Linux基础之DHCP服务篇

简介

静态IP和动态IP

DHCP服务

DHCP续租

DHCP服务器搭建

[root@localhost ~]# rpm -ql dhcp
/etc/NetworkManager
/etc/NetworkManager/dispatcher.d
/etc/NetworkManager/dispatcher.d/12-dhcpd
/etc/dhcp
/etc/dhcp/dhcpd.conf              <<配置文件是这个
/etc/dhcp/dhcpd6.conf
/etc/openldap/schema/dhcp.schema
/etc/sysconfig/dhcpd
/usr/bin/omshell
/usr/lib/systemd/system/dhcpd.service         <<启动文件
/usr/lib/systemd/system/dhcpd6.service
/usr/lib/systemd/system/dhcrelay.service
/usr/sbin/dhcpd
/usr/sbin/dhcrelay
/usr/share/doc/dhcp-4.2.5
/usr/share/doc/dhcp-4.2.5/dhcpd.conf.example
/usr/share/doc/dhcp-4.2.5/dhcpd6.conf.example
/usr/share/doc/dhcp-4.2.5/ldap
/usr/share/doc/dhcp-4.2.5/ldap/README.ldap
/usr/share/doc/dhcp-4.2.5/ldap/dhcp.schema
/usr/share/doc/dhcp-4.2.5/ldap/dhcpd-conf-to-ldap
/usr/share/man/man1/omshell.1.gz
/usr/share/man/man5/dhcpd.conf.5.gz
/usr/share/man/man5/dhcpd.leases.5.gz
/usr/share/man/man8/dhcpd.8.gz
/usr/share/man/man8/dhcrelay.8.gz
/usr/share/systemtap/tapset/dhcpd.stp
/var/lib/dhcpd
/var/lib/dhcpd/dhcpd.leases
/var/lib/dhcpd/dhcpd6.leases
[root@localhost ~]# systemctl start dhcpd
Job for dhcpd.service failed because the control process exited with error code. See "systemctl status dhcpd.service" and "journalctl -xe" for details.
[root@localhost ~]# ss -nul
State       Recv-Q Send-Q                                 Local Address:Port                                                Peer Address:Port              
UNCONN      0      0                                          127.0.0.1:323                                                            *:*                  
UNCONN      0      0                                                ::1:323                                                           :::*   
[root@localhost ~]# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#
[root@localhost ~]# service dhcp status
Redirecting to /bin/systemctl status  dhcp.service
Unit dhcp.service could not be found.
5.png
[root@localhost ~]# ss -nul
State       Recv-Q Send-Q                                 Local Address:Port                                                Peer Address:Port              
UNCONN      0      0                                          127.0.0.1:323                                                            *:*                  
UNCONN      0      0                                                  *:20231                                                          *:*                  
UNCONN      0      0                                                  *:67                                                             *:*                  
UNCONN      0      0                                                ::1:323                                                           :::*                  
UNCONN      0      0                                                 :::24688                                                         :::*     
[root@localhost ~]# ss -nlup
State       Recv-Q Send-Q                                 Local Address:Port                                                Peer Address:Port              
UNCONN      0      0                                          127.0.0.1:323                                                            *:*                   
users:(("chronyd",pid=1063,fd=1))UNCONN      0      0                                                  *:20231                                                          *:*                   
users:(("dhcpd",pid=34715,fd=20))UNCONN      0      0                                                  *:67                                                             *:*                   
users:(("dhcpd",pid=34715,fd=7))UNCONN      0      0                                                ::1:323                                                           :::*                   
users:(("chronyd",pid=1063,fd=2))UNCONN      0      0                                                 :::24688                                                         :::*                   
users:(("dhcpd",pid=34715,fd=21))
[root@localhost ~]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5

server-duid "\000\001\000\001!\013.\307\000\014)\323\362O";

lease 192.168.202.80 {
  starts 3 2017/07/26 10:59:14;
  ends 3 2017/07/26 11:09:14;
  cltt 3 2017/07/26 10:59:14;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 00:0c:29:43:1a:52;
}
lease 192.168.202.81 {
  starts 3 2017/07/26 10:59:25;
  ends 3 2017/07/26 11:09:25;
  cltt 3 2017/07/26 10:59:25;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 00:0c:29:b1:52:0a;
}



[root@localhost ~]# cat /etc/resolv.conf 
; generated by /sbin/dhclient-script
search lilin.com
nameserver 114.114.114.114
nameserver 8.8.8.8

IP绑定

11.png
上一篇 下一篇

猜你喜欢

热点阅读