Sunday, January 20, 2019

Set Manual Routing for VCSA

Although we want to to manage all of our deployed hosts inside a single subnet or VLAN, maybe in some situations there need to place many of hypervisor on other subnets / VLANs. So if there is a way for routing the vCenter traffic from it's gateway to them, there is no problem. Only the requirement traffics for initial management (incoming TCP 443 / both side TCP 902 / outgoing UDP 902) must be permitted within your gateway / router / firewall. But if it's not possible to do that because of some management or security considerations, so you can input all of the required routes inside the vCenter Server Shell. There is two ways to do that. One method is using "route add" command on shell access. For example:

# route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.100.1 dev eth0  

Result of this method is not persistent and will be clean after VCSA restart, Then it's useful only for testing or temporary situations. But if you want to save it, the Second way is editing of file *.network (such as 10-eth0.network) in and path "/etc/systemd/network" add intended routes in this form:
   
[Route]
Destination=10.10.20.0/24
Gateway=10.10.100.2

Remember to add each route line in separated [Routes] brackets, otherwise it's not working as you expected. Then restart the network interface:

# ifdown eth0 | ifup eth0

or restart the networkd with these commands:

# systemctl restart systemd-networkd
# service network restart

And now if you want to check the results, run: 

# route -n 
# ip route show

Without shell access if you only login to VCSA console, there is many CLI for routing check and config, so you can use of these. To check them and how to use:

> routes.list --help
> routes.add --help
> routes.delete --help
> routes.test --help 

Note I: There is another file here: "/etc/sysconfig/network/routes", if you view it's content, it will show only the system default gateway, no more routes will be shown here.

Note II: If you want to add routing to your ESXi hosts, just do:

# esxcli network ip route ipv4 add -n 10.10.20.0/24 -g 10.10.100.2


6 comments:

  1. One slight fix...it should be [Route], not [Routes]. It didn't work for me until I removed the "s".

    ReplyDelete
    Replies
    1. I always attach the pictures to avoid possible miss-typing, however thanks Bnort, I fixed it;)

      Delete
    2. Thanks for the post! It was exactly what I needed to resolve my issue.

      Delete
  2. Commsupport Cisco CCNA course will arm you with the knowledge to build maintain and fault find frame-relay networks for you home lab, or real world. CCNA Classes in Pune

    ReplyDelete

I will start a new journey soon ...