Tuesday, August 07, 2007

ipconfig /renew linux'ā

Izskatās ka tas varētu izskatīties šādi:
While Linux's ifconfig will show information about the interface it doesn't provide as much control of the IP interface as ipconfig does on Windows. I'll explain something that I use often (I have a crappy DHCP server at the moment) and is a bit elusive in Linux (at least for me it was).

To release a DHCP assigned IP address on Linux (the equivalent of windows' ipconfig /release) enter the following at a terminal. You must be running as root to execute these commands (see su):

dhcpcd -k
dhcpcd is a DHCP client implementation on Linux that runs as a daemon, that accepts the -k option. Often the dhcpcd daemon won't be running on my system if the DHCP server never responded and I get a message that reads "**** dhcpcd: not running". If you receive this message, your an probably safely ignore it, you don't need to release your IP in this case.

To retrieve or "renew" your IP address from the server (the equivalent of windows' ipconfig /renew), enter the following at a terminal (as root):

ifup eth0
ifup is a standard script that uses usernetctl to bring the interface up. eth0 is the name of your ethernet interface (usually eth0) ifdown, as you might expect carries out the the opposite action of bringing the interface down.

No comments: