sudo touch /etc/cloud/cloud-init.disabled sudo echo "network: {config: disabled}" > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
Also update this
FCheck for the existence of /etc/cloud/cloud.cfg configuration. If the file exists edit the file and change the settings within: FROM: preserve_hostname: false TO: preserve_hostname: true
sudo hostnamectl set-hostname NEWHOSTNAME
In this case a Bridge network on 192.168.1.1/24 and a host-only network on 192.168.56.1/24. Most important is the absence of the gateway4 line in the host-only network to ensure internet traffic goes via 192.168.1.1 gateway.
network: version: 2 renderer: networkd ethernets: enp0s3: dhcp4: no addresses: [192.168.1.60/24] gateway4: 192.168.1.1 nameservers: addresses: [8.8.8.8,192.168.1.1] search: [ example.org ] enp0s8: dhcp4: no addresses: [192.168.56.60/24]
Routing table output
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 enp0s3 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s3 192.168.56.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s8