Monday, December 7, 2015

Static Routes on vCenter Server Appliance

Sometimes in the lab I have to make some interesting choices in how I make things work, that might not specifically be the best practice. I ran into one of these decisions today, as I needed to create static routes in the vCenter Server Appliance to create connectivity to a vRA install in the lab. This VRA install was behind an NSX edge router, while vCenter was on the same VLAN as the uplink of the NSX edge.

In this case I'm using the 5.5 vCenter Server Appliance, but this would probably work on other versions of the appliance.

I logged into the host with SSH, and checked the routing table (route -n). In this case my vCenter appliance had the IP address of 192.168.1.120, and the only route I had was to the default gateway of 192.168.1.1. I need to create a specific route for the 192.168.110.0/24 network, and point it to the upstream interface of the NSX edge at 192.168.1.124.

I could add the route using the route command, but it would need to be reentered after a reboot. Since I need this to be sticky I'll create the route with the ifroute-eth0 config file, located at /etc/sysconfig/network/ifroute-eth0 . I'll pipe the config I need to the file to route all traffic headed for 192.168.110.0/24 to 192.168.1.124, then restart networking.

echo 192.168.110.0 192.168.1.124 255.255.255.0 eth0 > /etc/sysconfig/network/ifroute-eth0

Restart networking:

service network restart

And make sure the route took by checking the routing table with route -n.

Simple and helped my get some things running in the lab that would have otherwise slowed down a project.

0 comments:

Post a Comment