DHCP is widely used to assign IP addresses to computers on a network. Most home Internet connections are assigned IPs via DHCP by the Internet Service Provider (ISP). If you are using Linux as your Operating System and want to force a renew of your DHCP lease/DHCP assigned IP address you can do so via the Linux command line.
The first step is to determine the name of interface connected to the Internet. Type the following command to do that:
It will display something like the following:
eth0 Link encap:Ethernet HWaddr 00:89:0A:21:A8:D9
inet addr:220.127.116.11 Bcast:18.104.22.168 Mask:255.255.255.0
inet6 addr: fe80::227:eff:fe24:a8d9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4168474 errors:0 dropped:0 overruns:0 frame:0
TX packets:494277 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:701478509 (668.9 Mb) TX bytes:167156459 (159.4 Mb)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2848 errors:0 dropped:0 overruns:0 frame:0
TX packets:2848 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:176356 (172.2 Kb) TX bytes:176356 (172.2 Kb)
lo is the loopback adapter so that is definitely not the Internet interface. eth0 is the network interface card connected to the Internet.
To renew the DHCP lease type:
sudo /sbin/ifrenew eth0
The command and its output:
abdussamad@homebase:~> sudo /sbin/ifrenew eth0
eth0 device: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03)
Starting DHCP4 client on eth0.
eth0 IP address: 22.214.171.124/24
Alternatively you can also try:
sudo /sbin/ifdown eth0
sudo /sbin/ifup eth0
The above commands will force a renew of the DHCP lease and IP address assigned to your computer by your ISP.