跳至正文
  • 65 views
  • 1 min read

macos一键修改 IP 地址脚本

新浪微博 豆瓣 QQ 百度贴吧 QQ空间

自用脚本,记录一下。

#!/bin/sh

if [[ $1 == 'c' ]];then
  networksetup -setmanual "Wi-Fi" 192.168.10.133 255.255.255.0 192.168.10.254
  networksetup -setdnsservers Wi-Fi 192.168.10.254 8.8.4.4
elif [[ $1 == 's' ]];then
  networksetup -setmanual "Wi-Fi" 192.168.0.184 255.255.255.0 192.168.0.254
  networksetup -setdnsservers Wi-Fi 192.168.0.254 8.8.4.4
elif [[ $1 == 't' ]];then
  networksetup -setmanual "Wi-Fi" 192.168.0.184 255.255.255.0 192.168.0.250
  networksetup -setdnsservers Wi-Fi 198.18.0.2 8.8.4.4
elif [[ $1 == 'd' ]];then
  networksetup -setdhcp "Wi-Fi"
  networksetup -setdnsservers Wi-Fi empty
else
  echo "[INFO]:please input d|s|t|c to choice dhcp or static."
fi

发表回复

联系站长