NAT

VPC VPC

  • API Reference
    • ACL-Related Interfaces
      • Add ACL rule
      • Delete ACL rules
      • Query ACL rules
      • Query ACL
      • Update ACL rules
    • API function release records
    • API Overview
    • Appendix
    • Common Headers and Error Responses
    • Dedicated Gateway-Related Interfaces
      • Bind physical dedicated line
      • Create dedicated gateway
      • Create health check for dedicated gateway
      • Query dedicated gateway details
      • Query dedicated gateway list
      • Release dedicated gateway
      • Unbind physical dedicated line
      • Update dedicated gateway
    • Elastic Network Interface-Related Interfaces
      • Add intranet IP to elastic network interface in batches
      • Add Secondary IP Address of Elastic Network Interface
      • Create elastic network interface
      • Delete elastic network interface
      • Delete Intranet IP from elastic network interface in batches
      • Delete Secondary IP Address of Elastic Network Interface
      • Elastic network interface binds to EIP
      • Elastic Network Interface Mounts Cloud Product Instance
      • Elastic network interface unbinds from EIP
      • Elastic Network Interface Unmounts Cloud Product Instance
      • Query elastic network interface list
      • Query elastic network interface status
      • Query the specified elastic network interface
      • Update elastic network interface with enterprise security group
      • Update elastic network interface with regular security group
      • Update elastic network interface
    • Gateway Bandwidth Limiting Rule Related Interfaces
      • Create gateway bandwidth limiting rules
      • Delete Gateway Bandwidth Limiting Rule
      • Modify Gateway Bandwidth Limiting Rule
      • View Gateway Bandwidth Limiting Rule
    • General Description
    • High-Availability Virtual IP Address(HAVIP) Related Interfaces
      • Bind EIP to high-availability virtual IP address
      • Bind instance to high-availability virtual IP address
      • Create high-availability virtual IP address
      • Delete high-availability virtual IP address
      • Query high-availability virtual IP address list
      • Query the specified high-availability virtual IP address
      • Unbind EIP from high-availability virtual IP address
      • Unbind instance from high-availability virtual IP address
      • Update high-availability virtual IP address
    • Interface Overview
    • IPv6 Gateway-Related Interfaces
      • Add IPv6 egress-only policy
      • Bandwidth resizing for IPv6 gateway
      • Create IPv6 gateway bandwidth limiting policy
      • Create IPv6 gateway
      • Delete IPv6 gateway bandwidth limiting policy
      • Delete IPv6 Gateway
      • Delete the IPv6 egress-only policy
      • Query IPv6 gateway bandwidth limiting policy list
      • Query IPv6 gateway
      • Query the IPv6 egress-only policy list
      • Update IPv6 gateway bandwidth limiting policy
      • Update the IPv6 gateway release protection switch
    • NAT Gateway-Related Interfaces
      • Bind DNAT EIP to the NAT gateway
      • Bind SNAT EIP to the NAT gateway
      • Create DNAT rules in batches
      • Create DNAT rules
      • Create NAT gateway
      • Create SNAT rules in batches
      • Create SNAT rules
      • Delete DNAT rules
      • Delete SNAT rules
      • NAT Gateway Binds EIP
      • NAT gateway renewal
      • NAT Gateway Resize
      • NAT Gateway Unbinds EIP
      • Query DNAT rules
      • Query NAT gateway details
      • Query NAT gateway list
      • Query SNAT rules
      • Release NAT gateway
      • Unbind DNAT EIP from the NAT gateway
      • Unbind SNAT EIP from the NAT gateway
      • Update DNAT rules
      • Update NAT Delete Protection Switch
      • Update NAT gateway name
      • Update SNAT rules
    • Network Detection Related Interfaces
      • Create Network Probe
      • Delete network probe
      • Query network probe details
      • Query network probe list.
      • Update probe
    • Parameter Template-Related Interfaces
      • Add IP addresses to the IP address family
      • Add IP addresses to the IP address group
      • Create IP address family
      • Create IP address set
      • Delete IP address family
      • Delete IP address from IP address group
      • Delete IP address set
      • Query IP address family list
      • Query IP address group list
      • Query specified IP address family
      • Query specified IP address group
      • Remove IP address group from IP address family
      • Update IP address family
      • Update IP address set
    • Peering Connections-Related Interfaces
      • Application to process the peering connection
      • Bandwidth resizing for peering connections
      • Create peering connections
      • Disable DNS synchronization for the peering connections.
      • Enable DNS synchronization for the peering connections
      • List of peering connections to be queried.
      • Peering connection renewal
      • Release peering connections
      • Update the local API name and remarks for peering connections
      • Update the peering connection release protection switch
      • View details of peering connection
    • Route Table Related Interfaces
      • Create route rules
      • Delete route rules
      • Primary-standby switch
      • Query route table
      • Query routing rules
      • Update route rules
    • Security Group Related Interfaces
      • Enterprise security group
        • Authorize enterprise security group rules
        • Create enterprise security group
        • Delete enterprise security group rules
        • Delete enterprise security group
        • Query enterprise security group list
        • Update enterprise security group rules
      • Regular security group
        • Authorize regular security group rules
        • Create regular security group
        • Delete regular security group rules
        • Delete regular security group
        • Query regular security group list
        • Revoke regular security group rules
        • Update regular security group rules
        • View security group details
    • Service domain
    • Service Network Interface Card (SNIC)-Related Interfaces
      • Create service network interface card
      • Delete service network interface card
      • Query mountable public services
      • Query service network interface card details
      • Query service network interface card list
      • Update regular security group for service network interface card
      • Update service network interface card with enterprise security group
      • Update the service network interface card
    • Subnet-Related Interfaces
      • Create reserved network segment
      • Create subnet
      • Delete reserved network segment
      • Delete subnet
      • Query specified subnet
      • Query subnet list
      • Query the reserved network segment list
      • Update subnet
    • VPC-Related Interfaces
      • Create VPC
      • Delete VPC
      • Open VPC relay
      • Query IP Usage by Products in VPC
      • Query specified VPC
      • Query VPC intranet IP
      • Query VPC list
      • Shut down VPC relay
      • Update VPC
    • VPN-Related Interfaces
      • Bind EIP
      • Create SSL VPN server
      • Create SSL VPN users in batches
      • Create VPN tunnel
      • Create VPN
      • Delete SSL VPN server
      • Delete SSL VPN user
      • Delete VPN tunnel
      • Query SSL-VPN server
      • Query SSL-VPN user
      • Query VPN details
      • Query VPN List
      • Query VPN tunnels
      • Release VPN
      • Unbind EIP
      • Update SSL VPN server
      • Update SSL VPN user
      • Update VPN release protection switch
      • Update VPN tunnel
      • Update VPN
      • VPN gateway renewal
    • High-Availability Virtual IP Address (HAVIP) Related Interfaces
      • Bind EIP to high-availability virtual IP address
      • Bind instance to high-availability virtual IP address
      • Create high-availability virtual IP address
      • Delete high-availability virtual IP address
      • Query high-availability virtual IP address list
      • Query the specified high-availability virtual IP address
      • Unbind EIP from high-availability virtual IP address
      • Unbind instance from high-availability virtual IP address
      • Update high-availability virtual IP address
  • FAQs
    • Common Questions Overview
    • NAT FAQs
    • Route Table FAQs
    • Service Network Interface Card(SNIC) Common Questions
    • VPC FAQs
    • VPN FAQs
    • Service Network Interface Card (SNIC) Common Questions
  • Function Release Records
  • Operation guide
    • Access control
      • ACL
      • Parameter Template
      • Security group
    • Identity and access management
    • Monitor and Operations
      • NAT Gateway Instance Diagnosis
    • Network Connection
      • Dedicated gateway
      • IPv6 gateway
      • Layer 2 Gateway
      • NAT Gateway
        • Private Network NAT(Network Address Translation) Gateway
        • Public Network NAT(Network Address Translation) Gateway
        • Private Network NAT (Network Address Translation) Gateway
        • Public Network NAT (Network Address Translation) Gateway
      • Peering Connections
      • VPN Gateway
        • GRE VPN Gateway
        • IPsec VPN Gateway
        • SSL VPN Gateway
    • Network Diagnostics
      • Flow log
      • Gateway bandwidth limiting
      • Network probe
      • Path analysis
      • Port verification
      • Traffic monitor
    • Network interface card
      • Elastic network interface
      • High-availability virtual IP address (HAVIP)
      • Service network interface card
    • Network topology
    • Route table
    • Subnet
    • Tag Management
    • Using IPv6
    • VPC
  • Product Description
    • Application scenarios
    • Product advantages
    • Product features
    • Product Introduction
    • Related concepts
    • Usage restrictions
  • Product pricing
  • SDK
    • Go-SDK
      • ACL
      • Dedicated gateway
      • Elastic network interface
      • Exception handling
      • High-availability virtual IP address (HAVIP)
      • Initialization
      • Install the SDK Package
      • IPv6Gateway
      • NAT
      • Network probe
      • Overview
      • Peering Connections
      • Route
      • Security group
        • Enterprise security group
        • Regular security group
      • Service network interface card
      • Subnet
      • VPC
      • VPN
    • Java-SDK
      • ACL
      • Dedicated gateway
      • Elastic network interface
      • Enterprise security group
      • High-availability virtual IP address (HAVIP)
      • Install the SDK Package
      • IPv6 gateway
      • NAT
      • Network probe
      • Overview
      • Parameter Template
      • Peering Connections
      • Regular security group
      • Route
      • Service network interface card
      • Subnet
      • Version history
      • vpc
      • VPN
    • PHP-SDK
      • ACL
      • Install the SDK Package
      • NAT
      • Overview
      • Peering Connections
      • Route
      • Security group
      • Subnet
      • Version history
      • vpc
    • Python-SDK
      • ACL
      • Dedicated gateway
      • Elastic network interface
      • Enterprise security group
      • High-availability virtual IP address (HAVIP)
      • Install the SDK Package
      • IPv6Gateway
      • NAT
      • Network probe
      • Overview
      • Peering Connections
      • Route
      • Security group
      • Service network interface card
      • Subnet
      • Version history
      • VPC
      • VPN
  • Service Level Agreement (SLA)
    • IPv6 Gateway Service Level Agreement SLA
    • NAT(Network Address Translation) Gateway Service Level Agreement SLA
    • Peering Connections Service Level Agreement SLA
    • Service Network Interface Card(SNIC) Service Level Agreement SLA
    • VPN Gateway Service Level Agreement SLA
    • NAT (Network Address Translation) Gateway Service Level Agreement SLA
    • Service Network Interface Card (SNIC) Service Level Agreement SLA
  • Typical Practices
    • Configure Custom Service and Use Service Network Interface Card(SNIC) to Provide Service for Other VPCs
    • HAVIP Combined with Keepalived to Achieve Master-Backup Multi-Machine High Availability
    • Layer 2 Gateway Combined with Dedicated Line Access ET to Build Large Layer 2 Network Between IDC and Cloud VPC
    • Network Layer Security Description
    • Peering Connections Typical Practice
    • Security Group Configuration Practice (Advanced Level)
    • Security Group Configuration Practice (Beginner Level)
    • Typical Practice of Managing Elastic Network Interface Using Terraform
    • Typical Practice of Managing IPsec VPN Gateway Using Terraform
    • Using Keepalived in VPC to Achieve High-Availability Architecture
    • VPC Custom Route Table to Achieve Secure Traffic Mutual Access
    • Windows Using HAVIP to Configure Master-Backup Multi-Machine
    • Configure Custom Service and Use Service Network Interface Card (SNIC) to Provide Service for Other VPCs
  • VPC CLI
    • Configure BCE-CLI
    • Install BCE-CLI
    • Route Table Related Operations
    • Subnet Related Operations
    • Using VPC Service via CLI
    • Version Change Records
    • VPC Related Operations
