Set and unset IP Address from Terminal

At work on my desk I have an iMac which I often use for configuring and shipping ADSL Routers, however once I am done it then goes back on the corporate network with a static address. Thus meaning I am often switching back and forth between DHCP and static on the network adapters config.

Which is where the next two terminal commands come in.

The following Terminal command set’s the IPv4 settings to manual then set’s the IP address of the adapter to, the subnet mask to and the router to

The following Terminal command set’s the IPv4 settings to DHCP and clears the manual settings from the ethernet adapter.

The code above changes the settings on the Ethernet adapter, you will need to change the string entry to the network adapter you want to update.

Mike Hudson

Mike Hudson is a Lead Cyber Security Analyst living and working in Kingston Upon Hull. With extensive experience in Microsoft and Apple technologies, ranging from desktop OS’s to Server OS’s and hardware. By day working as part of an infrastructure team, and by night ridding the world of IT issues through blog posts..

%d bloggers like this: