All Products
Search
Document Center

:Enable Internet access for a personal development environment by using a private Internet NAT gateway

Last Updated:Dec 02, 2024

This topic describes how to create an Internet NAT gateway in the virtual private cloud (VPC) that is associated with a personal development environment, associate an elastic IP address (EIP) with the VPC, and configure SNAT in the VPC. This allows the personal development environment to access the Internet by using a private Internet NAT gateway.

Prerequisites

A VPC is selected when a personal development environment is created.

Background information

If you select a VPC for the personal development environment that you create, requests from the personal development environment to access the Internet are routed to the private Internet NAT gateway of the VPC. You can associate an EIP with the personal development environment to facilitate access to the Internet.

Procedure

  1. Create an Internet NAT gateway. The following table describes the key parameters. For information about other parameters, see Use the SNAT feature of an Internet NAT gateway to access the Internet.

    For information about how to create multiple Internet NAT gateways in a VPC, see Deploy multiple Internet NAT gateways in one VPC.

    Parameter

    Description

    Region

    Make sure that the region is the same as the region where the personal development environment located.

    VPC

    Select the VPC and the vSwitch that are associated with the personal development environment.

    image

    Associate vSwitch

    Access Mode

    Select SNAT for All VPC Resources. An SNAT entry is automatically configured for the VPC.

    EIP

    Select Purchase EIP.

    Service-linked Role

    The first time you create a NAT gateway, click Create Service-linked Role to create a service-linked role.

  2. On the Internet NAT Gateway page, click the name of the gateway that you created. The Basic Information tab appears. Click the SNAT Management tab and check whether an SNAT entry is created.

    image

    If no SNAT entry is created, create an SNAT entry in the gateway. When you create an SNAT entry, select Specify VPC and set the Select Public IP Address parameter to Use Single IP. If you purchased multiple IP addresses, you can select Use Multiple IP. For more information about how to create an SNAT entry, see Use the SNAT feature of an Internet NAT gateway to access the Internet.

  3. Test the network connectivity.

    1. In the top navigation bar, switch to the personal development environment. In the lower-left corner of the page, click the image icon and select Command Palette from the shortcut menu. In the search box that appears, search for a terminal.

      image

    2. Run the ping www.aliyun.com command in the terminal to test the network connectivity.

      If a response packet is returned, the personal development environment can access the Internet by using the private Internet NAT gateway.

      The following response indicates that the personal development environment can access the Internet by using the private Internet NAT gateway.

      /mnt/workspace> ping www.aliyun.com
      PING www.aliyun.com.w.cdngslb.com (183.146.XX.XX): 56 data bytes
      64 bytes from 183.146.XX.XX: icmp_seq=0 ttl=53 time=12.245 ms
      64 bytes from 183.146.XX.XX: icmp_seq=1 ttl=53 time=12.164 ms
      64 bytes from 183.146.XX.XX: icmp_seq=2 ttl=53 time=12.097 ms
      64 bytes from 183.146.XX.XX: icmp_seq=3 ttl=53 time=12.127 ms
      64 bytes from 183.146.XX.XX: icmp_seq=4 ttl=53 time=12.266 ms
      64 bytes from 183.146.XX.XX: icmp_seq=5 ttl=53 time=12.164 ms