Skip to main content

Adding a static route on VCSA 6.5

I recently upgraded my lab vCenter to the vCenter Server Appliance (VCSA) v6.5.

As I need a static route on my network, I went to add that in the same way that I’ve done for other VCSAs, only to find that the networking has changed.

VCSA 6.5 now uses systemd-networkd to control networking. Any attempt to use “service network restart” will generate a bunch of error messages about “exiting with error 6”. Editing files in /etc/sysconfig/network ¬†will have no discernable effect.

So how do you add a static route under the new networking regime?

Log on to your VCSA using ssh (or the console) and start a shell.

cd /etc/systemd/network

There you will find all the network config files.

Typically you will have just one, named “10-eth0.network”.

The contents of this file are relatively self explanatory:

[Match]
Name=eth0
 
[Network]
Gateway=192.168.1.254
Address=192.168.1.40/24
DHCP=no
 
[DHCP]
UseDNS=false

Add a new section at the bottom of the file using your favourite text editor:

[Route]
Gateway=192.168.1.20
Destination=192.168.2.0/24

Again, the format for this is pretty obvious.
Once that’s saved, run:

systemctl restart systemd-networkd

Check that your route has taken using

root@vc01 [ ~ ]# ip route show
default via 192.168.1.254 dev eth0  proto static
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.40
192.168.2.0/24 via 192.168.1.20 dev eth0  proto static

Linux with no monitor

I have an old Linux machine with no monitor attached (i.e. headless) which I use as a server.

It was running an old version of Linux so I updated it to Ubuntu using the process to upgrade an existing Linux installation over a network connection. Worked like a dream.
At the end of the process I rebooted the machine but then realised that Ubuntu doesn’t run a ssh server by default.
I couldn’t log in on the console because I had no monitor and the default Ubuntu install boots to the Gnome GUI which is impossible to drive ‘blind’. Here’s how I sorted it.

  1. Open one of the alternate text terminals by hitting ctrl-alt-F2 on the machine’s keyboard.
  2. Enter your username, press return.
  3. Enter your password, press return.
  4. Enter sudo apt-get install openssh-server, press return.
  5. Enter your password, press return.

With careful typing, that should get you logged in and install and start the ssh daemon. You can then log in remotely.