static ip 20.04 desktop

Asked by Ricardo Ortega

I have a fresh VM installed from ubuntu-20.04.1-desktop-amd64.iso.

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal

cat 99_config.yaml
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    ens3:
      addresses:
        - 10.59.2.30/24
      gateway4: 10.59.2.1
      nameservers:
          search: [mydomain, otherdomain]
          addresses: [209.18.47.61, 209.18.47.62]

cat 01-network-manager-all.yaml
network:
  version: 2
  renderer: NetworkManager

When I leave only 01-network-manager-all.yaml in /etc/netplan and do sudo netplan apply I'm able to browse the internet and ping the gateway. From another computer I am able to ping the dynamic IP and SSH into host remotely.
ip route show
default via 10.59.2.1 dev ens3 proto dhcp metric 100
10.59.2.0/24 dev ens3 proto kernel scope link src 10.59.2.124 metric 100
169.254.0.0/16 dev ens3 scope link metric 1000

When I leave only 99_config.yaml in /etc/netplan and do sudo netplan apply I'm NOT able to browse the internet, nor ping the gateway. From another computer I am able to ping the static IP and SSH into host remotely.
ip route show
default via 10.59.2.1 dev ens3 proto static metric 20100
10.59.2.0/24 dev ens3 proto kernel scope link src 10.59.2.37 metric 100
169.254.0.0/16 dev ens3 scope link metric 1000

I'm using same 99_config.yaml (different IP) on VMs created using ubuntu-20.04.1-live-server-amd64.iso (server vs desktop) and it works without issue (I can ping gateway and can do nslookup), also when doing "ip route show" on server I noticed the metric is not in part of the output, also I noticed metric on the desktop version is set to 20100. How would I go about updating metric to lower value see if I'm able to browse internet. If my issue is not related to the metric then what are the correct steps to set static IP for Ubuntu desktop 20.04.1?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Ricardo Ortega
Solved:
Last query:
Last reply:
Revision history for this message
Ricardo Ortega (rortega2) said :
#1

I have updated the renderer to networkd on my 99_config.yaml:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens3:
      addresses:
        - 10.59.2.30/24
      gateway4: 10.59.2.1
      nameservers:
          search: [mydomain, otherdomain]
          addresses: [209.18.47.61, 209.18.47.62]

Metric is now gone but I still can't do nslookup nor ping gateway, I am however able to SSH remotely to system and ping the static IP from remote PC.

ip route
default via 10.59.2.1 dev ens3 proto static
10.59.2.0/24 dev ens3 proto kernel scope link src 10.59.2.37

Revision history for this message
Ricardo Ortega (rortega2) said :
#2

The static IP works only when I do not use the 10.59.2.30 IP address, any other address works.