Linux Force DHCP Client (dhclient) to Renew IP Address
http://www.cyberciti.biz/faq/howto-linux-renew-dhcp-client-ip-address/‘m using Ubuntu Linux. How to force Linux to reacquire a new IP address from the DHCP server? What is the command in Linux equivalent to Windows’ “ipconfig /renew” command?
You need to use Dynamic Host Configuration Protocol Client i.e. dhclient command. The 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 dhclient command, 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 renew ip command
The -r flag explicitly releases the current lease, and once the lease has been released, the client exits. For example, open terminal and type the command:$ sudo dhclient -r
Now obtain fresh IP:$ sudo dhclient
How can I renew or release an IP in Linux for eth0?
To renew or release an IP address for the eth0 interface, enter:$ sudo dhclient -r eth0
$ sudo dhclient eth0
In this example, I am renewing an IP address for my wireless interface:
sudo dhclient -v -r eth0 |
Sample outputs:
Fig.01: Renew DHCP address example
The -v option shows information on screen about dhcp server and obtained lease.
Other options in Linux to renew dhcp
There is no need to restart network service. Above command should work with any Linux distro such as RHEL, Fedora, CentOS, Ubuntu and others. On a related note you can also try out the following commands:# ifdown eth0
# ifup eth0
### RHEL/CentOS/Fedora specific command ###
# /etc/init.d/network restart
OR### Debian / Ubuntu Linux specific command ###
# /etc/init.d/networking restart
nmcli command (NetworkManager) to renew IP address in Linux
The NetworkManager daemon attempts to make networking configuration and operation as painless and automatic as possible by managing the primary network connection and other network interfaces, like Ethernet, WiFi, and Mobile Broadband devices command-line tool for controlling NetworkManager. The nmcli is a command-line tool for controlling NetworkManager and getting its status. To renew IP address using nmcli for connection named ‘nixcraft_5G’ (use ‘nmcli con‘ command to get list of all connections):
nmcli con |
Sample outputs:
Fig.02: nmcli command in action
See also
- Man pages: nmcli(1), dhclient(8)
Linux Force DHCP Client (dhclient) to Renew IP Address的更多相关文章
- 15.Linux安装DHCP服务为虚拟机分配IP
参考博客:http://www.jb51.net/article/31607.htm $ rpm -ql dhcp #检查是否安装dhcp $ yum -y install dhcp* ...
- 第一次使用Genymotion遇到的问题:for an unknown reson,VirtualBox DHCP has not assigned an IP address to virtual
解决方案:http://www.aiuxian.com/article/p-554135.html
- Linux下DHCP服务安装配置
简介 安装配置 一.简介 DHCP (Dynamic Host Configuration Protocol,动态主机管理协议)是一种基于UDP协议且仅限用于局域网的网络协议,主要用途是为局域网内部设 ...
- The Genymotion Virtual device could not obtain an IP address解决办法
打开Genymotion运行虚拟机提示如下错误: The Genymotion Virtual device could not obtain an IP address.For an unknown ...
- Linux renew ip command
$ sudo dhclient -r //release ip 释放IP$ sudo dhclient //获取IP Now obtain fresh IP:$ sudo dhcli ...
- linux之DHCP服务端搭建 ( ip分配 四个阶段原理)
DHCP服务 ip分配 四个阶段原理 1.DHCP服务目的 协议 作用 租约 原理四个阶段 动态主机配置协议(Dynamic Host Configuration Protocol,动态主机配置协议) ...
- linux下DHCP服务原理总结
DHCP(全称Dynamic host configuration protocol):动态主机配置协议DHCP工作在OSI的应用层,可以帮助计算机从指定的DHCP服务器获取配置信息的协议.(主要包括 ...
- Linux中DHCP服务器的简单配置
我安装了两台linux系统,一个作为服务器,一个客户端 两个都有3个网卡, 后两个网卡聚合为zhi一个网卡:Linux 网卡聚合 两台电脑都一样. 那么如何为这个聚合网卡进行DHCP的分配呢? 1.由 ...
- 电脑无法上网,DHCP客户端不能正确获取IP地址
问题特征:DHCP服务器更新[保留]配置信息后,给一客户端绑定了新的IP地址;但客户端IP地址并未正确更新; 处理: 一.检查DHCP服务器配置; 1.MAC地址.IP地址均正确;并已“添加到筛选器” ...
随机推荐
- 安卓开发06:布局-线性布局 LinearLayout
LinearLayout把视图组织成一行或一列.子视图能被安排成垂直的或水平的.线性布局是非常常用的一种布局方式. 请看一个布局例子: <LinearLayout xmlns:android=& ...
- HDOJ 5071 Chat 模拟
大模拟: 1>saygoodbye要先对 always on top 的人说 2>对没有说过话的不要说good bye 3>用long long Chat Time Limit: 2 ...
- 使用ItextSharp产PDF完整操作
原文 使用ItextSharp产PDF完整操作 记得上回有写到用C#操作Excel(.net 4.0) 很多朋友说推荐用NPOI,的确,用微软自带的操作execl会有很大的问题.客户的主机不愿意安装e ...
- 有N个正实数(注意是实数,大小升序排列) x1 , x2 ... xN,另有一个实数M。 需要选出若干个x,使这几个x的和与 M 最接近。 请描述实现算法,并指出算法复杂度
题目:有N个正实数(注意是实数,大小升序排列) x1 , x2 ... xN,另有一个实数M. 需要选出若干个x,使这几个x的和与 M 最接近. 请描述实现算法,并指出算法复杂度. 代码如下: #in ...
- Mac 下安装配置Mysql
在Mac 下载 Mysql Server : 参考:http://www.mysql.com/downloads/ 下载Mysql 安装程序 打开下载地址: http://www.mysql.com/ ...
- 重操JS旧业第六弹:基本类型包装
在前面已经知道js中的类型有boolean,string,number,undefined,function,object,其中boolean,number,string为值类型.所谓的基本类型包装, ...
- 将网站部署到服务器上出现_STORAGE_WRITE_ERROR_问题
用的thinkphp3.2的框架,在本地运行没有问题,部署到服务器上(基于centos的LAMP环境)即报错,报错信息如下(完全看不懂...):求大神帮帮忙~~~~(>_<)~~~~ :( ...
- Effective C++_笔记_条款04_确定对象被使用之前已先被初始化
(整理自Effctive C++,转载请注明.整理者:华科小涛@http://www.cnblogs.com/hust-ghtao/) 读取未初始化的值会导致不确定的行为.在某些平台上,仅仅只是读取为 ...
- 好多NFS的文章
http://www.cnblogs.com/lidabo/category/587288.html http://www.cnblogs.com/lidabo/p/4380555.html
- 一次完整的HTTP请求所经历的7个步骤(前三步是浏览器工作,后四步是服务器工作)
HTTP通信机制是在一次完整的HTTP通信过程中,Web浏览器与Web服务器之间将完成下列7个步骤: 1. 建立TCP连接在HTTP工作开始之前,Web浏览器首先要通过网络与Web服务器建立连接,该连 ...