Getting Public IP Addresses
Last updated: 2024-01-08 09:32:02
Getting Public IP Addresses
Last updated: 2024-01-08 09:32:02
Overview
This document describes how to obtain the public IP address of a CVM instance.
Directions
2. On the instance management page, proceed according to the actually used view mode:
List view: In the primary IP column, click to copy the IP.
Tab view: On the instance page, click after the public network address in "IP Address" to copy the public IP.
Note:
The public IP address is mapped to the private IP address through NAT. Therefore if you view the network interface attributes from within the instance (such as by using ifconfig (Linux)
or ipconfig (Windows)
commands), the public IP address is not displayed. To obtain the public IP from within the instance, you need to check the instance metadata.
2. Use the cURL tool or an HTTP GET request to access the metadata and obtain the public IP address.
curl
http://metadata.tencentyun.com/meta-data/public-ipv4