0

My computer routinely receives connection from another host in the local network. However, the router changes its ip address quite frequently, and maybe netsh's equivalent, networksetup, can help?

  • This is not clear as to what you're doing nor what you want to accomplish. Please add details as to what you're looking to accomplish, what you have tried and how things are configured. – Allan Aug 13 '18 at 12:14
  • I want to set my osx host's ip address to 192.168.0.6 locally, as simple as this. What don't you understand? Also, I have no other configuration details to offer, because the mechanism is not clear yet. – David Programmer Aug 13 '18 at 15:45
  • Just out of curiosity...why aren't you doing this in the GUI via System Preferences -> Network? – Allan Aug 13 '18 at 15:57
  • I only switched to osx recently and am unfamiliar with its configuration. – David Programmer Aug 13 '18 at 16:08
2

The command to manually set an IP address is:

networksetup -setmanual Ethernet 192.168.0.6 255.255.255.0 192.168.0.1

This assumes the following:

  • netmask is a /24 (254 hosts)
  • the router/gateway is the "common" 192.168.0.1
  • Your interface is Ethernet

You will need to adjust your settings accordingly. To get a list of network services (interfaces), you can issue the command:

networksetup -listallnetworkservices

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .