Our vCenter is multi-homed to allow connectivity to our backup network. Prior to upgrading to 6.0, we had a static route in the /etc/sysconfig/network/ifroute-eth1 file. This allowed communication to work correctly. Here's what I get by default on 6.5:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.9.40.1 0.0.0.0 UG 0 0 0 eth1
0.0.0.0 10.9.24.1 0.0.0.0 UG 0 0 0 eth0
10.9.24.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.9.40.0 0.0.0.0 255.255.248.0 U 0 0 0 eth1
If I manually edit the routes to my liking, this is how they look:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default gateway 0.0.0.0 UG 0 0 0 eth0
10.9.24.0 * 255.255.255.0 U 0 0 0 eth0
10.9.32.0 10.9.40.1 255.255.224.0 UG 0 0 0 eth1
While this works, it is not persistent. Any ideas on how I can make the routes persist on reboot?
vi /etc/sysconfig/network/ifroute-eth0
now add entry in the below format
<TargetNetwork> <GatewayAddress> <Netmask> <Interface>
Similarly for eth1 also do the same.
vi /etc/sysconfig/network/ifroute-eth1
In your case
(eg)
10.9.32.0 10.9.40.1 255.255.224.0 eth1
Once done restart networkd
systemctl restart systemd-networkd
ip route show
Thank you for the reply deepak88. In my 6.0 vCenter, this is exactly how I configured my routes. In my 6.5 vCenter, there is no ifroute-eth* file. Here's the contents of that directory:
root@vm-vcenter04 [ /etc/sysconfig/network ]# ls
if-up.d routes scripts
It took me a minute, but I figured out how this should be done. I have a VCSA that is multihomed to three networks.
Anyway, let's say you multiple routes that need to route through eth1 (obviously, pick the NIC where the gateway exists you need to push routes through)...
Example, I had two networks that needed to route through a gateway reachable on eth1:
At the bottom of /etc/systemd/network/10-eth1.network, I added:
[Route]
Gateway=192.168.10.1
Destination=10.0.0.0/8
[Route]
Gateway=192.168.10.1
Destination=172.19.35.0/24
I then ran:
# ifdown eth1
# ifup eth1
Now, run either "ip route", or "netstat -rn" to check the results.
Hope that helps!!
For some reason, doing this breaks the built-in backup system. It's not clear to me that this method actually worked; when I came across this, I or a colleague had apparently given up and set our default route such that we wouldn't need the statics.
2019-09-20T10:50:33.482 [MainProcess:PID-60259] ERROR: BackupManager encountered an exception: While reading from '/etc/systemd/network/10-eth0.network' [line 17]: section 'Route' already exists
I explained in following post how to do set manual routing for VCSA and keep it persistent:
Undercity of Virtualization: Set Manual Routing for VCSA