All documents
menu
No results found, please re-enter

VPC VPC

  • API Reference
    • ACL-Related Interfaces
      • Add ACL rule
      • Delete ACL rules
      • Query ACL rules
      • Query ACL
      • Update ACL rules
    • API function release records
    • API Overview
    • Appendix
    • Common Headers and Error Responses
    • Dedicated Gateway-Related Interfaces
      • Bind physical dedicated line
      • Create dedicated gateway
      • Create health check for dedicated gateway
      • Query dedicated gateway details
      • Query dedicated gateway list
      • Release dedicated gateway
      • Unbind physical dedicated line
      • Update dedicated gateway
    • Elastic Network Interface-Related Interfaces
      • Add intranet IP to elastic network interface in batches
      • Add Secondary IP Address of Elastic Network Interface
      • Create elastic network interface
      • Delete elastic network interface
      • Delete Intranet IP from elastic network interface in batches
      • Delete Secondary IP Address of Elastic Network Interface
      • Elastic network interface binds to EIP
      • Elastic Network Interface Mounts Cloud Product Instance
      • Elastic network interface unbinds from EIP
      • Elastic Network Interface Unmounts Cloud Product Instance
      • Query elastic network interface list
      • Query elastic network interface status
      • Query the specified elastic network interface
      • Update elastic network interface with enterprise security group
      • Update elastic network interface with regular security group
      • Update elastic network interface
    • Gateway Bandwidth Limiting Rule Related Interfaces
      • Create gateway bandwidth limiting rules
      • Delete Gateway Bandwidth Limiting Rule
      • Modify Gateway Bandwidth Limiting Rule
      • View Gateway Bandwidth Limiting Rule
    • General Description
    • High-Availability Virtual IP Address(HAVIP) Related Interfaces
      • Bind EIP to high-availability virtual IP address
      • Bind instance to high-availability virtual IP address
      • Create high-availability virtual IP address
      • Delete high-availability virtual IP address
      • Query high-availability virtual IP address list
      • Query the specified high-availability virtual IP address
      • Unbind EIP from high-availability virtual IP address
      • Unbind instance from high-availability virtual IP address
      • Update high-availability virtual IP address
    • Interface Overview
    • IPv6 Gateway-Related Interfaces
      • Add IPv6 egress-only policy
      • Bandwidth resizing for IPv6 gateway
      • Create IPv6 gateway bandwidth limiting policy
      • Create IPv6 gateway
      • Delete IPv6 gateway bandwidth limiting policy
      • Delete IPv6 Gateway
      • Delete the IPv6 egress-only policy
      • Query IPv6 gateway bandwidth limiting policy list
      • Query IPv6 gateway
      • Query the IPv6 egress-only policy list
      • Update IPv6 gateway bandwidth limiting policy
      • Update the IPv6 gateway release protection switch
    • NAT Gateway-Related Interfaces
      • Bind DNAT EIP to the NAT gateway
      • Bind SNAT EIP to the NAT gateway
      • Create DNAT rules in batches
      • Create DNAT rules
      • Create NAT gateway
      • Create SNAT rules in batches
      • Create SNAT rules
      • Delete DNAT rules
      • Delete SNAT rules
      • NAT Gateway Binds EIP
      • NAT gateway renewal
      • NAT Gateway Resize
      • NAT Gateway Unbinds EIP
      • Query DNAT rules
      • Query NAT gateway details
      • Query NAT gateway list
      • Query SNAT rules
      • Release NAT gateway
      • Unbind DNAT EIP from the NAT gateway
      • Unbind SNAT EIP from the NAT gateway
      • Update DNAT rules
      • Update NAT Delete Protection Switch
      • Update NAT gateway name
      • Update SNAT rules
    • Network Detection Related Interfaces
      • Create Network Probe
      • Delete network probe
      • Query network probe details
      • Query network probe list.
      • Update probe
    • Parameter Template-Related Interfaces
      • Add IP addresses to the IP address family
      • Add IP addresses to the IP address group
      • Create IP address family
      • Create IP address set
      • Delete IP address family
      • Delete IP address from IP address group
      • Delete IP address set
      • Query IP address family list
      • Query IP address group list
      • Query specified IP address family
      • Query specified IP address group
      • Remove IP address group from IP address family
      • Update IP address family
      • Update IP address set
    • Peering Connections-Related Interfaces
      • Application to process the peering connection
      • Bandwidth resizing for peering connections
      • Create peering connections
      • Disable DNS synchronization for the peering connections.
      • Enable DNS synchronization for the peering connections
      • List of peering connections to be queried.
      • Peering connection renewal
      • Release peering connections
      • Update the local API name and remarks for peering connections
      • Update the peering connection release protection switch
      • View details of peering connection
    • Route Table Related Interfaces
      • Create route rules
      • Delete route rules
      • Primary-standby switch
      • Query route table
      • Query routing rules
      • Update route rules
    • Security Group Related Interfaces
      • Enterprise security group
        • Authorize enterprise security group rules
        • Create enterprise security group
        • Delete enterprise security group rules
        • Delete enterprise security group
        • Query enterprise security group list
        • Update enterprise security group rules
      • Regular security group
        • Authorize regular security group rules
        • Create regular security group
        • Delete regular security group rules
        • Delete regular security group
        • Query regular security group list
        • Revoke regular security group rules
        • Update regular security group rules
        • View security group details
    • Service domain
    • Service Network Interface Card (SNIC)-Related Interfaces
      • Create service network interface card
      • Delete service network interface card
      • Query mountable public services
      • Query service network interface card details
      • Query service network interface card list
      • Update regular security group for service network interface card
      • Update service network interface card with enterprise security group
      • Update the service network interface card
    • Subnet-Related Interfaces
      • Create reserved network segment
      • Create subnet
      • Delete reserved network segment
      • Delete subnet
      • Query specified subnet
      • Query subnet list
      • Query the reserved network segment list
      • Update subnet
    • VPC-Related Interfaces
      • Create VPC
      • Delete VPC
      • Open VPC relay
      • Query IP Usage by Products in VPC
      • Query specified VPC
      • Query VPC intranet IP
      • Query VPC list
      • Shut down VPC relay
      • Update VPC
    • VPN-Related Interfaces
      • Bind EIP
      • Create SSL VPN server
      • Create SSL VPN users in batches
      • Create VPN tunnel
      • Create VPN
      • Delete SSL VPN server
      • Delete SSL VPN user
      • Delete VPN tunnel
      • Query SSL-VPN server
      • Query SSL-VPN user
      • Query VPN details
      • Query VPN List
      • Query VPN tunnels
      • Release VPN
      • Unbind EIP
      • Update SSL VPN server
      • Update SSL VPN user
      • Update VPN release protection switch
      • Update VPN tunnel
      • Update VPN
      • VPN gateway renewal
    • High-Availability Virtual IP Address (HAVIP) Related Interfaces
      • Bind EIP to high-availability virtual IP address
      • Bind instance to high-availability virtual IP address
      • Create high-availability virtual IP address
      • Delete high-availability virtual IP address
      • Query high-availability virtual IP address list
      • Query the specified high-availability virtual IP address
      • Unbind EIP from high-availability virtual IP address
      • Unbind instance from high-availability virtual IP address
      • Update high-availability virtual IP address
  • FAQs
    • Common Questions Overview
    • NAT FAQs
    • Route Table FAQs
    • Service Network Interface Card(SNIC) Common Questions
    • VPC FAQs
    • VPN FAQs
    • Service Network Interface Card (SNIC) Common Questions
  • Function Release Records
  • Operation guide
    • Access control
      • ACL
      • Parameter Template
      • Security group
    • Identity and access management
    • Monitor and Operations
      • NAT Gateway Instance Diagnosis
    • Network Connection
      • Dedicated gateway
      • IPv6 gateway
      • Layer 2 Gateway
      • NAT Gateway
        • Private Network NAT(Network Address Translation) Gateway
        • Public Network NAT(Network Address Translation) Gateway
        • Private Network NAT (Network Address Translation) Gateway
        • Public Network NAT (Network Address Translation) Gateway
      • Peering Connections
      • VPN Gateway
        • GRE VPN Gateway
        • IPsec VPN Gateway
        • SSL VPN Gateway
    • Network Diagnostics
      • Flow log
      • Gateway bandwidth limiting
      • Network probe
      • Path analysis
      • Port verification
      • Traffic monitor
    • Network interface card
      • Elastic network interface
      • High-availability virtual IP address (HAVIP)
      • Service network interface card
    • Network topology
    • Route table
    • Subnet
    • Tag Management
    • Using IPv6
    • VPC
  • Product Description
    • Application scenarios
    • Product advantages
    • Product features
    • Product Introduction
    • Related concepts
    • Usage restrictions
  • Product pricing
  • SDK
    • Go-SDK
      • ACL
      • Dedicated gateway
      • Elastic network interface
      • Exception handling
      • High-availability virtual IP address (HAVIP)
      • Initialization
      • Install the SDK Package
      • IPv6Gateway
      • NAT
      • Network probe
      • Overview
      • Peering Connections
      • Route
      • Security group
        • Enterprise security group
        • Regular security group
      • Service network interface card
      • Subnet
      • VPC
      • VPN
    • Java-SDK
      • ACL
      • Dedicated gateway
      • Elastic network interface
      • Enterprise security group
      • High-availability virtual IP address (HAVIP)
      • Install the SDK Package
      • IPv6 gateway
      • NAT
      • Network probe
      • Overview
      • Parameter Template
      • Peering Connections
      • Regular security group
      • Route
      • Service network interface card
      • Subnet
      • Version history
      • vpc
      • VPN
    • PHP-SDK
      • ACL
      • Install the SDK Package
      • NAT
      • Overview
      • Peering Connections
      • Route
      • Security group
      • Subnet
      • Version history
      • vpc
    • Python-SDK
      • ACL
      • Dedicated gateway
      • Elastic network interface
      • Enterprise security group
      • High-availability virtual IP address (HAVIP)
      • Install the SDK Package
      • IPv6Gateway
      • NAT
      • Network probe
      • Overview
      • Peering Connections
      • Route
      • Security group
      • Service network interface card
      • Subnet
      • Version history
      • VPC
      • VPN
  • Service Level Agreement (SLA)
    • IPv6 Gateway Service Level Agreement SLA
    • NAT(Network Address Translation) Gateway Service Level Agreement SLA
    • Peering Connections Service Level Agreement SLA
    • Service Network Interface Card(SNIC) Service Level Agreement SLA
    • VPN Gateway Service Level Agreement SLA
    • NAT (Network Address Translation) Gateway Service Level Agreement SLA
    • Service Network Interface Card (SNIC) Service Level Agreement SLA
  • Typical Practices
    • Configure Custom Service and Use Service Network Interface Card(SNIC) to Provide Service for Other VPCs
    • HAVIP Combined with Keepalived to Achieve Master-Backup Multi-Machine High Availability
    • Layer 2 Gateway Combined with Dedicated Line Access ET to Build Large Layer 2 Network Between IDC and Cloud VPC
    • Network Layer Security Description
    • Peering Connections Typical Practice
    • Security Group Configuration Practice (Advanced Level)
    • Security Group Configuration Practice (Beginner Level)
    • Typical Practice of Managing Elastic Network Interface Using Terraform
    • Typical Practice of Managing IPsec VPN Gateway Using Terraform
    • Using Keepalived in VPC to Achieve High-Availability Architecture
    • VPC Custom Route Table to Achieve Secure Traffic Mutual Access
    • Windows Using HAVIP to Configure Master-Backup Multi-Machine
    • Configure Custom Service and Use Service Network Interface Card (SNIC) to Provide Service for Other VPCs
  • VPC CLI
    • Configure BCE-CLI
    • Install BCE-CLI
    • Route Table Related Operations
    • Subnet Related Operations
    • Using VPC Service via CLI
    • Version Change Records
    • VPC Related Operations
  • Document center
  • arrow
  • VPCVPC
  • arrow
  • SDK
  • arrow
  • Java-SDK
  • arrow
  • NAT
