networksetup(8) BSD System Manager's Manual networksetup(8)
NAME
networksetup -- configuration tool for network settings in System Prefer- ences.
SYNOPSIS
networksetup [-listnetworkserviceorder] [-listallnetworkservices] [-listallhardwareports] [-detectnewhardware] [-getmacaddress hardwareport] [-getcomputername] [-setcomputername computername] [-getinfo networkservice] [-setmanual networkservice ip subnet router] [-setdhcp networkservice [clientid]] [-setbootp networkservice] [-setmanualwithdhcprouter networkservice ip] [-setv4off networkservice] [-setv6off networkservice] [-setv6automatic networkservice] [-setv6manual networkservice address prefixLength router] [-getdnsservers networkservice] [-setdnsservers networkservice dns1 [dns2] [...]] [-getsearchdomains networkservice] [-setsearchdomains networkservice domain1 [domain2] [...]] [-create6to4service networkservicename] [-set6to4automatic networkservice] [-set6to4manual networkservice relayAddress] [-getftpproxy networkservice] [-setftpproxy networkservice domain portnumber authenticated username password] [-setftpproxystate networkservice on | off] [-getwebproxy networkservice] [-setwebproxy networkservice domain portnumber authenticated username password] [-setwebproxystate networkservice on | off] [-getsecurewebproxy networkservice] [-setsecurewebproxy networkservice domain portnumber authenticated username password] [-setsecurewebproxystate networkservice on | off] [-getstreamingproxy networkservice] [-setstreamingproxy networkservice domain portnumber authenticated username password] [-setstreamingproxystate networkservice on | off] [-getgopherproxy networkservice] [-setgopherproxy networkservice domain portnumber authenticated username password] [-setgopherproxystate networkservice on | off] [-getsocksfirewallproxy networkservice] [-setsocksfirewallproxy networkservice domain portnumber authenticated username password] [-setsocksfirewallproxystate networkservice on | off] [-getproxybypassdomains networkservice] [-setproxybypassdomains networkservice domain1 [domain2] [...]] [-getpassiveftp networkservice] [-setpassiveftp networkservice on | off] [-getairportnetwork] [-setairportnetwork network [password]] [-getairportpower] [-setairportpower on | off] [-getnetworkserviceenabled networkservice] [-setnetworkserviceenabled networkservice on | off] [-createnetworkservice networkservicename hardwareport] [-renamenetworkservice networkservice newnetworkservicename] [-duplicatenetworkservice networkservice newnetworkservicename] [-removenetworkservice networkservice] [-ordernetworkservices service1 [service2] [service3] [...]] [-getappletalk networkservice] [-setappletalk networkservice on | off] [-getMTU hardwareport] [-setMTU hardwarePort value] [-listvalidMTUrange hardwareport] [-getmedia hardwareport] [-setmedia hardwareport subtype [option1] [option2] [...]] [-listvalidmedia hardwareport] [-createVLAN name parentdevice tag] [-deleteVLAN name parentdevice tag] [-listVLANs] [-listdevicesthatsupportVLAN] [-isBondSupported device] [-createBond name [device1] [device2] [...]] [-deleteBond bond] [-addDeviceToBond device bond] [-removeDeviceFromBond device bond] [-listBonds] [-showBondStatus bond] [-version] [-help] [-printcommands]
DESCRIPTION
The networksetup command is used to configure network settings typically configured in the System Preferences application. The networksetup com- mand requires at least "admin" privileges to run. A list of flags and their descriptions: -listnetworkserviceorder Displays a list of network services in the order they are con- tacted for a connection, along with the corresponding port and device for each. An asterisk (*) next to a service means the ser- vice is inactive. -listallnetworkservices Displays a list of all the network services on the server's hard- ware ports. An asterisk (*) denotes that a network service is disabled. -listallhardwareports Displays list of hardware ports with corresponding device name and ethernet address. -detectnewhardware Detects new network hardware and creates a default network ser- vice on the hardware. -getmacaddress hardwareport Displays ethernet (or AirPort) address for hardwareport or device specified. -getcomputername Displays the computer name. -setcomputername computername Sets computer name to <computername>. This name is used by AFP and AppleTalk. -getinfo networkservice Displays the IP address, subnet mask, router, and hardware address for the <networkservice> that you specify. -setmanual networkservice ip subnet router Set the TCP/IP configuration for <networkservice> to manual with IP address set to <ip>, Subnet Mask set to <subnet>, and Router address set to <router>. -setdhcp networkservice [clientid] Use this command to set the TCP/IP configuration for the speci- fied <networkservice> to use DHCP. The client ID is optional. Specify "Empty" for [clientid] to clear the DHCP client id. -setbootp networkservice Use this command to set the TCP/IP configuration for the speci- fied <networkservice> to use BOOTP. -setmanualwithdhcprouter networkservice ip Use this command to specify a manual IP address to use for DHCP for the specified <networkservice>. -setv4off networkservice Use this command to turn IPv4 off on the specified <networkser- vice>. -setv6off networkservice Use this command to turn IPv6 off on the specified <networkser- vice>. -setv6automatic networkservice Use this command to set IPv6 to get its addresses automatically for <networkservice>. -setv6manual ip prefixlength router Use this command to set IPv6 to get its addresses manually for <networkservice>. Specify the ip address, the prefix length and the router. -getdnsservers networkservice Displays DNS info for <networkservice>. -setdnsservers networkservice dns1 [dns2] [...] Use this command to specify the IP addresses of servers you want the specified <networkservice> 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. -getsearchdomains networkservice Displays Domain Name info for <networkservice>. -setsearchdomains networkservice domain1 [domain2] [...] Use this command to designate the search domain for the specified <networkservice>. 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 OemptyO in place of the domain name. -create6to4service -<newnetworkservicename> Use this command to create a new 6 to 4 service with name <newnetworkservicename>. -set6to4automatic -<newnetworkservicename> Use this command to set the 6 to 4 service such that it will get the relay address automatically. -set6to4manual -<newnetworkservicename> -<relayaddress> Use this command to set the 6 to 4 service such that it will get the relay address manually. Specify the <relayaddress> that you would like to set. -getftpproxy networkservice Displays FTP proxy (server, port, enabled value) info for <net- workservice>. -setftpproxy networkservice domain portnumber authenticated username password Set FTP proxy for <networkservice> with <domain> and <port num- ber>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy sup- port. Specify <username> and <password> if you turn authenticated proxy support on. -setftpproxystate networkservice on | off Set FTP proxy on <networkservice> to either <on> or <off>. -getwebproxy networkservice Displays Web proxy (server, port, enabled value) info for <net- workservice>. -setwebproxy networkservice domain portnumber authenticated username password Set Web proxy for <networkservice> with <domain> and <port num- ber>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy sup- port. Specify <username> and <password> if you turn authenticated proxy support on. -setwebproxystate networkservice on | off Set Web proxy on <networkservice> to either <on> or <off>. -getsecurewebproxy networkservice Displays Secure Web proxy (server, port, enabled value) info for <networkservice>. -setsecurewebproxy networkservice domain portnumber authenticated username password Set Secure Web proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy sup- port. Specify <username> and <password> if you turn authenticated proxy support on. -setsecurewebproxystate networkservice on | off Set SecureWeb proxy on <networkservice> to either <on> or <off>. -getstreamingproxy networkservice Displays Streaming proxy (server, port, enabled value) info for <networkservice>. -setstreamingproxy networkservice domain portnumber authenticated username password Set Streaming proxy for <networkservice> with <networkservice>. Turns proxy on. Optionally, specify <on> or <off> for <authenti- cated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on. -setstreamingproxystate networkservice on | off Set Streamingproxy on <networkservice> to either <on> or <off>. -getgopherproxy networkservice Displays Gopher proxy (server, port, enabled value) info for <networkservice>. -setgopherproxy networkservice domain portnumber authenticated username password Set Gopher proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy sup- port. Specify <username> and <password> if you turn authenticated proxy support on. -setgopherproxystate networkservice on | off Set Gopher proxy on <networkservice> to either <on> or <off>. -getsocksfirewallproxy networkservice Displays SOCKS Firewall proxy (server, port, enabled value) info for <networkservice>. -setsocksfirewallproxy networkservice domain portnumber authenticated username password Set SOCKS Firewall proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenti- cated proxy support on. -setsocksfirewallproxystate networkservice on | off Set SOCKS Firewall proxy to either <on> or <off>. -getproxybypassdomains networkservice Displays Bypass Domain Names for <networkservice>. -setproxybypassdomains networkservice domain1 [domain2] [...] Set the Bypass Domain Name Servers for <networkservice> to <domain1> [domain2] [...]. Any number of Domain Name servers can be specified. Specify "Empty" for <domain1> to clear all Domain Name entries. -getpassiveftp networkservice Displays whether Passive FTP is on or off for <networkservice>. -setpassiveftp networkservice on | off Set Passive FTP to either <on> or <off>. -setautoproxyurl networkservice url Set proxy auto-config to url for <networkservice> and enable it. -getautoproxyurl networkservice Displays proxy auto-config (url, enabled) info for <networkser- vice>. -setsocksfirewallproxystate networkservice on | off Set SOCKS Firewall proxy to either <on> or <off>. -getairportnetwork Displays current AirPort Network. -setairportnetwork network [password] Set AirPort Network to <network> using optional [password] if specified. -getairportpower Displays whether AirPort power is on or off. -setairportpower on | off Set AirPort power to either <on> or <off>. -getnetworkserviceenabled networkservice Displays whether a service is on or off (enabled or disabled). -setnetworkserviceenabled networkservice on | off Use this command to turn the specified network service on or off (enable or disable). -createnetworkservice networkservicename hardwareport Create a service named <networkservice> on port <hardwareport>. The new service will be enabled by default. -renamenetworkservice networkservice newnetworkservicename Use this command to rename the specified network service <net- workservice> to <newnetworkservicename>. -duplicatenetworkservice networkservice newnetworkservicename Use this command to duplicate an existing network service <net- workservice> and rename it to the specified name <newnetworkser- vicename>. -removenetworkservice networkservice Use this command to delete a network service <networkservice>. You cannot use this command to delete the last remaining service for a hardware port. To do so, you use the -setnetworkserviceen- abled command. -ordernetworkservices service1 [service2] [service3] [...] Use this command to designate the order network services are con- tacted on the specified hardware port. Name the network you want contacted first, then the second, and so on. Use "listnetworkser- viceorder" to view current service order. Note: use quotes around service names which contain spaces (ie. "Built-in Ethernet"). -getappletalk networkservice Displays whether AppleTalk is on or off (enabled or disabled) on <networkservice>. -setappletalk networkservice on | off Set AppleTalk to either <on> or <off> (enabled or disabled) on <networkservice>. -setMTUAndMediaAutomatically hardwarePort Set hardwareport or device specified back to automatically set- ting the MTU and Media. -getMTU hardwareport Get the MTU value for hardwareport or device specified. -setMTU hardwarePort value Set MTU for hardwareport or device specified. -listValidMTURange hardwareport List the valid MTU range for hardwareport or device specified. -getMedia hardwareport Show both the current setting for media and the active media on hardwareport or device specified. -setMedia hardwareport subtype [option1] [option2] [...] Set media for hardwareport or device specified to subtype. Spec- ify optional [option1] and additional options depending on sub- type. Any number of valid options can be specified. -listValidMedia hardwareport List valid media options for hardwareport or device name. Enumer- ates available subtypes and options per subtype. -createVLAN name parentdevice tag Create a VLAN with the name <name> over the parent device <par- entdevice> and with the tag <tag>. -deleteVLAN name parentdevice tag Delete the VLAN with the name <name> over the parent device <par- entdevice> and with the tag <tag>. -listVLANs List the VLANs that have been created. -listdevicesthatsupportVLAN List the devices that support VLANs. -isBondSupported device Displays YES if the device can be added to a bond. NO if it can- not. -createBond name [device1] [device2] [...] Create a bond with the user-defined-name name and optionally add any listed devices if they support bonding. -deleteBond bond Delete the bond with the specified device-name. -addDeviceToBond device bond Add device to bond. -removeDeviceFromBond device bond Remove device from bond. -listBonds List of all bonds. -showBondStatus bond Display the status of the specified bond. -version Displays version of networksetup tool. -help Displays a list of all the commands available in the Network Set- up Tool, with explanatory information. -printcommands Displays a list of commands with no detail.
EXAMPLES
networksetup -listallnetworkservices networksetup -setmanual "Built-in Ethernet" 192.168.100.100 255.255.255.0 192.168.100.1 networksetup -setdnsservers "Built-in Ethernet" 192.168.100.100 192.168.100.12 networksetup -setsearchdomains "Built-in Ethernet" company.com corp.com networksetup -setwebproxy "Built-in Ethernet" proxy.company.com 80 networksetup -setwebproxy "Built-In Ethernet" proxy.company.com 80 On authusername authpassword networksetup -duplicatenetworkservice "Built-In Ethernet" "Local LAN" networksetup -getdnsservers "Built-In Ethernet" networksetup -setMTU en0 1500 networksetup -setMedia en0 autoselect networksetup -setMedia en0 100baseTX half-duplex networksetup -createBond MyBond en0 en1 networksetup -addDeviceToBond en0 bond0
FILES
/usr/sbin/networksetup
SEE ALSO
systemsetup(8) Mac OS April 16, 2002 Mac OS
Mac OS X 10.4 Server - Generated Thu Jun 12 20:00:29 CDT 2008