On Tuesday 10 February 2004 12:51, Anders Johansson wrote:
On Tue, 2004-02-10 at 15:47 -0500, Jeff Bankston wrote:
Rookie question of the day......
What option on ifconfig permits me to drop and acquire an IP address without rebooting? I tried the down/up options, no joy. No "plumb" command that I can find.
If you're using dhcpcd (the default dhcp client), then "dhcpcd -k" will kill dhcp, bring down the network interface, and force it to request a new IP address the next time you bring it up.
But it will probably get the same IP anyway regardless of the request, because that is the way most dhcp servers work.
If trying to avoid a DOS attack, its often very desirable to get a different IP, and there is a utility called changemac which will temprarily change your mac address so that the dhcp server will give you a different IP.
http://galeb.etf.bg.ac.yu/~azdaja/changemac.html
--
THis question came up on the redhat list awhile ago. I read through the DHCP rfc (I think it's rfc 2131) and came up with this theory (untested .. i really should test it sometime). If you read the DHCP rfc, it seems that if you kick your machine so it requests a new address, the DHCP server sends the address, and it's up to your machine to accept or reject . If you can force it to not accept it, then it will make another request to the DHCP server and DHCP server will send a new address. That's the simplified version. One way for it to not accept is if the address is alreayd in use (the client checks this, not the server). My theory was that you bring down your interface on DHCP client(reboot shutdown or whatever), put another machine online with a static address same as the old IP on your DHCP client. When you bring the interface up on your DHCP client, it will make the request as normal . When the DHCP server sends the old IP, the clint SHOULD theroetically (and according to the RFC as I understand it) deny the old address when the DHCP server sends it, thereby forcing the DHCP server to send a different address for your machine to accept. If anyone actuallytries this, i'd be interested in hearing what happens. Ben Yau