[SOLVED] route add problem

Oct 23, 2020
83
3
13
31
Hi everyone!
After installing Proxmox (ifupdown2 and openvswitch included) I need to add route, if I'm trying add to config of my network it isn't working (look at code). But if I'm trying add in CLI by command ip route add, everything works till reboot. What I am doing wrong?
Config of my network
Code:
# network interface settings; autogenerated
# Please do NOT modify this file directly, unless you know what
# you're doing.
#
# If you want to manage parts of the network configuration manually,
# please utilize the 'source' or 'source-directory' directives to do
# so.
# PVE will preserve these directives, but will NOT read its network
# configuration from sourced files, so do not attempt to move any of
# the PVE managed interfaces into external files!

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

auto eno1
iface eno1 inet manual

auto eno1.1002
iface eno1.1002 inet static
        address 172.30.141.11/26
        gateway 172.30.141.9
        dns-nameservers 172.30.141.9
        dns-search mylab.loc
# dns-* options are implemented by the resolvconf package, if installed

iface eno2 inet manual

iface eno3 inet manual

iface eno4 inet manual

iface eno5 inet manual

iface eno6 inet manual

post-up ip route add 192.168.0.0/24 via 172.30.141.5
 
you need to put the post-up inside an interface

Code:
auto eno1.1002
iface eno1.1002 inet static
        address 172.30.141.11/26
        gateway 172.30.141.9
        dns-nameservers 172.30.141.9
        dns-search mylab.loc
        post-up ip route add 192.168.0.0/24 via 172.30.141.5

the post-up is done after the up of this interface
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!