리눅스 공인 IP 확인

(공인 IP 확인에서 넘어옴)
what is my IP in Linux
How to find out my public IP in Linux
리눅스 공인 IP 확인
리눅스 퍼블릭 IP 확인

1 방법 1: curl[ | ]

  • curl로 각종 웹사이트들이 제공하는 정보 이용
명령어
curl ident.me
curl ifconfig.me
curl icanhazip.com
curl ipecho.net/plain
curl ipv4.icanhazip.com
실행 예시
[root@zetawiki ~]# curl icanhazip.com
246.80.135.79
[root@zetawiki ~]# curl ipv4.icanhazip.com
246.80.135.79
[root@zetawiki ~]# curl ipecho.net/plain
246.80.135.79
[root@zetawiki ~]# curl ifconfig.me
246.80.135.79
→ 외부IP(공인 IP)
[root@zetawiki ~]# ifconfig -a | grep "inet " | grep "Bcast:" | awk '{print $2}' | awk -F: '{print $2}'
192.168.0.139
→ 내부IP

2 방법 2: ip route[ | ]

ip route | awk '{print $NF;exit}'
[root@zetawiki ~]# ip route
246.80.135.0/24 dev eth0  proto kernel  scope link  src 246.80.135.79 
169.254.0.0/16 dev eth0  scope link  metric 1002 
default via 246.80.135.1 dev eth0
[root@zetawiki ~]# ip route | awk '{print $NF;exit}'
246.80.135.79

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}