Make Secondary Network Interface Work in CentOS or RHEL Instance
Adding a secondary network interface to a non-Amazon Linux instance causes traffic flow issues. This is because both the primary and the secondary network interfaces are in the same subnet, and there is only one routing table with one gateway. Traffic that comes into the secondary network interface will try to leave the instance using the primary network interface. But this is not allowed, because the secondary IP address does not belong to the MAC address of the primary network interface.
To make the secondary interface work, create a secondary network configuration file, add an additional routing table, and then set up rules in the custom routing table policy database so that traffic for the secondary interface uses the new routing table. To be sure that the new secondary route and rules are brought up in every boot, create and configure a secondary static route file.
Here is a summary of the steps for making the secondary interface work:
- Create a configuration file
- Create a new routing table
- Set rules in the Routing Policy Database
- Create a static route file