네트워크 프로그래밍1 게이트웨이 라우터의 public ip, private ip를 알아보자. 서버 개발을 하거나 일상에서도 게이트웨이 라우터의 ip를 알아야 할 때가 있다.이때 bash에 alias로 스크립트를 등록해 놓으면 ip를 간편하게 알아낼 수 있다.사실 명령어를 바로 사용해도 된다(curl ifconfig.me). 그냥 쉘 스크립트를 간단히 사용해 보고 싶어 작성한 글이다. 명령어는 다음과 같다:echo "Gateway's\nPublic IP address is: \$(curl -s ifconfig.me)\nPrivate IP address is: \$(ip route | grep default | awk '{print $3}' | head -n 1)"더보기출력:Gateway'sPublic IP address is: xxx.xxx.xxx.xxxPrivate IP address is: 1.. 2025. 3. 14. 이전 1 다음