The script for Linux is applicable to the following scenarios: both the private IP and public IP are bound to the primary ENI (eth0), where the public network address is accessed through the public IP, and the private network address is accessed through the private IP.
Note:
The script for Linux supports CentOS 6 and later, and Ubuntu.
Step one: download the script for EIP direct connection
EIP direct connection may cause network interruption. Therefore, you need to download the script for EIP direct connection and upload it to CVM in advance. You can obtain the script by using one of the following methods:
Method 1: upload the script for EIP direct connection
(2) After the script for Linux is downloaded onto the local machine, upload it to the CVM that requires EIP direct connection.
Method 2: directly use a command
wget https://network-data-1255486055.cos.ap-guangzhou.myqcloud.com/eip_direct.sh
wget https://network-data-1255486055.cos.ap-guangzhou.myqcloud.com/eip_direct.sh
Step two: configure EIP direct connection in the EIP Console
2. Find the EIP that is bound to the primary ENI and choose More > Direct Connection in the Operation column on the right.
3. Click on OK on the pop-up window.
Step three: run the script for EIP direct connection
After configuring EIP for the primary ENI (eth0), you need to log in to the CVM and run the script for EIP direct connection.
2. Run the script for EIP direct connection as follows:
2.1 Run the following command to add the execution permission:
2.2 Execute the ip addr
command to check the name of the ENI that requires EIP direct connection. 2.3 Execute the following command to run the script.
Here, ethx
indicates the name of the ENI (required). XX.XX.XX.XX
indicates the EIP address (optional). You may leave it blank and run ./eip_direct.sh install ethx
directly.
./eip_direct.sh install ethx XX.XX.XX.XX
The script for Windows is applicable to the following scenarios: Public network traffic goes through the primary ENI, and private network traffic goes through the secondary ENI.
Note:
To use EIP direct connection in Windows, you need one ENI for private IP and one ENI for public IP, and bind the public IP to the primary ENI and bind the private IP to the secondary ENI.
Step one: download the script for EIP direct connection
During configuration of EIP direct connection, the internet connection will be interrupted. Therefore, you need to download the script for EIP direct connection and upload it to CVM in advance.
2. Open the following link in the browser of the CVM to download the script for EIP direct connection:
Step two: configure the secondary ENI
Given that the Windows script is designed for scenarios where auxiliary network cards handle internal network traffic, it is therefore necessary to configure auxiliary network cards for the CVM.
2. On the Instances page, click the configured CVM ID to go to the Basic Information page.
3. Select the ENI tab and click Bind ENI to create an ENI that is in the same subnet as the primary ENI.
4. In the pop-up window, select Create and Bind an ENI, enter the information, select Automatic Assignment in Assign IP section and click OK.
Subnet: Select the subnet to which the cloud server belongs.
IP assignment: You can select Automatic Assignment in Assign IP or enter an IP manually.
Step three: configure EIP direct connection for the primary ENI
Upon completion of the auxiliary network card configuration, configure the EIP passthrough for the primary network card in the EIP console.
2. Find the EIP that is bound to the primary ENI and choose More > Direct Connection in the Operation column on the right.
3. Click on OK on the pop-up window.
Step four: configure IP in CVM
After configuring the EIP direct connection for the the primary ENI in the EIP console, you need to log into the CVM to configure the EIP.
2. On the operating system page, select in the lower-left corner and click to open the Windows PowerShell window. Enter firewall.cpl
and press Enter to open the Windows Firewall page. 3. Click Turn Windows Firewall on or off to go to the Customize Settings page.
4. Select Turn off Windows Firewall both in the Private network settings pane and the Public network settings pane.
5. Double-click to run the script downloaded in Step 1. Enter the public IP address and press Enter twice. 6. Enter ipconfig
in the Windows PowerShell window and press Enter. You can see that the IPv4 address on the primary ENI changes to the public network address.
Note:
When the direct connection is enabled, you cannot assign a private IP to the primary ENI. Otherwise, the CVM cannot access the public network.
Was this page helpful?