I do this all the time with the GUI and it does what I am looking for. No Problem.
System Preferences > Network > Select the LAN or Wi-Fi > Advanced > DNS > Search Domains and in that particular box field, I add all the search domains that I want. e.g. office, hq, ad.gwn, etc.
Question, how can I achieve the same process via command line with Terminal?
So far this is what I did:
Step #1 I run both these command line to get an overview of what I have:
- networksetup -listallnetworkservices
- networksetup -listnetworkserviceorder
and this is what I got:
- List item
- Apple USB Ethernet Adapter
- Thinkpad USB LAN
- Bluetooth PAN
- Thunderbolt Bridge
- (1) Apple USB Ethernet Adapter (Hardware Port: Apple USB Ethernet Adapter, Device: en4)
- (2) Thinkpad USB LAN (Hardware Port: Thinkpad USB LAN, Device: en5)
- (3) Wi-Fi (Hardware Port: Wi-Fi, Device: en0)
- (4) Bluetooth PAN (Hardware Port: Bluetooth PAN, Device: en3)
- (5) Thunderbolt Bridge (Hardware Port: Thunderbolt Bridge, Device: bridge0)
Step #2 I tried to add my search domains (hq, office, ad.gwn) but I received the following error message: - sudo networksetup -setsearchdomains en4 hq office ad.gwn - en4 is not a recognized network service - Error: The parameters were not valid
I am connected only with Ethernet cable. No WiFi. I tried en4 and en5 same issue.