I found the best way to solve my problem is:
lxc launch images:${ostemplate} ${ct}
lxc stop ${ct}
...
lxc config device add $ct eth0 nic nictype=routed parent=eno1 ipv4.address=$ip
lxc file delete $ct/etc/netplan/10-lxc.yaml
lxc start $ct
lxc exec $ct -- systemd-resolve --set-dns=8.8.8.8 --set-domain=localdomain --set-llmnr=yes --set-mdns=no --set-dnssec=no --interface=eth0