About networksetup

The command-line tool networksetup is used to configure a client’s network settings.

Any command that uses networksetup can be used in Remote Desktop using the Send UNIX Command task.

Find the command-line syntax, explanations, and example in the tool’s help prompt:

networksetup -help

A few of the capabilities of networksetupare listed below.

Flag

Description

-listallnetworkservices

Displays a list of all the network services on the computer’s hardware ports. An asterisk (*) denotes that a network service is disabled.

-setmanual networkservice ip subnet router

Set the TCP/IP configuration for network service to manual with IP address set to ip, Subnet Mask set to subnet, and Router address set to router. For example:

networksetup -setmanual "Ethernet" 192.168.100.100 255.255.255.0 192.168.100.1
-setdhcp networkservice [clientid]

Sets the TCP/IP configuration for the specified network service to use DHCP. The client ID is optional. Specify “Empty” for [clientid] to clear the DHCP client id. For example:

networksetup -setdhcp "Ethernet"
-setbootp networkservice

Sets the TCP/IP configuration for the specified network service to use BOOTP. For example:

networksetup -setbootp "Ethernet"
-setmanualwithdhcprouter networkservice ip

Specifies a manual IP address to use for DHCP for the specified network service. For example:

networksetup -setmanualwithdhcprouter "Ethernet" 192.168.100.120
-setdnsservers networkservice dns1 [dns2]

Specifies the IP addresses of servers you want the specified network service to use to resolve domain names. You can list any number of servers (replace dns1, dns2, and so on with the IP addresses of domain name servers). If you want to clear all DNS entries for the specified network service, type “empty” in place of the DNS server names. For example:

networksetup -setdnsservers "Ethernet" 192.168.100.100 192.168.100.12
-setsearchdomains networkservice domain1 [domain2]

Designates the search domain for the specified network service. You can list any number of search domains (replace domain1, domain2, and so on with the name of a local domain). If you want to clear all search domain entries for the specified network service, type “empty” in place of the domain name. For example:

networksetup -setsearchdomains "Ethernet" example.com foo.com
-setwebproxy networkservice domain portnumber (on | off) [username password]

Sets Web proxy for a network service with domain and port number. Turns proxy on. Optionally, specify on or off to enable and disable authenticated proxy support. Specify user name and password if you turn authenticated proxy support on. For example:

networksetup -setwebproxy "Ethernet" proxy.company.com 80 on steve mypassword
-help

Displays a list of all the commands available in the Network Setup Tool, with explanatory information.