Table of contents on this page
  • Retrieve Endpoint
  • Retrieve AK/SK
  • Create NatClient
  • Create NAT gateway
  • Query NAT gateway list
  • Query NAT gateway details
  • Update NAT gateway name
  • Bind SNAT EIP to the NAT gateway
  • Unbind SNAT EIP from the NAT gateway
  • Release NAT gateway
  • NAT gateway renewal
  • Bind DNAT EIP to the NAT gateway
  • Unbind DNAT EIP from the NAT gateway
  • Create SNAT rules
  • Create SNAT rules in batches
  • Delete SNAT rules
  • Update SNAT rules
  • Query SNAT rules
  • Create DNAT rules
  • Create DNAT rules in batches
  • Delete DNAT rules
  • Update DNAT rules
  • Query DNAT rules
  • Appendix

NAT

Updated at:2025-10-16

Retrieve Endpoint

Before configuring the endpoint for SDK usage, please refer to the developer guide section on VPC Service Domain Name to understand endpoint-related concepts. Baidu AI Cloud currently supports multiple regions. Please refer to the VPC section in the Region Selection Guide. NAT service is part of the VPC service and adopts the VPC service domain name.

Retrieve AK/SK

To use the Baidu AI Cloud products, you need a Baidu AI Cloud account, a valid AK (Access Key ID) and SK (Secret Access Key) for signature certification. Your AK/SK information can be obtained and understood through the following steps:

  1. Register a Baidu AI Cloud account
  2. Create AK/SK

