tencent cloud

Obtaining a Public IP Address
Last updated: 2024-01-08 09:32:02
Obtaining a Public IP Address
Last updated: 2024-01-08 09:32:02

Overview

This document describes how to obtain the public IP address of a CVM instance.

Directions

Console
API
Instance metadata
1. Log in to the CVM console.
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.

1. Log in to the CVM instance. For more information, see Logging in to Linux Instance Using Standard Login Method and Logging in to Windows Instance.
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
Check the public IP in the result:

For more information, see Instance Metadata.

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback