Difference between revisions of "CentOS DHCP"
(Created page with "Category:rchanCategory:centos = Issue = == Client Lease file == On DHCP client machine running CentOS 7.x, when NetworkManager is enable, check the following directory...") |
(No difference)
|
Revision as of 04:16, 22 September 2016
Issue
Client Lease file
On DHCP client machine running CentOS 7.x, when NetworkManager is enable, check the following directory for possible dhclient processor id:
cd /var/var ls -l | grep dhclient [root@localhost run]# ls -l | grep dhclient -rw-r--r--. 1 root root 5 Sep 22 03:41 dhclient-enp0s25.pid
"cat" the file "dhclient-enp0s25.pid", this should be the process that obtains an IP address from the DHCP server:
[root@localhost run]# cat dhclient-enp0s25.pid 3707
Run the command "lsof -p 3707" to find out which files are opened by the this dhcp client process:
[root@localhost run]# lsof -p 3707 lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs Output information may be incomplete. COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME dhclient 3707 root cwd DIR 253,1 4096 128 / dhclient 3707 root rtd DIR 253,1 4096 128 / dhclient 3707 root txt REG 253,1 424272 69175939 /usr/sbin/dhclient dhclient 3707 root mem REG 253,1 61928 70044141 /usr/lib64/libnss_files-2.17.so dhclient 3707 root mem REG 253,1 398264 69337527 /usr/lib64/libpcre.so.1.2.0 dhclient 3707 root mem REG 253,1 11376 67413136 /usr/lib64/libfreebl3.so dhclient 3707 root mem REG 253,1 147120 67413192 /usr/lib64/libselinux.so.1 dhclient 3707 root mem REG 253,1 40816 70044128 /usr/lib64/libcrypt-2.17.so dhclient 3707 root mem REG 253,1 68192 67413300 /usr/lib64/libbz2.so.1.0.6 dhclient 3707 root mem REG 253,1 91496 67882403 /usr/lib64/libelf-0.163.so dhclient 3707 root mem REG 253,1 153192 67413288 /usr/lib64/liblzma.so.5.0.99 dhclient 3707 root mem REG 253,1 19888 67413799 /usr/lib64/libattr.so.1.1.0 dhclient 3707 root mem REG 253,1 15688 67413495 /usr/lib64/libkeyutils.so.1.5 dhclient 3707 root mem REG 253,1 62720 69337485 /usr/lib64/libkrb5support.so.0.1 dhclient 3707 root mem REG 253,1 251784 67109588 /usr/lib64/libnspr4.so dhclient 3707 root mem REG 253,1 20016 69337487 /usr/lib64/libplc4.so dhclient 3707 root mem REG 253,1 15768 69337497 /usr/lib64/libplds4.so dhclient 3707 root mem REG 253,1 182056 69337496 /usr/lib64/libnssutil3.so dhclient 3707 root mem REG 253,1 1220152 68189018 /usr/lib64/libnss3.so dhclient 3707 root mem REG 253,1 164016 69261726 /usr/lib64/libsmime3.so dhclient 3707 root mem REG 253,1 276688 69261727 /usr/lib64/libssl3.so dhclient 3707 root mem REG 253,1 121296 67413483 /usr/lib64/libsasl2.so.3.0.0 dhclient 3707 root mem REG 253,1 110808 70044151 /usr/lib64/libresolv-2.17.so dhclient 3707 root mem REG 253,1 88720 70044117 /usr/lib64/libgcc_s-4.8.5-20150702.so.1 dhclient 3707 root mem REG 253,1 297464 67882460 /usr/lib64/libdw-0.163.so dhclient 3707 root mem REG 253,1 44096 70102429 /usr/lib64/librt-2.17.so dhclient 3707 root mem REG 253,1 19520 70044130 /usr/lib64/libdl-2.17.so dhclient 3707 root mem REG 253,1 1141560 70044133 /usr/lib64/libm-2.17.so dhclient 3707 root mem REG 253,1 90632 67118658 /usr/lib64/libz.so.1.2.7 dhclient 3707 root mem REG 253,1 1509376 69337523 /usr/lib64/libxml2.so.2.9.1 dhclient 3707 root mem REG 253,1 142304 70044149 /usr/lib64/libpthread-2.17.so dhclient 3707 root mem REG 253,1 20024 67413801 /usr/lib64/libcap.so.2.22 dhclient 3707 root mem REG 253,1 2017168 69337492 /usr/lib64/libcrypto.so.1.0.1e dhclient 3707 root mem REG 253,1 15840 67413200 /usr/lib64/libcom_err.so.2.1 dhclient 3707 root mem REG 253,1 202576 69337473 /usr/lib64/libk5crypto.so.3.1 dhclient 3707 root mem REG 253,1 950496 69337483 /usr/lib64/libkrb5.so.3.3 dhclient 3707 root mem REG 253,1 316528 67413306 /usr/lib64/libgssapi_krb5.so.2.2 dhclient 3707 root mem REG 253,1 2112384 69450411 /usr/lib64/libc-2.17.so dhclient 3707 root mem REG 253,1 344248 69634318 /usr/lib64/libldap-2.4.so.2.10.3 dhclient 3707 root mem REG 253,1 61856 69634316 /usr/lib64/liblber-2.4.so.2.10.3 dhclient 3707 root mem REG 253,1 23968 67413490 /usr/lib64/libcap-ng.so.0.0.0 dhclient 3707 root mem REG 253,1 365352 70591020 /usr/lib64/libisc-export.so.95.2.1 dhclient 3707 root mem REG 253,1 1332264 70591016 /usr/lib64/libdns-export.so.100.1.1 dhclient 3707 root mem REG 253,1 125216 68981254 /usr/lib64/libomapi.so.0.0.0 dhclient 3707 root mem REG 253,1 164440 67413121 /usr/lib64/ld-2.17.so dhclient 3707 root mem REG 253,1 26272 69759965 /usr/lib64/libsystemd-daemon.so.0.0.12 dhclient 3707 root 0r CHR 1,3 0t0 1039 /dev/null dhclient 3707 root 1w CHR 1,3 0t0 1039 /dev/null dhclient 3707 root 2w CHR 1,3 0t0 1039 /dev/null dhclient 3707 root 3u unix 0xffff8800af3c8400 0t0 36030 socket dhclient 3707 root 4w REG 253,1 766 137315992 /var/lib/NetworkManager/dhclient-8a2d820f-f6b9-4f5c-aaa4-edca33a393c6-enp0s25.lease dhclient 3707 root 5u pack 36040 0t0 ALL type=SOCK_RAW dhclient 3707 root 6u IPv4 35236 0t0 UDP *:bootpc dhclient 3707 root 20u IPv4 36031 0t0 UDP *:9554 dhclient 3707 root 21u IPv6 36032 0t0 UDP *:wag-service
Check the directory for the normal location for dhcp lease file store by the client:
[root@localhost dhclient]# ls -l /var/lib/dhclient total 0
Please note that it is empty. From the above "lsof" output, check the /var/lib/NetworkManager directory contents:
[root@localhost dhclient]# ls /var/lib/NetworkManager/ dhclient-06a501aa-fed4-47fb-a470-5e215e9422de-virbr1-nic.lease dhclient-24e40adc-e339-4588-ad56-9f94a5e966fe-virbr1-nic.lease dhclient-47329694-77a8-4337-a638-fededd6e104d-virbr0-nic.lease dhclient-5eb6278c-3bfc-4662-9e81-1b5b29194905-virbr1-nic.lease dhclient-6c1bac15-9650-4853-8a7e-6fbf294a60e7-virbr1-nic.lease dhclient-7932d78b-9d43-485b-8046-c4293b7c3cce-virbr0-nic.lease dhclient-8a2d820f-f6b9-4f5c-aaa4-edca33a393c6-enp0s25.lease dhclient-9772f47f-c9f5-4939-b835-a4b647d224c5-virbr0-nic.lease dhclient-ae8067cc-c66d-4451-aad2-6313c46bc806-virbr0-nic.lease dhclient-aecbf20b-3cda-4f8d-bcef-0d22fa57dd57-virbr1-nic.lease dhclient-b9f35cbd-ba0c-492d-acc1-79581e614ffb-virbr0-nic.lease dhclient-d36d3082-4bf2-4fa5-b911-79217a88dd16-virbr1-nic.lease dhclient-eb416a23-ce17-41f3-9920-00ac6e677c4c-virbr0-nic.lease dhclient-ed73d158-b707-460c-bae1-6dd8dd779f5b-virbr0-nic.lease dhclient-enp0s25.conf dhclient-f97cd8eb-1567-4f5d-8405-dac75a296bff-vnet1.lease NetworkManager.state timestamps timestamps.DR4IOY
Check the contents of dhclient-8a2d820f-f6b9-4f5c-aaa4-edca33a393c6-enp0s25.lease
[root@localhost dhclient]# cat /var/lib/NetworkManager/dhclient-8a2d820f-f6b9-4f5c-aaa4-edca33a393c6-enp0s25.lease lease { interface "enp0s25"; fixed-address 192.168.53.100; option subnet-mask 255.255.255.0; option dhcp-lease-time 4294967295; option routers 192.168.53.1; option dhcp-message-type 5; option dhcp-server-identifier 192.168.53.1; option domain-name-servers 192.168.53.1; renew 1 2084/10/09 06:04:15; rebind 2 2135/10/25 14:29:44; expire 0 2152/10/29 09:18:22; } lease { interface "enp0s25"; fixed-address 192.168.53.100; option subnet-mask 255.255.255.0; option routers 192.168.53.1; option dhcp-lease-time 4294967295; option dhcp-message-type 5; option domain-name-servers 192.168.53.1; option dhcp-server-identifier 192.168.53.1; renew 2 2084/10/10 10:56:04; rebind 2 2135/10/25 19:21:33; expire 0 2152/10/29 14:10:11; }
Information about the NIC enp0s25:
[root@localhost dhclient]# ifconfig enp0s25 enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.53.100 netmask 255.255.255.0 broadcast 192.168.53.255 inet6 fe80::21c:c0ff:fea5:9b82 prefixlen 64 scopeid 0x20<link> ether 00:1c:c0:a5:9b:82 txqueuelen 1000 (Ethernet) RX packets 22382 bytes 20488641 (19.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 17934 bytes 3642148 (3.4 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 20 memory 0xe0200000-e0220000
Please note that in the above case, the DHCP server has been configured to reserve 192.168.53.100 for DHCP client with MAC address 00:1c:c0:a5:9b:82