Specify default gateway when using two netif in Ubuntu 20.04 LXC container

AlbanV

New Member
May 1, 2020
6
0
1
26
Hi everyone
I'm trying to create a container with Ansible using proxmox API
My LXC container network configuration looks like this when the container is created int /etc/pve/lxc/$vmid.conf :
Code:
net0: name=eth0,bridge=vmbr0,gw=192.168.1.1,hwaddr=FA:6E:B3:F4:D6:61,ip=192.168.1.121/25,type=veth
net1: name=eth1,bridge=vmbr1,gw=192.168.2.254,hwaddr=B6:9B:72:3F:52:A1,ip=192.168.2.141/25,type=veth


The problem is Ubuntu is showing me two default gateway like this:
Code:
default via 192.168.2.254 dev eth1 proto static
default via 192.168.1.1 dev eth0 proto static
192.168.1.0/25 dev eth0 proto kernel scope link src 192.168.1.121
192.168.2.128/25 dev eth1 proto kernel scope link src 192.168.2.141

Is there a way to select the only default route I want ?
Thank you for reading

Alban
 
If you don't need the gateway at all on one interface, just don't configure it?