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 10.0.1.2, the subnet mask to 255.255.255.0 and the router to 10.0.1.1
1 |
networksetup -setmanual "Ethernet" 10.0.1.3 255.255.255.0 10.0.1.1 |
The following Terminal command set’s the IPv4 settings to DHCP and clears the manual settings from the ethernet adapter.
1 |
networksetup -setdhcp "Ethernet" |
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.