Is there a command in Jag to release and renew a DHCP IP?

Posted:
in macOS edited January 2014
I would love to know if there is a Terminal command (or an app for that matter) that will let me both release and renew a DHCP address if needed. Windows has used this feature in the wincfg application for a long time. Does BSD/Darwin (or UNIX in gerneral) have a similar feature? I wish it was in the Network System Preference panel...



[ 09-26-2002: Message edited by: dstranathan ]</p>

Comments

  • Reply 1 of 7
    screedscreed Posts: 1,077member
    Just ran into this problem. Haven't found a command line method, but the following should work:

    System Preferences &gt; Network

    From Show, choose Network Port Configurations and uncheck your ethernet card/port ('Built-in Ethernet' or what-have-you).

    Click Apply Now.

    Re-check your ethernet card/port and again click Apply Now.



    What this should do is force a DHCP renewal.



    Hope this helps (works).



    Screed



    [ 09-26-2002: Message edited by: sCreeD ]</p>
  • Reply 2 of 7
    stoostoo Posts: 1,490member
    Wouldn't surprise me if this was cron/Applescriptable. However I have no idea how cron or Mac OS X Applescript work .



    (man cron gives:

    "cron: a daemon to execute scheduled commands")
  • Reply 3 of 7
    nijiniji Posts: 288member
    i too want to know this.

    currently i always need to toggle two settings, such as manual/apply, then, immediately dhcp/apply. this usually does it.

    i am not sure why this actually works however, since the so called lease is for 10 minutes, and i thought that 10 minutes would refer to a period of 10 minutes needed between an expired lease and the ability to get a new one.

    anyway, it does work if you toggle it in the way I have advised.
  • Reply 4 of 7
    That works because it gets you a new lease. Your old lease will automatically expire when the DHCP server realizes it is no longer being used. (It checks leases every so often to see if they are being used)
  • Reply 5 of 7
    escherescher Posts: 1,811member
    Very intersting topic. The idiot IT staff at my university has been saying that they will no longer support the lonely five iMacs in our lab, nor any Mac paptops connecting to network in the library, because Macs grab a DHCP address and then never release it.



    In the lab setting, in OS 9, I've set/scheduled some of the iMacs to shut down after the lab closes at night and restart in the morning before the lab opens, in the process grabbing a new DHCP/IP address.



    Changing IP settings (e.g. between manual and DHCP) has worked well for me. But it is admittedly not an elegant solution. It's really a shame that integration with Windows NT networks in Jaguar is still not perfect.



    Escher
  • Reply 6 of 7
    This should do it in Terminal, "down" de-activates and "up" activates the interface (en0 is Ethernet, en1 is Airport)



    [code] sudo ifconfig en0 down </pre><hr></blockquote>

    then

    [code] sudo ifconfig en0 up </pre><hr></blockquote>
  • Reply 7 of 7
    serranoserrano Posts: 1,806member
    [quote]Originally posted by Stoo:

    <strong>Wouldn't surprise me if this was cron/Applescriptable. However I have no idea how cron or Mac OS X Applescript work .



    (man cron gives:

    "cron: a daemon to execute scheduled commands")</strong><hr></blockquote>



    wtf? cron executes scripts at a given time... dstranthan doesn't even mention wanting to do this on a scheduled basis...
Sign In or Register to comment.