/etc/network/interfaces route add

KatyComputer

Active Member
Sep 26, 2019
193
16
38
61
St Louis
katycomputer.com
I have a container on 10.101.101.11, I can ping it if I manually run "ip route add 10.101.0.0/16 dev vmbr1", what needs to be changed in /etc/network/interfaces to automate the route addition?
Code:
/etc/network/interfaces
auto vmbr1
iface vmbr1 inet static
        address 192.168.101.32/24
        gateway 192.168.101.1
        bridge-ports eno6
        bridge-stp off
        bridge-fd 0
        bridge-maxwait 0
        up route add -net 10.101.0.0/16 dev vmbr1

I have a similar situation with other containers, all is working well:
Code:
/etc/network/interfaces
auto vmbr0
iface vmbr0 inet static
        address 1.16.17.42/30
        gateway 1.16.17.41
        bridge-ports eno5
        bridge-stp off
        bridge-fd 0
        bridge-maxwait 0
        up route add -net 2.2.19.160/29 dev vmbr0
 
use post-up instead of up, also use ip instead of route, route from net-tools is deprecated

post-up ip route add 10.101.0.0/16 dev vmbr1
 
And oddly enough one of the two works for me: up route add -net 2.2.19.160/29 dev vmbr0

Fortunately, the vmbr0 route is more important.

Thats odd, a workaround would be a cronjob or systemd timer.

e.g "crontab -e"
@reboot sleep 15 && ip route add 10.101.0.0/16 dev vmbr1

its a bad hack but it should work
 

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!