ZZ: http://blog.csdn.net/ilittlesheep/article/details/7539192
Common scutil -- set (SUDO), networksetup (SUDO), NSLookup
1. List all Network Services
$ Sudo networksetup-listallnetworkservices
An asterisk (*) denotes that a network services is disabled
Bluetooth dun
Ethernet
Firewire
Wi-Fi
Bluetooth pan
2. Get Ethernet info
$ Sudo networksetup-getinfo Ethernet
3. Find machine DNS name
$ NSLookup 172.1610.30
4. Set machine Host Name
$ Scutil-set hostname "Your host name"
Set machine local host name
$ Scutil-set localhostname "your local host name"
Set machine computer name
$ Scutil-set computername "your computer name"
Differences between the three names:
A computer name is equivalent to an alias instance. You can enter special characters to ignore its existence.
Host name used in the network. If a conflict occurs in the network, it may be automatically modified by DNS (to be confirmed)
The local host name is similar to the host name. Generally, it is okay to keep the two files in a uniform state. No more experiments are performed and will be updated.
Example:
The company's development environment depends on hostname. Otherwise, an error is returned because the hostname cannot be read and the local configuration cannot be read during. Configure.
Solution:
1. Reset the hostname:
Scutil -- set hostname ygao. *****. com
2. Set the hostname and the local Ping fails. You need to add
127.0.0.1 localhost ygao. *****. com