Ubuntu server 20.04 netplan multiple IP addresses on one network card

I have some real issues with one brand new Ubuntu 20.04 installation. I'm trying to accomplish simple network configuration - one physical interface with 2 different IP addresses from the same network using the same gateway. I see netplan is not supporting aliases anymore so I was following the recommendation from netplan page. Here is my config:

network:
version: 2
renderer: networkd
  ethernets:
    enp2s0:
     addresses:
       - 192.168.1.100/24
       - 192.168.1.99/24
     gateway4: 192.168.1.1
     nameservers:
         addresses: [1.1.1.1, 1.0.0.1]  

So when I netplan apply server disappears from the network completely. By looking in the syslog i see the following error:

enp2s0: Could not set route: Nexthop has invalid gateway. Network is unreachable enp2s0: Failed

I was following the examples from here https://netplan.io/examples#using-multiple-addresses-on-a-single-interface This should be very simple configuration which I don't understand why not working. Am I missing something? Thanks, Andrey

here is an output from netplan debug:

srv1:~$ sudo netplan --debug generate
DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:1744): DEBUG: 11:04:55.637: Processing input file /etc/netplan/00-installer-config.yaml..
** (generate:1744): DEBUG: 11:04:55.637: starting new processing pass
** (generate:1744): DEBUG: 11:04:55.637: We have some netdefs, pass them through a final round of validation
** (generate:1744): DEBUG: 11:04:55.637: enp2s0: setting default backend to 1
** (generate:1744): DEBUG: 11:04:55.637: Configuration is valid
** (generate:1744): DEBUG: 11:04:55.637: Generating output files..
** (generate:1744): DEBUG: 11:04:55.637: NetworkManager: definition enp2s0 is not for us (backend 1)
(generate:1744): GLib-DEBUG: 11:04:55.637: posix_spawn avoided (fd close requested)

Netplan is very fussy about spacing, indentation, and no tabs.

Try this slight variation of your .yaml file...

network:
  version: 2
  renderer: networkd
  ethernets:
    enp2s0:
      addresses:
        - 192.168.1.100/24
        - 192.168.1.99/24
      gateway4: 192.168.1.1
      nameservers:
        addresses: [1.1.1.1, 1.0.0.1]
      optional: true

sudo netplan generate

sudo netplan apply

reboot