3 Replies Latest reply on May 7, 2018 6:47 PM by grep_boy

    Static Routes on VCSA 6.5

    elihuj Enthusiast

      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?

        • 1. Re: Static Routes on VCSA 6.5
          deepak88 Lurker

          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

          • 2. Re: Static Routes on VCSA 6.5
            elihuj Enthusiast

            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

            • 3. Re: Static Routes on VCSA 6.5
              grep_boy Novice

              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)...

               

              1. Edit the file /etc/systemd/network/10-eth1.network (or whatever the file is on yours that controls the settings for eth1).
              2. Then add the following lines for each route:
                [Route]
                Gateway=<default gateway for the route>
                Destination=<destination of the route>
              3. Restart the interface to enable the new routes:

              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!!