Mac OSX server command equivalent for dhclient?

11,963

To renew the lease:

sudo ipconfig set <interface> DHCP

Usually interface is en0 or en1.

To see all the gory details, run sudo ipconfig setverbose 1 before you run the above, then tail /var/log/system.log. After you're done, remember to run sudo ipconfig setverbose 0 to turn it off again.

Share:
11,963
Pavan Kumar
Author by

Pavan Kumar

I'm a professional software developer and have been working with Rust and Python. I've worked before with Java, c , c++ , ms-basic,PHP, Perl hypertalk, true basic,Lotus Notes,,VB, PL/SQL, Pascal, COBOL, Scheme, Lisp, Logo, Rexx, and APL and read about or experimented with many others. I completed The O'Reilly School of Technology Python Certificate series of four courses.

Updated on September 18, 2022

Comments

  • Pavan Kumar
    Pavan Kumar over 1 year

    Is there an MacOS command that makes a dhcp request, and renews the old lease, drops it for a new one, or usefully reports errors or lack of response from a dhcp server?

    This would both help fix networking on the machine after problems on the network without rebooting and would also be useful to diagnose wider networking problems from a mac.

    I can not find any command equivalent of dhclient though obviously some component must be serving this purpose. The question is, is that component exposed to a command line interface?

    I am biased to the command line for these features and may have overlooked settings panels or tools that might solve it using a gui interface.

    I believe this question is at the heart of this other question: Is there an equivalent command for 'init.d/networking restart' in OS X

    • John Gardeniers
      John Gardeniers over 11 years
      Good question but is there any particular reason you're not doing this through the GUI?
    • Pavan Kumar
      Pavan Kumar over 11 years
      GUI's are subjected to more changes and the results are harder to capture where as the commands could even be an
  • mdiianni
    mdiianni over 9 years
    Usually happens to me when I lock my Mac and log in to my session back again I lost DNS config or resolv.conf doesn't work. So this command saved me the task of disconnecting and reconnecting back to the network to fix it. Thanks.
  • Timo
    Timo about 2 years
    I did sudo ipconfig setverbose 1and then sudo ipconfig set <my special lan interface> DHCP but no output on console nor new output in system.log.