How to use static routed IPs with VMs on Linux Print

  • 0

We deploy additional IPs as static routed to your server's primary IP by default as this reduces IP wastage, as a result, some special configurations in your OS will be required.
If this is a problem for you, ask us about assigning additional IPs to your server's VLAN instead, this will result in higher cost but will mean no special configurations are required.

Run the following command to enable IP forwarding in the Linux kernel:
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf && sysctl -p


Add the following to a new file /etc/systemd/system/addroute.service:

[Unit]
After=network.service

[Service]
Type=oneshot
ExecStart=/usr/sbin/ip route add [additional IP subnet including CIDR e.g. 192.168.0.0/29] dev [bridge name e.g. viifbr0]

[Install]
WantedBy=default.target

Then run the following as a single command:

chmod 664 /etc/systemd/system/fixroute.service \
&& systemctl daemon-reload \
&& systemctl enable fixroute.service \
&& systemctl start fixroute.service


Was this answer helpful?

« Back