Jul 15, 2010

Linux Equivalent of ipconfig renew and ipconfig release on Windows

I've looked this up 3 times so I finally decided to jot it down so I don't forget it.

Problem

Can't remember the Linux commands equivalent to:
ipconfig renew
ipconfig release

Symptoms

  • Your IP is assigned via DHCP on a Linux box
  • You've unplugged from one network and plugged into another and the old IP address hasn't cleared out
  • Don't want to shutdown/restart the interface you just want to refresh the DHCP settings

Solution

sudo /sbin/dhclient -r is equivalent to ipconfig release
sudo /sbin/dhclient is equivalent to ipconfig renew
sudo /sbin/ifconfig is equivalent to ipconfig
The dhclient command broadcasts a DHCP message to your DHCP server, resulting in a new lease. A slower way to achieve the same result is to shutdown the interface and bring it back up via (assuming your target interface is eth0):
sudo /sbin/ifdown eth0
sudo /sbin/ifup eth0
This same, slower approach can also be done graphically on RedHat by clicking System > Administration > Network, choosing your interface (eth0) and clicking deactivate followed by activate.

No comments:

Post a Comment