如何使用Linux命令 dhclient

The Internet Systems Consortium DHCP Client, dhclient, provides a means for configuring one or more network interfaces using the Dynamic Host Configuration Protocol, BOOTP protocol, or if these protocols fail, by statically assigning an address.

linux dhclient 的语法

dhclient [ -p port ] [ -d ] [ -e VAR=value ] [ -q ] [ -1 ] [ -r ] [ -lf lease-file ] [ -pf pid-file ] [ -cf config-file ] [ -sf script-file ] [ -e ENVVAR=value ] [ -s server ] [ -g relay ] [ -n ] [ -nw ] [ -w ] [ if0 [ ...ifN ] ]-p portIf the DHCP client should listen and transmit on a port other than the standard (port 68), the -p flag may used. It should be followed by the udp port number that dhclient should use. This is mostly useful for debugging purposes. If a different port is specified for the client to listen on and transmit on, the client will also use a different destination port - one greater than the specified destination port.

-sThe DHCP client normally transmits any protocol messages it sends before acquiring an IP address to, 255.255.255.255, the IP limited broadcast address. For debugging purposes, it may be useful to have the server transmit these messages to some other address. This can be specified with the -s flag, followed by the IP address or domain name of the destination.

-gFor testing purposes, the giaddr field of all packets that the client sends can be set using the -g flag, followed by the IP address to send. This is only useful for testing, and should not be expected to work in any consistent or useful way.

-dThe DHCP client will normally run in the foreground until it has configured an interface, and then will revert to running in the background. To run force dhclient to always run as a foreground process, the -d flag should be specified. This is useful when running the client under a debugger, or when running it out of inittab on System V systems.

-eThe dhclient daemon creates its own environment when executing the dhclient-script to do the grunt work of interface configuration. To define extra environment variables and their values, use the -e flag, followed by the environment variable name and value assignment, just as one would assign a variable in a shell. Eg: -e IF_METRIC=1

-rThe client normally doesn't release the current lease as it is not required by the DHCP protocol. Some cable ISPs require their clients to notify the server if they wish to release an assigned IP address. The -r flag explicitly releases the current lease, and once the lease has been released, the client exits.

-1The -1 flag cause dhclient to try once to get a lease. If it fails, dhclient exits with exit code two.

-cf, -lf, -pf, and -sfThe DHCP client normally gets its configuration information from /etc/dhcp3/dhclient.conf, its lease database from /var/lib/dhcp3/dhclient.leases, stores its process ID in a file called /var/run/dhclient.pid, and configures the network interface using /sbin/dhclient-script To specify different names and/or locations for these files, use the -cf, -lf, -pf and -sf flags, respectively, followed by the name of the file. This can be particularly useful if, for example, /var/lib/dhcp3 or /var/run has not yet been mounted when the DHCP client is started.

-wThe DHCP client normally exits if it isn't able to identify any network interfaces to configure. On laptop computers and other computers with hot-swappable I/O buses, it is possible that a broadcast interface may be added after system startup. The -w flag can be used to cause the client not to exit when it doesn't find any such interfaces. The omshell (1) program can then be used to notify the client when a network interface has been added or removed, so that the client can attempt to configure an IP address on that interface.

-nThe DHCP client can be directed not to attempt to configure any interfaces using the -n flag. This is most likely to be useful in combination with the -w flag.

-nwThe client can also be instructed to become a daemon immediately, rather than waiting until it has acquired an IP address. This can be done by supplying the -nw flag.

-eThe client runs child processes (scripts) with a clean environment. Use the -e flag to specify additional environment variables to pass to child processes.

linux dhclient 的演示示例:

dhclient eth0

Renews the IP address.

