Mac OS X中的DHCP设置是否有任何命令行界面?我发现在System Profiler中,Network选项卡提供了很多有用的信息,但我没有找到任何有关任何命令行等效的文档.
你可以用
networksetup -listallnetworkservices networksetup -getinfonetworksetup -setdhcp [clientid]
networkservice就像以太网(第一个命令列出的所有可用)
您还可以使用:
ipconfig getpacket `interface`
接口将在哪里en0, en1
等
即:
ipconfig getpacket en1 op = BOOTREPLY htype = 1 flags = 0 hlen = 6 hops = 0 xid = 215448168 secs = 3 ciaddr = 0.0.0.0 yiaddr = 192.168.15.121 siaddr = 0.0.0.0 giaddr = 0.0.0.0 chaddr = 0:19:e3:6:70:95 sname = file = options: Options count is 8 dhcp_message_type (uint8): ACK 0x5 server_identifier (ip): 192.168.15.1 lease_time (uint32): 0xa8c0 subnet_mask (ip): 255.255.255.0 router (ip_mult): {192.168.15.1} domain_name_server (ip_mult): {192.168.15.249, 192.168.15.240} domain_name (string): domain.com end (none):
你也可以这样做:
ipconfig getoption en0 optionname
即: ipconfig getoption en1 router
192.168.15.1