This topic describes the default network configurations of RDS Custom and how to configure network initialization for a custom image.
RDS Custom networking overview
An RDS Custom instance in dual-NIC mode has two network interfaces by default: a primary network interface (usually named eth0) and an Elastic Network Interface (ENI) (usually named eth1).
eth0: This interface is created in a management VPC. Because of security group restrictions, only traffic from the ECS management CIDR block 100.100.0.0/16 is allowed to exit through the eth0 interface.
NoteThe IP addresses 100.100.2.136 and 100.100.2.138 are internal DNS IP addresses. Traffic to and from these addresses must pass through eth1.
eth1: This interface is created in your VPC. Typically, all traffic, except for traffic from the ECS management CIDR block, passes through eth1. You can manage inbound and outbound traffic using security groups.
After you connect to an RDS Custom instance, its network interfaces, route table, and iptables firewall rules are typically as follows:
Run the
ip address showcommand to view the status of the instance's network interfaces.
Run the
route -ncommand to view the instance's route table.Traffic passes only through the eth1 network interface.

Run the
iptables -L -ncommand to view the default iptables configuration of the instance.
If you change the route table, iptables firewall rules, or network interface configurations (such as restarting eth0) on your RDS Custom instance and lose connectivity, restart the instance to initialize the RDS Custom network.
RDS Custom instances use the /etc/rds_custom_init.sh script for network initialization. Do not delete this script. If you do, initialization will fail.
Configure network initialization for a custom image
When you create an RDS Custom instance from a custom image, RDS Custom automatically configures the /etc/rds_custom_init.sh script for network initialization on most public images. Supported images include Alibaba Cloud Linux 3, Alibaba Cloud Linux 2, CentOS 8, CentOS 7, Debian 11, Debian 10.5, AlmaLinux 9.2, Ubuntu 22, Ubuntu 20, and Ubuntu 16. To use other custom images, you must manually create the rds_custom_init.sh script on the source image instance before you create the custom image.
The main functions of the rds_custom_init.sh script are as follows:
For systems that cannot automatically activate the ENI, it configures the network for eth1 and starts the related services.
It modifies the routing configuration to point the default route to eth1 and the ECS management CIDR block 100.100.0.0/16 to eth0.
It modifies the routing configuration to point the internal DNS IP addresses 100.100.2.136 and 100.100.2.138 to eth1.
When an RDS Custom instance starts, the system records the gateway of eth0 in /etc/eth0_gateway and automatically configures the /etc/rds_custom_init.sh script for most public images. If you plan to perform network-related initialization on the RDS Custom instance, ensure that you manually run the /etc/rds_custom_init.sh script after your network initialization is complete. If eth1 is not working (for example, if its IP address is not detected), contact us or configure the network to ensure that eth1 runs properly.
Manually create the script and configure it to run on startup
Create the
rds_custom_init.shscript in the /etc folder. The script content is as follows:Run the
chmod a+x /etc/rds_custom_init.shcommand to grant execute permissions to the script.Edit the
/etc/rc.localfile to configure therds_custom_init.shscript to run on startup.If the operating system is not Ubuntu, add
/etc/rds_custom_init.shto the/etc/rc.localfile and grant the required permissions to the/etc/rc.localfile.chmod 777 /etc/rc.localIf the operating system is Ubuntu, configure and enable the
rc-local.serviceservice.Edit the
/lib/systemd/system/rc-local.servicefile and add the following content:[Install] WantedBy=multi-user.targetConfigure the
rc-local.serviceservice to run on startup.# Configure the service to run on startup. systemctl enable rc-local.service # Check whether the service is configured to run on startup. systemctl is-enabled rc-local.serviceStart the
rc-local.serviceservice.# Start the service. systemctl start rc-local.service # Check the service status. systemctl status rc-local.service
NoteUbuntu 20.04, 22.04, and 24.04 support automatic configuration for attached secondary ENIs by default. If automatic configuration fails, perform the following steps to manually configure the ENI.
References
Handle and prevent network issues on an RDS Custom instance caused by automatic OS upgrades