Jump to content

How can I set static IP address via a workflow?

Recommended Posts

I was wondering if someone was able to help me in developing a workflow that will set the static IP address of my ethernet port (en0) via a workflow?  Ideally, I'd like to be able to set the IP address, subnet mask and default gateway variables for this interface via a workflow.  Although it doesn't sound that hard / complex, I don't even know where to start as I have no idea on scripting.   :)


Any help would be much appreciated.  




Link to comment

Thanks for the offer David!  I admit, it sounds like a pretty infrequent requirement but in my role as a network engineer, I move from network to network frequently.  Particularly if I'm staging a new network (which predates having DHCP address infrastructure), I can swap subnets 8-10 times a testing session and having a way to do this via an Alfred workflow would be much more efficient than doing this through the traditional system preferences / network settings.


Cheers (and thanks again)

Link to comment

Ok, so, I was being lazy and didn't really try this. According to the command documentation it SHOULD work, but try this out and let me know if it works for you.





It will give you options of which interface to set it on. The list of interfaces aren't actionable until all 3 ips are entered and valid.



Link to comment

That's brilliant thanks David.  Works perfectly thanks.  It does actually require you to authenticate to apply the changes as part of the networksetup (ie. networksetup is trying to modify the system network configuration.  Type your password ....).  Not a big deal to overcome this though and presumably, there wouldn't be a way around that anyway from the script perspective, so I'm more than happy this workflow is as optimal as it can be and will help me out heaps.


Once again, I really appreciate your effort David.  I tip my hat to you sir.



Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...