Create NatClient

When creating a NAT client, first configure a NAT client configuration-type config instance using endpoint, AK and SK, and then use the config instance to configure the NAT client. The specific configuration method is as follows:

Plain Text
1static final String HOST = "";
2static final String AK = "";
3static final String SK = "";
4NatClientConfiguration config = new NatClientConfiguration();
5config.setCredentials(new DefaultBceCredentials(AK, SK));
6config.setEndpoint(HOST);
7NatClient natClient = new NatClient(config);

Create NAT gateway

Function declaration

Plain Text
1public CreateNatResponse createNat(CreateNatRequest request) {
2    ......
3}

Parameter meaning

Refer to the OpenAPI documentation: Request Parameters for Creating NAT

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "natId": "nat-b58rnkn1g98h"
4}
  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleCreateNat.java

Query NAT gateway list

Function declaration

Plain Text
1public ListNatResponse listNat(ListNatRequest request) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Querying NAT Gateway List

Response value

  • Operation succeeded
Plain Text
1{
2     "nats":[
3        {
4            "id":"nat-bir8biqwr45e",
5            "name":"mynat",
6            "vpcId":"vpc-13vuxu016dew",
7            "spec":"small",
8            "status":"unconfigured",
9            "eips":[
10            ],
11            "paymentTiming":"Prepaid",
12            "expiredTime":"2018-08-13T08:10:59Z",
13            "createTime": "2021-04-25 17:22:34"
14        },
15        {
16            "id":"nat-b9q8n98mdxwc",
17            "name":"mynat",
18            "vpcId":"vpc-13vuxu016dew",
19            "spec":"small",
20            "status":"unconfigured",
21            "eips":[
22            ],
23            "paymentTiming":"Prepaid",
24            "expiredTime":"2018-07-27T13:18:00Z",
25            "createTime": "2021-04-25 17:22:34"
26        }
27    ],
28    "marker":"nat-b58rnkn1g98h",
29    "isTruncated": true,
30    "nextMarker": "nat-bi72s924x5xu",
31    "maxKeys": 2,
32 "metadata": For details, refer to the metadata section in the appendix
33}    
  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleListNat.java

