top of page
Writer's pictureAbhilash GB

Multi-homing Turnkey Ansible Appliance

In this blog, I will walk you through the procedure to multi-home a Turnkey Ansible appliance. The use case is to have the Ansible appliance vSphere VM connect to my internal lab network and also to the external network via a separate NIC for it to download and install patches/upgrades. I am doing this because I am going to apt update/upgrade/install the AWX packages onto it.


Prerequisite:

To start with, Edit the VM's settings and add a second network interface card that is uplinked to a port group that has access to the external network.



Power on the VM and use the following procedure to multi-home to the appliance:


  1. Check if the GOS sees both interfaces using the command "ip link show"

In this case, eth1 is the second interface.


  1. Now, set IP configuration for both these interfaces by editing the /etc/network/interfaces file. Here, I have set eth0, which connects to the lab's internal network with a static configuration, and eth1, which connects to the external network to procure IP configuration from a DHCP server.



  1. With the interface configuration in place, restart the networking stack to check for the settings to take effect by running the command:

 systemctl restart networking

  1. Check if the eth0 has picked up the static IP and eth1 a DHCP by running the following command:

 ip addr show
  1. The VM will not be able to connect to the external network yet, as the default gateway might still be from the internal network and mapped to eth0. You can verify this by running the following command:

ip route show

  1. Our next step is to move the default gateway to eth1. This is done by removing the default gateway from eth0 and then adding it to eth1. Use the following command syntax to remove the default route from eth0.

ip route detl default via <current default ip on eth0>
  1. Now, let's add the default gateway to eth1 using the following command syntax:

ip route add default via <gateway for the external network> dev eth1

  1. It is important to remember that these settings are not preserved over a reboot. To preserve it, you must add them to the /etc/network/interfaces file. But before you do that, ensure that the routing configuration does what you intended it to do. Let’s run some tests.


Awesome !! I can now get to the internet.

  1. Now that we know the routing configuration works, let’s ensure it persists over reboots. As mentioned, this is done by adding the route commands to the /etc/network/interfaces file. Use vi or nano to edit the file and make the changes, as shown in the screenshot below.

    The command is preceded by “up,” instructing the commands to be run once the eth1 interface is up.


  2. To verify that the settings are retained, do a “systemctl restart networking” or simply reboot the VM. I’ve rebooted the VM, and the route settings have been applied.


  3. Great!!!! I am now able to apt update from the repositories.

Comments


bottom of page