I use this configuration in LXD and netplan which works fine:
lxc config device add c1routed eth0 nic nictype=routed parent=enp3s0 ipv4.address=192.168.1.200
Note: The parent
option is important if you are wanting to make your container appear to be on the host’s external network at the layer 2 rather than relying on the ISP routing traffic for your IPs to your host directly. You haven’t provided you LXD container config so I can’t tell at this stage.
Then in netplan:
network:
version: 2
ethernets:
eth0:
addresses:
- 192.168.1.200/32
nameservers:
addresses: [8.8.8.8]
routes:
- to: 0.0.0.0/0
via: 169.254.0.1
on-link: true
Can you ping 8.8.8.8 from your container (you say “ping works fine” but don’t state where you are able to ping to).
If you are able to ping externally from your container, then the routed
configuration is working and the most likely issue is a firewall on your host (that is preventing all routed traffic except ICMP ping) or on your wider network.