This has been changed since the last time I worked on ubuntu and now it totally differs from my debian knowledge. There is nothing complicated about it. The config file is just placed elsewhere and formulated differently. Then the network restart command and the networking system is also different.
Back in the day it was the "if up if down" or "ifupdown" and now it is the Netplan service.
Check with this command which one are you running:
dpkg -l | grep -E '(netplan|ifupdown)'
Check your card name with:
ip a
Then edit your network file:
Instead of /etc/network/interfaces it is in a .yaml Netplan file
# /etc/netplan/00-netcfg.yaml (config file location)
network: # start of network config block
version: 2 # use of Netplan version 2
renderer: networkd # system service provided by systemd
ethernets: # section of ethernet interface config
enp0s3: # interface logical name
addresses:
- 192.168.1.40/24 # IP address and subnet mask
routes:
- to: default # gateway, default
via: 192.168.1.254 # router ip
nameservers:
addresses: [8.8.8.8, 1.1.1.1] # DNS server IPs
Then instead of systemctl restart networking.service
systemctl restart network-manager
We simply use:
netplan apply
This is how simple it is still to configure a network card in linux / Ubuntu. You can find all info, very clearly explained here:
- https://ubuntu.com/server/docs/configuring-networks
_dnhyper

