RU | EN | DE

Ubuntu Server. Option 1. Old.

sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback
 
allow-hotplug enp0s3
iface enp0s3 inet static
    address 10.0.0.10         <- IP address of Debian
    netmask 255.255.255.0     <- Mask
    gateway 10.0.0.1          <- IMPORTANT: IP of your Windows Server!
    dns-nameservers 8.8.8.8   <- DNS (or specify 10.0.0.1 if DNS is running on the server)

Ubuntu Server. Option 2. New.

Step 1. Disable network management in Cloud-init 🛑

We will create a special blocker file that tells the system: “Don’t touch the network settings, I’ll handle it myself”.

  1. Create a new configuration file:
sudo nano /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
  1. Insert this line (curly braces are required):
network: {config: disabled}
  1. Save (Ctrl+O, Enter, Ctrl+X).

Step 2. Create your own configuration file 📝

Now let’s create a file with a different name that Cloud-init won’t touch.

  1. Create file 01-netcfg.yaml (any name is fine, main thing is the .yaml extension):
sudo nano /etc/netplan/01-netcfg.yaml
  1. Insert your correct settings:
    network:
      version: 2
      ethernets:
        enp0s3:
          dhcp4: no
          addresses:
            - 192.168.0.14/24
          routes:
            - to: default
              via: 192.168.0.200
          nameservers:
            addresses: [8.8.8.8, 1.1.1.1]
  1. Save and exit.

Step 3. Cleanup and apply 🧹

Now let’s delete the file that kept interfering, and apply our new settings.

  1. Delete the cloud-init file (it won’t regenerate anymore thanks to step 1):
sudo rm /etc/netplan/50-cloud-init.yaml
  1. Apply settings:
sudo netplan apply
  1. Check the address:
ip a