CentOS 8 routed nic interface has no access to outside network

I have CentOS 8 LXD container configured with routed interface. LXD is installed via snap on Debian 10 host machine.

lxc init images:centos/8 c1
lxc config device add c1 eth0 nic nictype=routed parent=eth0 ipv4.address=138.*.16.151

/snap/bin/lxc list
|   NAME   |  STATE  |         IPV4          | IPV6 |   TYPE    | SNAPSHOTS |
| c1 | RUNNING | (eth0) |      | CONTAINER | 0         |

According to this post
Routed notwork is not working with Centos 7 now [from the box] I have added the file route-eth0 inside /etc/sysconfig/network-scripts

So from container I can ping the LXD interface:

PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=0.026 ms

However pinging google is not possible:

ping google.com
ping: google.com: Name or service not known

Routes (cmd executed inside container):

ip r
default via dev eth0 proto static metric 100 dev eth0 proto static scope link metric 100


cat /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO=none <--- changed to "none" from "static" according to the post linked above
cat /etc/sysconfig/network-scripts/route-eth0 dev eth0
default via dev eth0

What have you set the container’s DNS resolution server to?

Can you ping an external IP (i.e is this a DNS issue or a network issue?)

Oh, I am sorry, its my bad. I switched to Google DNS servers and now everything works properly.

1 Like