macOS는 시스템 환경설정(System Preferences) 메뉴 에서 네트워크 설정을 위한 사용하기 쉬운 메뉴를 제공하지만 , 네트워크 구성에 대한 정보를 빠르게 조회하거나 테스트하려면 터미널(Terminal) 앱이 있어야 합니다. 이를 사용하여 IP 주소를 찾고, 위치를 찾고, 시스템 방화벽을 확인하는 등의 작업을 수행할 수 있습니다.
대부분의 경우 사용할 구성이 거의 필요하지 않은 몇 가지 일반적인 터미널 명령을 사용하여 네트워크 설정에 액세스할 수 있습니다. 여전히 구성을 위해 시스템 환경설정(System Preferences) 앱을 사용하는 것이 좋지만(터미널 사용에 만족하지 않는 한) Mac 터미널 네트워크 설정을 식별하는 것은 쉽습니다.
![Mac 터미널을 사용하여 네트워크 설정을 식별하는 방법](https://lh3.googleusercontent.com/-0ogi25RZEHE/YnL8cvP1EbI/AAAAAAABGgE/p69ZxyLG85EruwOKSrTtYCMTCiVHH_0WQCEwYBhgLKu8DABHVOhyfrVkC5xxyHmT-lpSbO6tplTOd-qYMw7zeoLwopLVI33BeBPoPj-qjsiZK33TW-noKefrvpWgkU8ZzFVMBaynicowNWw8mg4lYte_BEj2z-vxdbA63bRIoA2rDCDsDQPph-RKCRTwFPCcbP9uNjggwZK_LSU2kdC94IIN3WGwvPaB2GNVogxYyYMAl_NO4lVtl_4OW1Lo14JtynnMVvCU5_-7GJxH_8EQkNxLKeaJAsZ38I9fsgwW-Eryl4ZT1FQr0j4tArLlMXa_jMW4OegjdoxpXvvVWMNppYrZBHtTYnO49AbZLVIxitcLkLdEwwc1Zotz-on9dHFLH7VRoDvjP2IoIqPX_kSoxu4_ywepGQigpB4OVL3DAf4UbLq1_SuQtrsrd5w2iMayGAcqF7uAwPk1WMMtbcm0BgynOsyJEScGNlJ2HKBA9ouspIvGYi1xTPixh-foJKkkuqnHTnvFNvwyY4I4bpvSDFTCuZOtkXev46jqs86Y-FJlJw9CtPxuxhA9LKOvSMY-df1Tm1s5l-wS2oFox3Dwmim_qEO2sqtqU610mX_rprQQb0Gjd7sJoYsxd1IPR15jK4yOEqiwRYaJ7evYyNUGuSXiZ049_RNCkplrEsjnWuJORWnUzP4z_kVyCYUXw7sMRMNO7zJMG/s0/nAzDl4gWEPgcBDfgWdgVeNHo9K8.png)
네트워크 설정 사용(Using networksetup)
networksetup 도구 는 현재 Mac 네트워크 구성 에 대한 엄청난 양의 정보를 제공합니다 . 이를 사용하여 컴퓨터 이름, IP 주소, 현재 WiFi 네트워크 등을 찾을 수 있습니다. 이름에서 알 수 있듯이 설정을 변경하는 데 사용할 수도 있지만 이 작업을 수행하려면 시스템 (System) 환경설정(Preferences) 을 사용하는 것이 좋습니다 .
터미널에서 networksetup -help 를 입력하여 networksetup 도구를 사용하여 잠재적인 (networksetup -help)Mac 터미널 네트워크 명령 의 전체 목록을 볼 수 있습니다 . 그러면 도구를 사용하여 다양한 네트워크 설정을 보고 변경하는 방법에 대한 다양한 예와 함께 도움말 목록이 표시됩니다.
![터미널 창에서 네트워크 설정](https://lh3.googleusercontent.com/-4fp8O1qtITY/YnL_RCucy0I/AAAAAAABGa8/Sn7cmmQeEvYiqOvS0gOMmGFpirlkHm0iQCEwYBhgLKu8DABHVOhyfrVkC5xxyHmT-lpSbO6tplTOd-qYMw7zeoLwopLVI33BeBPoPj-qjsiZK33TW-noKefrvpWgkU8ZzFVMBaynicowNWw8mg4lYte_BEj2z-vxdbA63bRIoA2rDCDsDQPph-RKCRTwFPCcbP9uNjggwZK_LSU2kdC94IIN3WGwvPaB2GNVogxYyYMAl_NO4lVtl_4OW1Lo14JtynnMVvCU5_-7GJxH_8EQkNxLKeaJAsZ38I9fsgwW-Eryl4ZT1FQr0j4tArLlMXa_jMW4OegjdoxpXvvVWMNppYrZBHtTYnO49AbZLVIxitcLkLdEwwc1Zotz-on9dHFLH7VRoDvjP2IoIqPX_kSoxu4_ywepGQigpB4OVL3DAf4UbLq1_SuQtrsrd5w2iMayGAcqF7uAwPk1WMMtbcm0BgynOsyJEScGNlJ2HKBA9ouspIvGYi1xTPixh-foJKkkuqnHTnvFNvwyY4I4bpvSDFTCuZOtkXev46jqs86Y-FJlJw9CtPxuxhA9LKOvSMY-df1Tm1s5l-wS2oFox3Dwmim_qEO2sqtqU610mX_rprQQb0Gjd7sJoYsxd1IPR15jK4yOEqiwRYaJ7evYyNUGuSXiZ049_RNCkplrEsjnWuJORWnUzP4z_kVyCYUXw7sMRMNO7zJMG/s0/p9gMOUMAwZ6YNwQY0RlfH8vaPvs.png)
네트워크 정보를 보는 데 사용할 수 있는 networksetup 명령 의 예는 다음과 같습니다.
- Mac 컴퓨터 이름을 보려면: networksetup -getcomputername .
- 모든 Mac 네트워크 연결을 나열하려면: networksetup -listallhardwareports
- 현재 연결된 WiFi(WiFi) 네트워크 를 표시하려면 : networksetup -getairportname deviceid . deviceid 를 (deviceid)networksetup -listallhardwareports 명령 의 장치 ID로 바꿉니다 .
ipconfig 사용(Using ipconfig)
ipconfig 도구는 Windows 및 macOS 컴퓨터에 공통적 이지만 Windows 버전(Windows) 과 달리 네트워크 설정을 변경하는 데 가장 유용한 도구는 아닙니다. 그러나 유용할 수 있는 곳은 현재 네트워크 구성에 대한 정보를 나열하는 것입니다.
터미널에 ipconfig 를 입력 하면 사용 가능한 모든 명령이 나열되지만 여기에는 다음이 포함됩니다.
![터미널 창의 Ipconfig 명령](https://lh3.googleusercontent.com/-3kgWGlo_RDw/YnMHApt1NSI/AAAAAAABGR8/hvqiJPNN5zMtQfaOknvhu3RS__YD6KsJQCEwYBhgLKu8DABHVOhwq0dqsZlM8UJgT7Wn167k68dCZxXybSi-6nLamc30sqApnJF4ywbeeO_bkUsGKdYJXs_GnzaFpBkHJsQUUbvPhrIl6_GVESmyvxvbSlMQpq0gUoRw7ubOc8TrTb5vRzvVH-tSZeyXctHjb3RLbOLM8kFRk7zRu3jJCWLv9DFzzPG3wddPPf93ur2X_erlAZltqy1sNHpLPllq4Z0IRqtZXaCHQ_d9vFgAIl3DYYZEz9SdgA7cDzSn7_SA4ZZXUCjSiRyhCqQMllyifvtI54h_MXgUYMD1tlPYijWE7wkiSwig2h2_SQiF26wx_8kG64s4aQ7To78aldJQMaHvDyOc3-Z5sU7JsMORYpgZgsxj3-bv4K9rIg_Tfds5V0OsxA4K5B6WSwLBZsz46gFBoz4mZKwmCM4am4FMw04gDMpv7EYiXgdeCEmOrVzoSf1zxLe6tkII1hwc2v5bi0VSmmxCfKncIQfNT7bUPdo-7DGFzuKi9P066TUVxuVW7ACN6Tv_Mea9WZ0pdXCtkrTQtomS_qdYRjOPkON4YUt5GFuK8-OYH5b2_0BeZ8MHY-7gVd5c1If3tlL9PPwruxMesPs0cCSyCA-cIFRfsVVThva9bJ3d7Q9pwXiq_k784qeNH_wiZWDW-L8htvWoKMM67zJMG/s0/a2lrn8bg-hXAGFItydNZAHH-YMs.png)
- 현재 네트워크 IP 주소를 보려면: ipconfig getifaddr deviceid. deviceid 를 올바른 네트워크 장치 ID(예: en0 ) 로 바꾸 십시오. ( deviceid)이것을 모르는 경우 networksetup -listallhardwareports 를 입력 하십시오.
- 현재 네트워크 DNS(DNS) 서버 를 보려면 : ipconfig getoption deviceid domain_name_server ( deviceid 를 네트워크 장치 ID로 대체).
ifconfig 사용(Using ifconfig)
ifconfig 명령은 macOS 및 Linux PC(Linux PCs) 사용자가 사용할 수 있는 또 다른 네트워크 구성 도구 입니다. 그러나 ipconfig 와 달리(Unlike) ifconfig는 네트워크 설정을 보고 수정하는 훨씬 더 강력한 도구입니다.
![터미널의 Ifconfig 명령](https://lh3.googleusercontent.com/-lwTL_2t5nvY/YnLwMOceNLI/AAAAAAABGpM/CJ-5m88qPn45kucn6RBICx95q02tGVwdQCEwYBhgLKu8DABHVOhwq0dqsZlM8UJgT7Wn167k68dCZxXybSi-6nLamc30sqApnJF4ywbeeO_bkUsGKdYJXs_GnzaFpBkHJsQUUbvPhrIl6_GVESmyvxvbSlMQpq0gUoRw7ubOc8TrTb5vRzvVH-tSZeyXctHjb3RLbOLM8kFRk7zRu3jJCWLv9DFzzPG3wddPPf93ur2X_erlAZltqy1sNHpLPllq4Z0IRqtZXaCHQ_d9vFgAIl3DYYZEz9SdgA7cDzSn7_SA4ZZXUCjSiRyhCqQMllyifvtI54h_MXgUYMD1tlPYijWE7wkiSwig2h2_SQiF26wx_8kG64s4aQ7To78aldJQMaHvDyOc3-Z5sU7JsMORYpgZgsxj3-bv4K9rIg_Tfds5V0OsxA4K5B6WSwLBZsz46gFBoz4mZKwmCM4am4FMw04gDMpv7EYiXgdeCEmOrVzoSf1zxLe6tkII1hwc2v5bi0VSmmxCfKncIQfNT7bUPdo-7DGFzuKi9P066TUVxuVW7ACN6Tv_Mea9WZ0pdXCtkrTQtomS_qdYRjOPkON4YUt5GFuK8-OYH5b2_0BeZ8MHY-7gVd5c1If3tlL9PPwruxMesPs0cCSyCA-cIFRfsVVThva9bJ3d7Q9pwXiq_k784qeNH_wiZWDW-L8htvWoKMM27zJMG/s0/7O_EMNZ-BI5U-VYr3j6LXX5_6C8.png)
그러나 터미널에 ifconfig( ifconfig) 를 입력하기만 하면 Mac 에 연결되거나 통합된 모든 네트워크 장치에 대한 자세한 정보 목록을 볼 수 있습니다 . 여기에는 IP 및 MAC 주소, 현재 장치 상태 등이 포함됩니다.
대신 장치 ID(예: ifconfig en0(ifconfig en0) ) 를 나열하여 특정 정보를 볼 수 있습니다 .
핑 사용(Using ping)
이를 사용하여 네트워크 정보를 볼 수는 없지만 ping 명령을 사용하여 다른 네트워크 장치에 연결할 수 있는지 여부를 테스트할 수 있습니다. 네트워크의 장치(예: 네트워크 라우터) 또는 인터넷 연결을 테스트하기 위한 웹 사이트 도메인 또는 인터넷 IP 주소일 수 있습니다.
장치가 로컬 네트워크의 다른 장치나 장치 또는 인터넷의 웹 사이트에 연결하는 데 문제가 있는 것으로 보일 때마다 ping을 문제 해결 도구로 사용하고 싶을 것입니다. 정보를 보내고 반환하는 데 걸린 시간을 보여주고 종료하기로 결정할 때까지 계속 실행됩니다.
![터미널에서 Ping 명령](https://lh3.googleusercontent.com/-ed6CSEL5e_A/YnMG9QFh38I/AAAAAAABGTo/A2GqRmlnE3IsaIbHlw54nLNxeyBNGRHngCEwYBhgLKu8DABHVOhwq0dqsZlM8UJgT7Wn167k68dCZxXybSi-6nLamc30sqApnJF4ywbeeO_bkUsGKdYJXs_GnzaFpBkHJsQUUbvPhrIl6_GVESmyvxvbSlMQpq0gUoRw7ubOc8TrTb5vRzvVH-tSZeyXctHjb3RLbOLM8kFRk7zRu3jJCWLv9DFzzPG3wddPPf93ur2X_erlAZltqy1sNHpLPllq4Z0IRqtZXaCHQ_d9vFgAIl3DYYZEz9SdgA7cDzSn7_SA4ZZXUCjSiRyhCqQMllyifvtI54h_MXgUYMD1tlPYijWE7wkiSwig2h2_SQiF26wx_8kG64s4aQ7To78aldJQMaHvDyOc3-Z5sU7JsMORYpgZgsxj3-bv4K9rIg_Tfds5V0OsxA4K5B6WSwLBZsz46gFBoz4mZKwmCM4am4FMw04gDMpv7EYiXgdeCEmOrVzoSf1zxLe6tkII1hwc2v5bi0VSmmxCfKncIQfNT7bUPdo-7DGFzuKi9P066TUVxuVW7ACN6Tv_Mea9WZ0pdXCtkrTQtomS_qdYRjOPkON4YUt5GFuK8-OYH5b2_0BeZ8MHY-7gVd5c1If3tlL9PPwruxMesPs0cCSyCA-cIFRfsVVThva9bJ3d7Q9pwXiq_k784qeNH_wiZWDW-L8htvWoKMM67zJMG/s0/_vEw5hySe6W7gK2gZWnUc_u55TE.png)
이를 사용하려면 ping address 를 입력하고 (ping address)address 를 IP 주소 또는 도메인 이름으로 바꿉니다 . 테스트의 일반적인 대상은 google.com 입니다. (google.com)Google 을 검색 할 수 없다면 인터넷에 연결되어 있지 않은 것입니다.
마찬가지로 ping 192.168.1.1 은 많은 로컬 네트워크 라우터(192.168.1.1)의 IP 주소를 테스트합니다.
netstat 사용(Using netstat)
netstat 도구 는 현재 들어오고 나가는 네트워크 연결에 대한 정보를 나열합니다. 이 도구를 사용하여 Mac(Mac) 에 대한 모든 연결을 나열할 수 있습니다. Windows 및 Linux PC(Linux PCs) 도 netstat를 사용하지만 Mac 사용자가 사용할 수 있는 플래그가 다르기 때문에 몇 가지 차이점이 있습니다.
netstat를 사용하여 현재 네트워크 설정이나 연결을 볼 수 있는 방법에는 여러 가지가 있습니다. 여기에는 다음이 포함됩니다.
![터미널 창의 Netstat 도구](https://lh3.googleusercontent.com/-umH_DtLq8_U/YnLqiivNqkI/AAAAAAABGn0/ifaYL6UhqsUQfCx-IJw6q1lHC7sUFm8QwCEwYBhgLKu8DABHVOhyfrVkC5xxyHmT-lpSbO6tplTOd-qYMw7zeoLwopLVI33BeBPoPj-qjsiZK33TW-noKefrvpWgkU8ZzFVMBaynicowNWw8mg4lYte_BEj2z-vxdbA63bRIoA2rDCDsDQPph-RKCRTwFPCcbP9uNjggwZK_LSU2kdC94IIN3WGwvPaB2GNVogxYyYMAl_NO4lVtl_4OW1Lo14JtynnMVvCU5_-7GJxH_8EQkNxLKeaJAsZ38I9fsgwW-Eryl4ZT1FQr0j4tArLlMXa_jMW4OegjdoxpXvvVWMNppYrZBHtTYnO49AbZLVIxitcLkLdEwwc1Zotz-on9dHFLH7VRoDvjP2IoIqPX_kSoxu4_ywepGQigpB4OVL3DAf4UbLq1_SuQtrsrd5w2iMayGAcqF7uAwPk1WMMtbcm0BgynOsyJEScGNlJ2HKBA9ouspIvGYi1xTPixh-foJKkkuqnHTnvFNvwyY4I4bpvSDFTCuZOtkXev46jqs86Y-FJlJw9CtPxuxhA9LKOvSMY-df1Tm1s5l-wS2oFox3Dwmim_qEO2sqtqU610mX_rprQQb0Gjd7sJoYsxd1IPR15jK4yOEqiwRYaJ7evYyNUGuSXiZ049_RNCkplrEsjnWuJORWnUzP4z_kVyCYUXw7sMRMNO7zJMG/s0/PcSDgO5QDrdNEd9Mah-CXgUB0do.png)
- 모든 활성 인터넷 연결의 현재 목록: netstat
- 인터페이스에 대한 연결 데이터를 보려면 netstat -l deviceid deviceid 를 네트워크 인터페이스 이름으로 바꿉니다(예: netstat -l en0 ).
- IP 라우팅 테이블을 보려면 netstat -nr 또는 netstat -r
- 모든 네트워크 통계 표시: netstat -s 및 netstat -i
netstat 명령을 사용하는 방법과 복잡한 기술 용어를 해독하는 방법에 대한 자세한 내용 을 보려면 man netstat 를 입력하여 포함된 netstat 매뉴얼 페이지를 보고 읽으십시오.
lsof 사용(Using lsof)
lsof 명령을 사용하여 활성 네트워크 연결이 있는 Mac 에서 실행 중인 프로세스를 볼 수 있습니다 . 이것은 Windows 또는 Linux PC 에서 netstat 명령으로 찾을 수 있는 유사한 기능을 대체합니다 .
![터미널의 Lsof 명령](https://lh3.googleusercontent.com/-Bx7CYpU4IvA/YnL42KOhh5I/AAAAAAABGsA/pi9DTwxiOFcpy3BqUPPTTx-XyoFcKGmCACEwYBhgLKu8DABHVOhwq0dqsZlM8UJgT7Wn167k68dCZxXybSi-6nLamc30sqApnJF4ywbeeO_bkUsGKdYJXs_GnzaFpBkHJsQUUbvPhrIl6_GVESmyvxvbSlMQpq0gUoRw7ubOc8TrTb5vRzvVH-tSZeyXctHjb3RLbOLM8kFRk7zRu3jJCWLv9DFzzPG3wddPPf93ur2X_erlAZltqy1sNHpLPllq4Z0IRqtZXaCHQ_d9vFgAIl3DYYZEz9SdgA7cDzSn7_SA4ZZXUCjSiRyhCqQMllyifvtI54h_MXgUYMD1tlPYijWE7wkiSwig2h2_SQiF26wx_8kG64s4aQ7To78aldJQMaHvDyOc3-Z5sU7JsMORYpgZgsxj3-bv4K9rIg_Tfds5V0OsxA4K5B6WSwLBZsz46gFBoz4mZKwmCM4am4FMw04gDMpv7EYiXgdeCEmOrVzoSf1zxLe6tkII1hwc2v5bi0VSmmxCfKncIQfNT7bUPdo-7DGFzuKi9P066TUVxuVW7ACN6Tv_Mea9WZ0pdXCtkrTQtomS_qdYRjOPkON4YUt5GFuK8-OYH5b2_0BeZ8MHY-7gVd5c1If3tlL9PPwruxMesPs0cCSyCA-cIFRfsVVThva9bJ3d7Q9pwXiq_k784qeNH_wiZWDW-L8htvWoKMM67zJMG/s0/Bz6Khj43lEIT02qazUPYPkpFyiY.png)
lsof Mac(Mac) 터미널 명령을 사용하여 네트워크 데이터를 볼 수 있는 몇 가지 방법이 있습니다 . 여기에는 다음이 포함됩니다.
- 열려 있는 모든 네트워크 연결을 보려면: lsof -i
- 어떤 소프트웨어가 어떤 포트를 사용하고 있는지 보려면: lsof -n -i4TCP
자세한 내용 을 보려면 man lsof 를 입력 하여 lsof 명령에 대한 매뉴얼 페이지를 보십시오.
arp 사용(Using arp)
로컬 네트워크의 모든 활성 장치 목록을 보려면 arp 도구를 사용할 수 있습니다. 이렇게 하면 Mac(Mac) 이 네트워크에서 감지한 모든 장치 의 IP 및 MAC 주소 가 나열되며, 해당 장치가 만든 ARP ( Address Resolution Protocol ) 브로드캐스트를 기반으로 합니다.
터미널에 arp -a 를 입력 하면 이러한 장치 목록이 제공됩니다.
![터미널의 Arp 명령](https://lh3.googleusercontent.com/-JiWWxuJa8dk/YnME5lqHKcI/AAAAAAABGWA/A56B7VGyOrcPBeKpMvWZLOlsYq1QBKEUACEwYBhgLKu8DABHVOhwq0dqsZlM8UJgT7Wn167k68dCZxXybSi-6nLamc30sqApnJF4ywbeeO_bkUsGKdYJXs_GnzaFpBkHJsQUUbvPhrIl6_GVESmyvxvbSlMQpq0gUoRw7ubOc8TrTb5vRzvVH-tSZeyXctHjb3RLbOLM8kFRk7zRu3jJCWLv9DFzzPG3wddPPf93ur2X_erlAZltqy1sNHpLPllq4Z0IRqtZXaCHQ_d9vFgAIl3DYYZEz9SdgA7cDzSn7_SA4ZZXUCjSiRyhCqQMllyifvtI54h_MXgUYMD1tlPYijWE7wkiSwig2h2_SQiF26wx_8kG64s4aQ7To78aldJQMaHvDyOc3-Z5sU7JsMORYpgZgsxj3-bv4K9rIg_Tfds5V0OsxA4K5B6WSwLBZsz46gFBoz4mZKwmCM4am4FMw04gDMpv7EYiXgdeCEmOrVzoSf1zxLe6tkII1hwc2v5bi0VSmmxCfKncIQfNT7bUPdo-7DGFzuKi9P066TUVxuVW7ACN6Tv_Mea9WZ0pdXCtkrTQtomS_qdYRjOPkON4YUt5GFuK8-OYH5b2_0BeZ8MHY-7gVd5c1If3tlL9PPwruxMesPs0cCSyCA-cIFRfsVVThva9bJ3d7Q9pwXiq_k784qeNH_wiZWDW-L8htvWoKMM-7zJMG/s0/LI4tOVGi2ket41-G5CIa6eEnSF4.png)
그런 다음 여기에서 찾은 정보를 ping 과 같은 다른 명령과 결합하여 해당 장치가 여전히 활성화되어 있고 (ping)Mac 에서 통신할 수 있는지 여부를 확인할 수 있습니다 .
Mac 네트워크 설정 구성(Configuring Your Mac Network Settings)
이러한 도구를 사용 하여 Mac 터미널 네트워크 설정을 보고 변경하려는(또는 변경해야 하는) 설정을 식별할 수 있습니다. 예를 들어, 게스트 WiFi 네트워크에서 MAC 주소 필터링을 우회(bypass MAC address filtering) 하기 위해 Mac에서 MAC 주소를 스푸핑 해야 할 수 있습니다.(spoof a MAC address)
특히 Mac이 정기적으로 WiFi 연결을 끊는(Mac drops its WiFi connection regularly) 경우 문제를 식별하는 데 도움이 될 수도 있습니다 . Mac 에 문제가 있는 경우 Mac 용 OnyX(OnyX for Mac) 와 같은 앱 을 사용 하면 빠르게 백업하고 실행할 수 있습니다.
How to Use Mac Terminal to Identify Network Settings
While macOS offers an easy-to-use menu for your network settings іn the System Preferences menu, the Terminal app is where you need to be if you want to quickly lookup or test information about your network configuration. You сan use it to find your IP address, find yoυr location, check your system firewall, and more.
Your network settings can be accessed using some common terminal commands that, for the most part, require very little configuration to use. We still recommend you use the System Preferences app for configuration (unless you’re happy using the terminal), but identifying your Mac terminal network settings is easy.
![How to Use Mac Terminal to Identify Network Settings](https://lh3.googleusercontent.com/-0ogi25RZEHE/YnL8cvP1EbI/AAAAAAABGgE/p69ZxyLG85EruwOKSrTtYCMTCiVHH_0WQCEwYBhgLKu8DABHVOhyfrVkC5xxyHmT-lpSbO6tplTOd-qYMw7zeoLwopLVI33BeBPoPj-qjsiZK33TW-noKefrvpWgkU8ZzFVMBaynicowNWw8mg4lYte_BEj2z-vxdbA63bRIoA2rDCDsDQPph-RKCRTwFPCcbP9uNjggwZK_LSU2kdC94IIN3WGwvPaB2GNVogxYyYMAl_NO4lVtl_4OW1Lo14JtynnMVvCU5_-7GJxH_8EQkNxLKeaJAsZ38I9fsgwW-Eryl4ZT1FQr0j4tArLlMXa_jMW4OegjdoxpXvvVWMNppYrZBHtTYnO49AbZLVIxitcLkLdEwwc1Zotz-on9dHFLH7VRoDvjP2IoIqPX_kSoxu4_ywepGQigpB4OVL3DAf4UbLq1_SuQtrsrd5w2iMayGAcqF7uAwPk1WMMtbcm0BgynOsyJEScGNlJ2HKBA9ouspIvGYi1xTPixh-foJKkkuqnHTnvFNvwyY4I4bpvSDFTCuZOtkXev46jqs86Y-FJlJw9CtPxuxhA9LKOvSMY-df1Tm1s5l-wS2oFox3Dwmim_qEO2sqtqU610mX_rprQQb0Gjd7sJoYsxd1IPR15jK4yOEqiwRYaJ7evYyNUGuSXiZ049_RNCkplrEsjnWuJORWnUzP4z_kVyCYUXw7sMRMNO7zJMG/s0/nAzDl4gWEPgcBDfgWdgVeNHo9K8.png)
Using networksetup
The networksetup tool offers an enormous amount of information on your current Mac network configuration. You can use it to find your computer name, IP address, current WiFi network, and more. As the name suggests, you can also use it to change settings, but we’d still recommend using System Preferences to do this.
You can view a full list of potential Mac terminal network commands using the networksetup tool by typing networksetup -help at the terminal. This will display the help list, with various examples of how to use the tool to view and change different network settings.
![Networksetup in terminal window](https://lh3.googleusercontent.com/-4fp8O1qtITY/YnL_RCucy0I/AAAAAAABGa8/Sn7cmmQeEvYiqOvS0gOMmGFpirlkHm0iQCEwYBhgLKu8DABHVOhyfrVkC5xxyHmT-lpSbO6tplTOd-qYMw7zeoLwopLVI33BeBPoPj-qjsiZK33TW-noKefrvpWgkU8ZzFVMBaynicowNWw8mg4lYte_BEj2z-vxdbA63bRIoA2rDCDsDQPph-RKCRTwFPCcbP9uNjggwZK_LSU2kdC94IIN3WGwvPaB2GNVogxYyYMAl_NO4lVtl_4OW1Lo14JtynnMVvCU5_-7GJxH_8EQkNxLKeaJAsZ38I9fsgwW-Eryl4ZT1FQr0j4tArLlMXa_jMW4OegjdoxpXvvVWMNppYrZBHtTYnO49AbZLVIxitcLkLdEwwc1Zotz-on9dHFLH7VRoDvjP2IoIqPX_kSoxu4_ywepGQigpB4OVL3DAf4UbLq1_SuQtrsrd5w2iMayGAcqF7uAwPk1WMMtbcm0BgynOsyJEScGNlJ2HKBA9ouspIvGYi1xTPixh-foJKkkuqnHTnvFNvwyY4I4bpvSDFTCuZOtkXev46jqs86Y-FJlJw9CtPxuxhA9LKOvSMY-df1Tm1s5l-wS2oFox3Dwmim_qEO2sqtqU610mX_rprQQb0Gjd7sJoYsxd1IPR15jK4yOEqiwRYaJ7evYyNUGuSXiZ049_RNCkplrEsjnWuJORWnUzP4z_kVyCYUXw7sMRMNO7zJMG/s0/p9gMOUMAwZ6YNwQY0RlfH8vaPvs.png)
Examples of networksetup commands you can use to view network information include:
- To view your Mac computer name: networksetup -getcomputername.
- To list all Mac network connections: networksetup -listallhardwareports
- To display the current, connected WiFi network: networksetup -getairportname deviceid. Replace deviceid with a device ID from the networksetup -listallhardwareports command.
Using ipconfig
The ipconfig tool is common to Windows and macOS computers but, unlike the Windows version, it isn’t the most useful tool for changing network settings. Where it can be useful, however, is listing information on your current network configuration.
Typing ipconfig at the terminal will list all available commands, but these include:
![Ipconfig command in terminal window](https://lh3.googleusercontent.com/-3kgWGlo_RDw/YnMHApt1NSI/AAAAAAABGR8/hvqiJPNN5zMtQfaOknvhu3RS__YD6KsJQCEwYBhgLKu8DABHVOhwq0dqsZlM8UJgT7Wn167k68dCZxXybSi-6nLamc30sqApnJF4ywbeeO_bkUsGKdYJXs_GnzaFpBkHJsQUUbvPhrIl6_GVESmyvxvbSlMQpq0gUoRw7ubOc8TrTb5vRzvVH-tSZeyXctHjb3RLbOLM8kFRk7zRu3jJCWLv9DFzzPG3wddPPf93ur2X_erlAZltqy1sNHpLPllq4Z0IRqtZXaCHQ_d9vFgAIl3DYYZEz9SdgA7cDzSn7_SA4ZZXUCjSiRyhCqQMllyifvtI54h_MXgUYMD1tlPYijWE7wkiSwig2h2_SQiF26wx_8kG64s4aQ7To78aldJQMaHvDyOc3-Z5sU7JsMORYpgZgsxj3-bv4K9rIg_Tfds5V0OsxA4K5B6WSwLBZsz46gFBoz4mZKwmCM4am4FMw04gDMpv7EYiXgdeCEmOrVzoSf1zxLe6tkII1hwc2v5bi0VSmmxCfKncIQfNT7bUPdo-7DGFzuKi9P066TUVxuVW7ACN6Tv_Mea9WZ0pdXCtkrTQtomS_qdYRjOPkON4YUt5GFuK8-OYH5b2_0BeZ8MHY-7gVd5c1If3tlL9PPwruxMesPs0cCSyCA-cIFRfsVVThva9bJ3d7Q9pwXiq_k784qeNH_wiZWDW-L8htvWoKMM67zJMG/s0/a2lrn8bg-hXAGFItydNZAHH-YMs.png)
- To view your current network IP address: ipconfig getifaddr deviceid. Replace deviceid with the correct network device id (eg. en0). Type networksetup -listallhardwareports if you don’t know this.
- To view your current network DNS server: ipconfig getoption deviceid domain_name_server (replacing deviceid with your network device id).
Using ifconfig
The ifconfig command is another network configuration tool available to users on macOS and Linux PCs. Unlike ipconfig, however, ifconfig is a much more powerful tool for viewing and modifying your network settings.
![Ifconfig command in terminal](https://lh3.googleusercontent.com/-lwTL_2t5nvY/YnLwMOceNLI/AAAAAAABGpM/CJ-5m88qPn45kucn6RBICx95q02tGVwdQCEwYBhgLKu8DABHVOhwq0dqsZlM8UJgT7Wn167k68dCZxXybSi-6nLamc30sqApnJF4ywbeeO_bkUsGKdYJXs_GnzaFpBkHJsQUUbvPhrIl6_GVESmyvxvbSlMQpq0gUoRw7ubOc8TrTb5vRzvVH-tSZeyXctHjb3RLbOLM8kFRk7zRu3jJCWLv9DFzzPG3wddPPf93ur2X_erlAZltqy1sNHpLPllq4Z0IRqtZXaCHQ_d9vFgAIl3DYYZEz9SdgA7cDzSn7_SA4ZZXUCjSiRyhCqQMllyifvtI54h_MXgUYMD1tlPYijWE7wkiSwig2h2_SQiF26wx_8kG64s4aQ7To78aldJQMaHvDyOc3-Z5sU7JsMORYpgZgsxj3-bv4K9rIg_Tfds5V0OsxA4K5B6WSwLBZsz46gFBoz4mZKwmCM4am4FMw04gDMpv7EYiXgdeCEmOrVzoSf1zxLe6tkII1hwc2v5bi0VSmmxCfKncIQfNT7bUPdo-7DGFzuKi9P066TUVxuVW7ACN6Tv_Mea9WZ0pdXCtkrTQtomS_qdYRjOPkON4YUt5GFuK8-OYH5b2_0BeZ8MHY-7gVd5c1If3tlL9PPwruxMesPs0cCSyCA-cIFRfsVVThva9bJ3d7Q9pwXiq_k784qeNH_wiZWDW-L8htvWoKMM27zJMG/s0/7O_EMNZ-BI5U-VYr3j6LXX5_6C8.png)
However, you only need to type ifconfig at the terminal to view a detailed list of information for all of the network devices connected or integrated into your Mac. That includes IP and MAC addresses, current device status, and more.
You can view specific information by listing the device id (for example, ifconfig en0) instead.
Using ping
While you can’t use it to view any network information, you can use the ping command to test whether or not you can make contact with another network device. It could be a device on your network (for instance, your network router) or a website domain or internet IP address to test your internet connectivity.
You’ll want to use ping as a troubleshooting tool whenever your device seems to be having issues with connecting to another device on your local network, or a device or website on the internet. It will show the time taken for information to be sent and returned and will run continuously until you decide to end it.
![Ping command in terminal](https://lh3.googleusercontent.com/-ed6CSEL5e_A/YnMG9QFh38I/AAAAAAABGTo/A2GqRmlnE3IsaIbHlw54nLNxeyBNGRHngCEwYBhgLKu8DABHVOhwq0dqsZlM8UJgT7Wn167k68dCZxXybSi-6nLamc30sqApnJF4ywbeeO_bkUsGKdYJXs_GnzaFpBkHJsQUUbvPhrIl6_GVESmyvxvbSlMQpq0gUoRw7ubOc8TrTb5vRzvVH-tSZeyXctHjb3RLbOLM8kFRk7zRu3jJCWLv9DFzzPG3wddPPf93ur2X_erlAZltqy1sNHpLPllq4Z0IRqtZXaCHQ_d9vFgAIl3DYYZEz9SdgA7cDzSn7_SA4ZZXUCjSiRyhCqQMllyifvtI54h_MXgUYMD1tlPYijWE7wkiSwig2h2_SQiF26wx_8kG64s4aQ7To78aldJQMaHvDyOc3-Z5sU7JsMORYpgZgsxj3-bv4K9rIg_Tfds5V0OsxA4K5B6WSwLBZsz46gFBoz4mZKwmCM4am4FMw04gDMpv7EYiXgdeCEmOrVzoSf1zxLe6tkII1hwc2v5bi0VSmmxCfKncIQfNT7bUPdo-7DGFzuKi9P066TUVxuVW7ACN6Tv_Mea9WZ0pdXCtkrTQtomS_qdYRjOPkON4YUt5GFuK8-OYH5b2_0BeZ8MHY-7gVd5c1If3tlL9PPwruxMesPs0cCSyCA-cIFRfsVVThva9bJ3d7Q9pwXiq_k784qeNH_wiZWDW-L8htvWoKMM67zJMG/s0/_vEw5hySe6W7gK2gZWnUc_u55TE.png)
To use it, type ping address, replacing address with an IP address or domain name. A common target for testing is google.com—if you can’t hit Google, you probably don’t have internet connectivity.
Likewise, ping 192.168.1.1 will test the IP address for many local network routers (192.168.1.1).
Using netstat
The netstat tool lists information on your current incoming and outgoing network connections. Any connections made to your Mac can be listed using this tool. Windows and Linux PCs also use netstat, but there are some differences, with different available flags to Mac users.
There are several ways you can use netstat to view current network settings or connections. These include:
![Netstat tool in terminal window](https://lh3.googleusercontent.com/-umH_DtLq8_U/YnLqiivNqkI/AAAAAAABGn0/ifaYL6UhqsUQfCx-IJw6q1lHC7sUFm8QwCEwYBhgLKu8DABHVOhyfrVkC5xxyHmT-lpSbO6tplTOd-qYMw7zeoLwopLVI33BeBPoPj-qjsiZK33TW-noKefrvpWgkU8ZzFVMBaynicowNWw8mg4lYte_BEj2z-vxdbA63bRIoA2rDCDsDQPph-RKCRTwFPCcbP9uNjggwZK_LSU2kdC94IIN3WGwvPaB2GNVogxYyYMAl_NO4lVtl_4OW1Lo14JtynnMVvCU5_-7GJxH_8EQkNxLKeaJAsZ38I9fsgwW-Eryl4ZT1FQr0j4tArLlMXa_jMW4OegjdoxpXvvVWMNppYrZBHtTYnO49AbZLVIxitcLkLdEwwc1Zotz-on9dHFLH7VRoDvjP2IoIqPX_kSoxu4_ywepGQigpB4OVL3DAf4UbLq1_SuQtrsrd5w2iMayGAcqF7uAwPk1WMMtbcm0BgynOsyJEScGNlJ2HKBA9ouspIvGYi1xTPixh-foJKkkuqnHTnvFNvwyY4I4bpvSDFTCuZOtkXev46jqs86Y-FJlJw9CtPxuxhA9LKOvSMY-df1Tm1s5l-wS2oFox3Dwmim_qEO2sqtqU610mX_rprQQb0Gjd7sJoYsxd1IPR15jK4yOEqiwRYaJ7evYyNUGuSXiZ049_RNCkplrEsjnWuJORWnUzP4z_kVyCYUXw7sMRMNO7zJMG/s0/PcSDgO5QDrdNEd9Mah-CXgUB0do.png)
- For a current list of all active internet connections: netstat
- To view connection data for an interface: netstat -l deviceid, replacing deviceid with your network interface name (eg. netstat -l en0).
- To view the IP routing table: netstat -nr or netstat -r
- To show all network statistics: netstat -s and netstat -i
For more information on how to use the netstat command and to help decipher some of the complex technical terminologies, type man netstat to view and read through the included netstat man page.
Using lsof
You can use the lsof command as a way to view any running processes on your Mac that have active network connections. This replaces similar functionality that you’d find with the netstat command on Windows or Linux PCs.
![Lsof command in terminal](https://lh3.googleusercontent.com/-Bx7CYpU4IvA/YnL42KOhh5I/AAAAAAABGsA/pi9DTwxiOFcpy3BqUPPTTx-XyoFcKGmCACEwYBhgLKu8DABHVOhwq0dqsZlM8UJgT7Wn167k68dCZxXybSi-6nLamc30sqApnJF4ywbeeO_bkUsGKdYJXs_GnzaFpBkHJsQUUbvPhrIl6_GVESmyvxvbSlMQpq0gUoRw7ubOc8TrTb5vRzvVH-tSZeyXctHjb3RLbOLM8kFRk7zRu3jJCWLv9DFzzPG3wddPPf93ur2X_erlAZltqy1sNHpLPllq4Z0IRqtZXaCHQ_d9vFgAIl3DYYZEz9SdgA7cDzSn7_SA4ZZXUCjSiRyhCqQMllyifvtI54h_MXgUYMD1tlPYijWE7wkiSwig2h2_SQiF26wx_8kG64s4aQ7To78aldJQMaHvDyOc3-Z5sU7JsMORYpgZgsxj3-bv4K9rIg_Tfds5V0OsxA4K5B6WSwLBZsz46gFBoz4mZKwmCM4am4FMw04gDMpv7EYiXgdeCEmOrVzoSf1zxLe6tkII1hwc2v5bi0VSmmxCfKncIQfNT7bUPdo-7DGFzuKi9P066TUVxuVW7ACN6Tv_Mea9WZ0pdXCtkrTQtomS_qdYRjOPkON4YUt5GFuK8-OYH5b2_0BeZ8MHY-7gVd5c1If3tlL9PPwruxMesPs0cCSyCA-cIFRfsVVThva9bJ3d7Q9pwXiq_k784qeNH_wiZWDW-L8htvWoKMM67zJMG/s0/Bz6Khj43lEIT02qazUPYPkpFyiY.png)
There are several ways you can use the lsof Mac terminal command to view network data. These include:
- To view all open network connections: lsof -i
- To view what software is using what ports: lsof -n -i4TCP
For more information, type man lsof to view the man page for the lsof command.
Using arp
If you want to view a list of all active devices on a local network, you could use the arp tool. This will list the IP and MAC addresses for any devices that your Mac has detected on your network, based on the ARP (Address Resolution Protocol) broadcasts those devices have made.
Typing arp -a at the terminal will provide you with a list of these devices.
![Arp command in terminal](https://lh3.googleusercontent.com/-JiWWxuJa8dk/YnME5lqHKcI/AAAAAAABGWA/A56B7VGyOrcPBeKpMvWZLOlsYq1QBKEUACEwYBhgLKu8DABHVOhwq0dqsZlM8UJgT7Wn167k68dCZxXybSi-6nLamc30sqApnJF4ywbeeO_bkUsGKdYJXs_GnzaFpBkHJsQUUbvPhrIl6_GVESmyvxvbSlMQpq0gUoRw7ubOc8TrTb5vRzvVH-tSZeyXctHjb3RLbOLM8kFRk7zRu3jJCWLv9DFzzPG3wddPPf93ur2X_erlAZltqy1sNHpLPllq4Z0IRqtZXaCHQ_d9vFgAIl3DYYZEz9SdgA7cDzSn7_SA4ZZXUCjSiRyhCqQMllyifvtI54h_MXgUYMD1tlPYijWE7wkiSwig2h2_SQiF26wx_8kG64s4aQ7To78aldJQMaHvDyOc3-Z5sU7JsMORYpgZgsxj3-bv4K9rIg_Tfds5V0OsxA4K5B6WSwLBZsz46gFBoz4mZKwmCM4am4FMw04gDMpv7EYiXgdeCEmOrVzoSf1zxLe6tkII1hwc2v5bi0VSmmxCfKncIQfNT7bUPdo-7DGFzuKi9P066TUVxuVW7ACN6Tv_Mea9WZ0pdXCtkrTQtomS_qdYRjOPkON4YUt5GFuK8-OYH5b2_0BeZ8MHY-7gVd5c1If3tlL9PPwruxMesPs0cCSyCA-cIFRfsVVThva9bJ3d7Q9pwXiq_k784qeNH_wiZWDW-L8htvWoKMM-7zJMG/s0/LI4tOVGi2ket41-G5CIa6eEnSF4.png)
You could then combine the information found here with other commands like ping to determine whether or not those devices are still active and can be communicated with from your Mac.
Configuring Your Mac Network Settings
With your Mac terminal network settings in view using these tools, you can identify the settings you may prefer to (or need to) change. For instance, you may need to spoof a MAC address on your Mac to bypass MAC address filtering on a guest WiFi network.
It can also help you identify problems, especially if your Mac drops its WiFi connection regularly. If your Mac is having issues, apps like OnyX for Mac can help you get back up and running quickly.