Ubuntu 18.04 LXC container wrong gateway.

dragon2611

Renowned Member
Jul 2, 2010
90
7
73
I have a Ubuntu 18.04 LXC container running on Proxmox 5.3-11 that likes to pickup the wrong gateway, essentially the container won't be able to access the internet and I'll find it's default route is pointing at 10.xxx.xxx.254 instead of 10.xxx.xxx.1

However in the networking config for the container it's set to 10.xxx.xxx.1, now in my network .254 is one of the routers however in this case it's not the active router (Corosync cluster, the VIP is .1) so it tends to break things as for instance my site2site vpn's are not landing on that router.

I assume that something is trying to be clever and set the gateway following an ICMP redirect or some such, is this the case?
 
Code:
root@lenovo:~# pct config 119
arch: amd64
cores: 2
hostname: pihole1
memory: 1024
nameserver: 8.8.8.8 8.8.4.4
net0: name=eth0,bridge=vmbr0,gw=10.0.232.1,hwaddr=8E:66:CF:26:74:4A,ip=10.0.232.99/24,tag=101,type=veth
onboot: 1
ostype: ubuntu
rootfs: SSD2:vm-119-disk-0,size=20G
swap: 512
unprivileged: 1


Code:
root@pihole1:~# cat /etc/network/interfaces
# ifupdown has been replaced by netplan(5) on this system.  See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
#    sudo apt install ifupdown


Code:
root@pihole1:~# ls /etc/netplan/
root@pihole1:~#

netplan.d seems to be missing as well


Code:
root@pihole1:~# ps aux | grep dhcp
root       324  0.0  0.0   4976  1008 ?        Ss   Mar08   0:01 /sbin/dhcpcd
root     20539  0.0  0.0  11464  1032 pts/2    S+   11:37   0:00 grep --color=auto dhcp

Seems to be in dhcpcd.conf


Code:
root@pihole1:~# cat /etc/dhcpcd.conf
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
#clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private
interface eth0
        static ip_address=10.0.232.99/24
        static routers=10.0.232.254
        static domain_name_servers=127.0.0.1
root@pihole1:~#

I can't see any pve ignore files.
 
hmm - have never seen a ubuntu system with dhcpcd.conf as network-config - guess there's always new things to learn.

I'm pretty sure that we do not touch the /etc/dhcpcd conf when configuring a container.

does it work if you change the /etc/dhcpcd.conf and reboot the container?
 
Seems not to have gotten overwritten so hopefully that's done it

Whilst I can't say 100% I didn't put a static IP in that file, (Container was setup a while ago) it would be strange for me do so given 18.04 usually uses a Yaml file in /etc/netplan.d/ for a static config.
 
AFAIS for ubuntu-containers >= 17.10 we use systemd-networkd configuration.

Maybe systemd-networkd writes the /etc/dhcpcd conf if the package is installed?
 
Would like to confirm that I have the exact same issue with pihole as well and fixed it by editing dhcpcd.conf
 

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!