【Linux】一步一步学Linux——dhclient命令(156)

00. 目录

01. 命令概述

dhclient命令使用动态主机配置协议动态的配置网络接口的网络参数,也支持BOOTP协议。

02. 命令格式

dhclient [参数] [网络接口]

03. 常用选项

-4 : 使用DHCPv4
-6 : 使用DHCPv6
-p	指定dhcp客户端监听的端口号(默认端口号86)
-d	总是以前台方式运行程序
-q	安静模式,不打印任何错误的提示信息
-r	释放ip地址
-n	不配置任何接口
-x	停止正在运行的DHCP客户端,而不释放当前租约,杀死现有的dhclient
-s	在获取ip地址之前指定DHCP服务器
-w	即使没有找到广播接口,也继续运行

04. 参考示例

4.1 动态获取IP

[root@localhost ~]# dhclient

4.2 释放IP

[root@localhost ~]# dhclient -r

4.3 动态获取IP,并且显示过程

[root@localhost ~]# dhclient -v ens33
dhclient(71545) is already running - exiting. 

This version of ISC DHCP is based on the release available
on ftp.isc.org.  Features have been added and other changes
have been made to the base software release in order to make
it work better with this distribution.

Please report for this software via the CentOS Bugs Database:
    http://bugs.centos.org/

exiting.
[root@localhost ~]# 

4.4 释放IP,显示过程

[root@localhost ~]# dhclient -r -v ens33
Internet Systems Consortium DHCP Client 4.2.5
Copyright 2004-2013 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/ens33/00:50:56:26:d8:88
Sending on   LPF/ens33/00:50:56:26:d8:88
Sending on   Socket/fallback
DHCPRELEASE on ens33 to 192.168.12.2 port 67 (xid=0x254c08e2)

4.5 从指定的服务器获取ip地址

[root@localhost ~]# dhclient -s 192.168.12.2

4.6 停止运行dhclient

[root@localhost ~]# dhclient -x 

05. 附录

参考:【Linux】一步一步学Linux系列教程汇总

  • 7
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值