Query NAT gateway details

Function declaration

Plain Text
1public GetNatResponse getNat(String natId) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Querying NAT Gateway Details

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "id":"nat-bir8biqwr45e",
4    "name":"mynat",
5    "vpcId":"vpc-13vuxu016dew",
6    "spec":"small",
7    "status":"unconfigured",
8    "eips":[
9    ],
10    "dnatEips":[
11    ],
12    "paymentTiming":"Prepaid",
13    "expiredTime":"2018-08-13T08:10:59Z",
14    "createTime": "2021-04-25 17:22:34",
15    "tags":[
16        {
17          "tagKey": "tagKey",
18          "tagValue": "tagValue"
19        }
20    ]
21}
  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleGetNat.java

Update NAT gateway name

Function declaration

Plain Text
1public void modifyNat(ModifyNatRequest request) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Updating NAT Gateway Name

Response value

  • Operation succeeded

No response value

  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleUpdateNat.java

Bind SNAT EIP to the NAT gateway

Function declaration

Plain Text
1public void bindEip(BindEipRequest request)  {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Binding SNAT EIP to NAT Gateway

Response value

  • Operation succeeded

No response value

  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleBindSnatEip.java

Unbind SNAT EIP from the NAT gateway

Function declaration

Plain Text
1public void unbindEip(BindEipRequest request) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Unbinding SNAT EIP from NAT Gateway

Response value

  • Operation succeeded

No response value

  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleUnbindSnatEip.java

Release NAT gateway

Function declaration

Plain Text
1public void releaseNat(ReleaseNatRequest request) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Releasing NAT Gateway

Response value

  • Operation succeeded

No response value

  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleDeleteNat.java

NAT gateway renewal

Function declaration

Plain Text
1public void purchaseReservedNat(PurchaseReservedNatRequest request) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Renewing NAT Gateway

Response value

  • Operation succeeded

No response value

  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleRenewNat.java

Bind DNAT EIP to the NAT gateway

Function declaration

Plain Text
1public void bindDnatEip(BindDnatEipRequest request) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Binding DNAT EIP to NAT Gateway

Response value

  • Operation succeeded

No response value

  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleBindDnatEip.java

Unbind DNAT EIP from the NAT gateway

Function declaration

Plain Text
1public void unbindDnatEip(BindDnatEipRequest request)  {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Unbinding DNAT EIP from NAT Gateway

Response value

  • Operation succeeded

No response value

  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleUnbindDnatEip.java

Create SNAT rules

Function declaration

Plain Text
1public CreateNatRuleResponse createSnatRule(CreateSnatRuleRequest request) {
2    ......
3}

Parameter meaning

Refer to OpenAPI documentation: Request Parameters for Creating SNAT Rules

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "ruleId": "rule-zrsaybxm7nrn"
4}
  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleCreateSnatRule.java

Create SNAT rules in batches

Function declaration

Plain Text
1public CreateBatchDnatRuleIdsResponse batchAddDnatRules(BatchAddDnatRulesRequest request) {
2    ......
3}

Parameter meaning

Refer to OpenAPI documentation: Request Parameters for Creating SNAT Rules in Batches

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "ruleIds": [
4      "rule-zrsaybxm7nrn",
5      "rule-f5kid5g50nua"
6    ]
7}
  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleBatchCreateSnatRule.java

Delete SNAT rules

Function declaration

Plain Text
1public void deleteSnatRule(DeleteNatRuleRequest request) {
2    ......
3}

Parameter meaning

Refer to OpenAPI documentation: Request Parameters for Deleting SNAT Rules in Batches

Response value

  • Operation succeeded

No response value

  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleDeleteSnatRule.java

Update SNAT rules

Function declaration

Plain Text
1public void updateSnatRule(UpdateSnatRuleRequest request) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Updating SNAT Rules

Response value

  • Operation succeeded

No response value

  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleUpdateSnatRule.java

Query SNAT rules

Function declaration

Plain Text
1public ListSnatRuleResponse listSnatRule(String natId) {
2    ......
3}
4public ListSnatRuleResponse listSnatRule (ListNatRuleRequest request)  {
5    ......
6}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Querying SNAT Rules

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "isTruncated": true,
4    "nextMarker": "rule-vza86i2k6dqu",
5    "maxKeys": 2,
6    "rules": [
7     {
8            "ruleId": "rule-k1jenum3v9s6",
9            "ruleName": "s3",
10            "publicIpsAddress": [
11                "100.88.10.185"
12            ],
13            "sourceCIDR": "1.1.1.1/32",
14            "status": "configuring"
15        },
16        {
17            "ruleId": "rule-kdgqkwpske2q",
18            "ruleName": "s2",
19            "publicIpsAddress": [
20                "100.88.10.185"
21            ],
22            "sourceCIDR": "192.168.1.0/24",
23            "status": "configuring"
24        }
25    ]
26}
  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleListSnatRule.java

Create DNAT rules

Function declaration

Plain Text
1public CreateNatRuleResponse createDnatRule(CreateDnatRuleRequest request) {
2    ......
3}

Parameter meaning

Refer to OpenAPI documentation: Request Parameters for Creating DNAT Rules

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "ruleId": "rule-zrsaybxm7nrn"
4}
  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleCreateDnatRule.java

Create DNAT rules in batches

Function declaration

Plain Text
1public CreateBatchDnatRuleIdsResponse batchAddDnatRules(BatchAddDnatRulesRequest request) {
2    ......
3}

Parameter meaning

Refer to OpenAPI documentation: Request Parameters for Creating DNAT Rules in Batches

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "ruleIds": [
4      "rule-zrsaybxm7nrn",
5      "rule-f5kid5g50nua"
6    ]
7}
  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleBatchCreateDnatRule.java

Delete DNAT rules

Function declaration

Plain Text
1public void deleteDnatRule(DeleteNatRuleRequest request) {
2    ......
3}

Parameter meaning

Refer to OpenAPI documentation: Request Parameters for Deleting DNAT Rules in Batches

Response value

  • Operation succeeded

No response value

  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleDeleteDnatRule.java

Update DNAT rules

Function declaration

Plain Text
1public void updateDnatRule(UpdateDnatRuleRequest request) {
2    ......
3}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Updating DNAT Rules

Response value

  • Operation succeeded

No response value

  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleUpdateDnatRule.java

Query DNAT rules

Function declaration

Plain Text
1public ListDnatRuleResponse listDnatRule(String natId)  {
2    ......
3}
4public ListDnatRuleResponse listDnatRule (ListNatRuleRequest request) {
5    ......
6}

Parameter meaning

Please refer to the OpenAPI documentation Request Parameters for Querying DNAT Rules

Response value

  • Operation succeeded
Plain Text
1{
2 "metadata": For details, refer to the metadata section in the appendix,
3    "isTruncated": true,
4    "nextMarker": "rule-pej10dar6pxd",
5    "maxKeys": 2,
6    "rules": [
7        {
8            "ruleId": "rule-29d9jpprcm75",
9            "ruleName": "sg",
10            "publicIpAddress": "100.88.6.197",
11            "privateIpAddress": "192.168.3.3",
12            "publicPort": 333,
13            "privatePort": 333,
14            "status": "active",
15            "protocol": "TCP"
16        },
17        {
18            "ruleId": "rule-72z6p8ni6rce",
19            "ruleName": "sd",
20            "publicIpAddress": "100.88.6.197",
21            "privateIpAddress": "192.168.2.2",
22            "publicPort": 222,
23            "privatePort": 222,
24            "status": "active",
25            "protocol": "UDP"
26        }
27    ]
28}
  • Operation failed

For response exception list of operation failure, refer to the NAT Exception List.

Example code

For specific code examples, refer to ExampleListDnatRule.java

Appendix

Public response information in Metadata format

Plain Text
1 {
2      "bceRequestId":"f5f0821d-45fe-439b-bbf4-fc48b639f84a",
3      "contentLength":28,
4      "contentType":"application/json;charset=UTF-8",
5      "date":1701917695000,
6      "server":"openresty/1.15.8.1"
7 }

Previous
IPv6 gateway
Next
Network probe