Linux命令之dhclient,如何使用Linux命令dhclient相关推荐

  1. linux操作系统中查看网络信息的命令,Linux查看系统信息命令盘点

    Linux查看系统信息命令盘点 在Linux系统上有很多操作都是用命令完成的,下面跟yjbys小编一起来看看最新的系统命令吧,希望对大家有所帮助! 1.查看系统内核 uname -a uname -r ...

  2. 统信UOS命令大全 麒麟系统命令大全 Linux常用命令操作大全(非常全非常详细) ubuntu命令大全常用操作命令大全

    [腾讯云]云服务器2核4G74元/年,222元/3年 Linux常用命令大全(非常全!!!)适用于 统信UOS 麒麟kylin 系统信息  arch 显示机器的处理器架构 uname -m 显示机器的 ...

  3. linux命令ps -ef输出结果,Linux ps 命令

    Linux ps 命令 Linux ps (英文全拼:process status)命令用于显示当前进程的状态,类似于 windows 的任务管理器. 语法 ps [options] [--help] ...

  4. 一天一个 Linux 命令(43):netstat 命令

    本文为joshua317原创文章,转载请注明:转载自joshua317博客 一天一个 Linux 命令(43):netstat 命令 - joshua317的博客 一天一个 Linux 命令(43): ...

  5. 对linux中级用户有用的20个命令

    这篇文章则是为了Linux的中高级用户.在这里你将学会如何进行自定义搜索,知道正在进行的进程和停掉进程,如何使用Linux的强势功能和如何在系统内编译C.C++和JAVA程序. 21. 命令: Fin ...

  6. 命令行收集(DOS/Linux/nc/xscan/xsniffer)

    #1 一: net use \\ip\ipc$ " " /user:" " 建立IPC空链接 net use \\ip\ipc$ "密码" ...

  7. Tcpdump命令的使用与示例——linux下的网络分析

    顾名思义,TcpDump可以将网络中传送的数据包的"头"完全截获下来提供分析.它支持针对网络层.协议.主机.网络或端口的过滤,并提供and.or.not等逻辑语句来帮助你去掉无用的 ...

  8. Linux查看WAS的jvm信息,linux 下使用命令查看jvm信息

    java程序员除了编写业务代码之外,特别是项目上线之后,更需要关注的是系统的性能表现,这个时候就需要了解一下jvm的性能表现了,可以借助于java虚拟机自带的一些分析工具,主要有三个常用的命令. 1. ...

  9. linux mv 环境变量,linux环境变量,cp,mv命令,more,less,cat,tail,head,的使用...

    linux环境变量,cp,mv命令,more,less,cat,tail,head,的使用 [email protected] ~]# cp /usr/bin/ls   /tmp/ [[email p ...

最新文章

  1. 作业二:了解流行的软件
  2. SQL基础操作_8_基础概念
  3. 用Python实现希尔排序
  4. 【OpenCV 例程200篇】06. 像素的编辑(img.itemset)
  5. 这些是实际面试中遇到的面试题
  6. Java Timetask 无缘无故停止
  7. ios10 safari浏览器 在touchmove 里面写e.preventDefault(); 不起作用 的解决方法
  8. 链表插入排序和冒泡排序c语言
  9. 逻辑卷管理(LVM)
  10. HTTP文件下载原理
  11. 企业综合能效管理系统,工业能耗解决方案
  12. 基于opencv答题卡识别
  13. 摇一摇 周边 与 ibeacon
  14. 大数据培训课程内容介绍
  15. 用html css JavaScript写一个功能全面的王者荣耀轮播图 (仿淘宝京东轮播图)通俗易懂
  16. oracle索引介绍
  17. C语言数据类型转换(自动类型转换+强制类型转换)
  18. comsol动网格(als)帮助文档翻译
  19. 在线约会其实就是网络泡妞,Meexo 反其道而行为你隐姓埋名
  20. raid和NAS傻傻分不清楚

热门文章

  1. PopupMenu用法
  2. Intellij IDEA集成PHP
  3. mysql无法导入数据怎么办_Mysql 导入数据库方法 及失败解决
  4. 【ISO14229_UDS刷写】-1-$34诊断服务RequestDownload理论部分
  5. 【C++】基于Easyx的UI库(2022-8-14 V2)
  6. Linux系统安装环境桌面
  7. linux更换桌面系统,给Linux系统安装桌面环境
  8. C/C++语言100题练习计划 90——10 进制转 x 进制(进制转换实现)
  9. 【华为上机】天天爱消除
  10. 30个QGIS牛X插件