August 21, 2015

Setting a static IP address in OS X recovery mode

References:
https://support.apple.com/en-us/HT200168
https://medium.com/@park9eon/맥-복구모드-고정아이피-설정-b62d4611e486

After High Sierra
1. Utilities -> Terminal

2. Check the interface name
ifconfig

3. Set the IP and subnet
ifconfig InterfaceName IP netmask subnet
ifconfig en0 192.168.0.100 netmask 255.255.255.0

4. Set the gateway
route -n delete default
route -n add default gateway -ifscope InterfaceName
route -n add default 192.168.0.1 -ifscope en0

5. Set the DNS
scutil
open
get State:/Network/Global/IPv4
d.show (check the PrimaryService key)
quit
scutil
open
d.init
d.add ServerAddresses * DNS
d.add ServerAddresses * 192.168.0.1
set State:/Network/Service/PrimaryService/DNS
set State:/Network/Service/AAAAAAA-AAAAAA-AAAAAA/DNS
quit

Before High Sierra
1. Utilities -> Terminal

2. Check the interface name
networksetup -listnetworkserviceorder

3. Set the IP, subnet, and gateway
networksetup -setmanual "Interface Name" IP subnet gateway
networksetup -setmanual "Ethernet 1" 192.168.0.100 255.255.255.0 192.168.0.1

4. Set the DNS
networksetup -setdnsservers "Interface Name" DNS
networksetup -setdnsservers "Ethernet 1" 192.168.0.1

5. Quit Terminal

2 comments: