EIP Direct Connect
This document describes the method of Baidu AI Cloud for configuring EIP direct for BCC CentOS instances (including an instructional video). Users may refer to the key steps in the video to use AI Cloud products or resolve issues independently. Click here to watch the video Configuring EIP Direct for BCC CentOS Instances.
Description:
If the interface elements or operation methods shown in the video guidance are updated, please rely on the AI Cloud console interface for the most accurate information. The video aims to demonstrate the functional operation process, and minor interface changes will not affect the overall functionality or presentation.
EIP direct is primarily used in scenarios where virtual machines need to access public IPs, such as redirecting internal and external traffic to specific IP addresses. This document provides guidance on enabling EIP direct on Linux and configuring it.
Description:
- EIP direct is not supported for Windows Baidu Cloud Compute instances.
- Activating EIP direct may cause a brief network interruption. Users must first download the EIP direct script onto Baidu Cloud Compute and confirm that the service can handle temporary interruptions.
- The EIP direct configuration script performs only basic setup. For additional service needs, ensure routing is configured accordingly.
Application scenarios
When connecting to the Internet via EIP, users can choose between NAT mode or EIP direct mode, with NAT mode being the default option.
- In NAT mode, the EIP is not visible locally and must be manually added to the configuration every time.
- Once EIP direct is activated, the EIP becomes locally visible, eliminating the need for manual entry during every configuration, thereby reducing development efforts.
Operation steps
Step I: Obtain the EIP direct configuration script
Since enabling EIP direct will cause network interruptions, first download the EIP direct script to Baidu Cloud Compute via one of the following methods:
Method I: Upload EIP direct script
- Download the EIP direct configuration script from the following path:
CentOS:bcc_elastic_net_centos.sh
Ubuntu:bcc_elastic_net_ubuntu.sh
Debian:bcc_elastic_net_debian.sh
- After downloading the Linux script locally, upload it to the Baidu Cloud Compute instance that requires EIP direct.
Method II: Use the command directly
Sign in to the server requiring EIP direct and execute the following command:
Where, bcc_elastic_net_xx.sh is the script corresponding to the target machine's distribution, e.g., centos uses bcc_elastic_net_centos.sh
1 wget http://mirrors.baidubce.com/baidu/elastic-net-tools/bcc_elastic_net_xx.sh
2 Or curl -O http://mirrors.baidubce.com/baidu/elastic-net-tools/bcc_elastic_net_xx.sh
Step II: Configure EIP direct
- Log in to the console, open the left navigation bar, select "Elastic Public IP (EIP)," and go to the EIP interface.
- Select the EIP requiring direct access, go to the EIP Instance Details page, and toggle the EIP Direct switch.
Description:
- Users must bind the EIP to a cloud host or an elastic network interface before enabling EIP direct.
- EIP direct is disabled by default. Once enabled, users must configure EIP direct within the Baidu Cloud Compute server to make the EIP locally accessible.

Step III: Execute EIP direct configuration script
After configuring EIP direct for the primary network interface card, log in to Baidu Cloud Compute and execute the EIP direct script.
- Log in to the Baidu Cloud Compute server where EIP direct needs to be enabled.
-
Grant executable permission to the configuration script.
chmod +x bcc_elastic_net_xx.sh
- Execute configuration script
Where xx.xx.xx.xx represents the EIP address (optional). If omitted, simply run ./bcc_elastic_net_xx.sh install.
1 ./bcc_elastic_net_xx.sh install xx.xx.xx.xx
- Run the command
ip addrto check the configured EIP address.
Instructions for use of configuration script
The current configuration script supports three parameters. Refer to the table below for usage:
| Parameter name | Application method | Parameter description | Note |
|---|---|---|---|
| install | install [eip] | Configure [EIP] as the source address for the default route | If [EIP] is empty, it defaults to the first EIP address with direct service enabled |
| uninstall | uninstall | Restore the initial configuration of the default route | |
| help | help | Display help information |
Description:
- Baidu AI Cloud currently also supports elastic network interface (EIP) direct. For operation related to the elastic network interface, please refer to Configure Elastic Network Interface.
