How to force a new DHCP discover
You might be able to do it by toggling DHCP on/off with sudo ipconfig set en0 none; sudo ipconfig set en0 dhcp
, or with doing something similar via the GUI.
Or try downing/upping the interface with ifconfig en0 down; ifconfig en0 up
I believe configd is the process where the DHCP client code lives. You could try sending a SIGHUP to configd with sudo killall -HUP configd
, or just kill configd outright and let launchd auto-relaunch it: sudo killall configd
. This suggestion is a bit extreme. Don't be surprised if you end up with networking in a weird state after this. If that happens, rebooting might be the easiest way to get it back in order.
Check out the man pages for ipconfig
, ifconfig
and networksetup
for other ideas of how to perturb the interfaces from the command line.
Note: Check what the correct BSD unix-level interface identifier is for your interface, and replace en0
in the examples above with the correct identifier for your situation.
Related videos on Youtube
soupdiver
Updated on September 18, 2022Comments
-
soupdiver over 1 year
I'm analysing my network traffic at home, and I want to force my Mac to completely renew its DHCP stuff. Renewing my DHCP lease only reveals two DHCP packets sent over my interface, but I want to see the whole process in Wireshark. Is there a command-line way to do this?
-
Bill Nace over 10 yearsDHCP discovery can be accomplished with only 2 packets sent. What makes you think there are more?
-
soupdiver over 10 yearsthe complete handshake should have more that 2 packets involved or? discover, offer, request, ack at least I think
-
Bill Nace over 10 yearsAh. I misunderstood your use of "sent over my interface." Your Mac sends the discover and request packets. It receives the offer and ack packets. Which two are you seeing?
-
soupdiver about 10 yearsAlready solved. Now I can see all 4 packets in wireshark
-
-
soupdiver over 10 yearsthanks
sudo ipconfig set en0 none; sudo ipconfig set en0 dhcp
did the trick