DNS resolution in LXC container

Hi all,
I’m using srsLTE-emane (https://github.com/adjacentlink/srsLTE-emane), an open source software that emulates LTE Network, and I have a problem with DNS resolution in LXC container.

I’m running a demonstration (found on https://github.com/adjacentlink/emane-model-lte.git) made by three containers: ue-02 (the mobile phone), enb-21 (the radio base station) and epc-01 (the core network of LTE). I’m able to ping any IP address from ue-02 (for example 104.83.108.242):

root@ue-02:~# ping 104.83.108.242 -c 5
PING 104.83.108.242 (104.83.108.242) 56(84) bytes of data.
64 bytes from 104.83.108.242: icmp_seq=1 ttl=50 time=96.8 ms
64 bytes from 104.83.108.242: icmp_seq=2 ttl=50 time=95.1 ms
64 bytes from 104.83.108.242: icmp_seq=3 ttl=50 time=94.5 ms
64 bytes from 104.83.108.242: icmp_seq=4 ttl=50 time=93.0 ms
64 bytes from 104.83.108.242: icmp_seq=5 ttl=50 time=91.8 ms

I’m not able to activate the DNS resolution (where www.repubblica.it is the internet site related to 104.83.108.242):

root@ue-02:~# nslookup www.repubblica.it
;; connection timed out; no servers could be reached

root@ue-02:~# LC_ALL=C ping www.repubblica.it
ping: www.repubblica.it: Name or service not known

I have read the instructions to modify the file resolv.conf, but these containers don’t have this file: these are a bit different from classical LXC containers. The unique configuration file is lxc.conf.

lxc.conf:

lxc.uts.name=ue-02
lxc.net.0.type=veth
lxc.net.0.name=backchan0
lxc.net.0.flags=up
lxc.net.0.link=letce0
lxc.net.0.ipv4.address=10.88.1.2/24
lxc.net.0.veth.pair=aveth.3.0
lxc.net.1.type = empty
lxc.net.1.flags=up

lxc.console.path = none
lxc.tty.max = 1
lxc.pty.max = 128
lxc.cgroup.devices.allow = a
lxc.mount.auto = proc sys cgroup


lxc.autodev = 1
lxc.hook.autodev = /usr/share/emane-model-lte/demo/two_ues/ue-02/lxc.hook.autodev.sh
lxc.apparmor.profile = unconfined

the only differences with lxc.conf of the other two containers are in the name and in the IP addresses.

I have tried to modify the file lxc.conf in /etc/dnsmasq.d-available, adding the line

dhcp-option=option:dns-server,8.8.8.8

and also (alternately)

dhcp-option=option:dns-server,0.0.0.0,8.8.8.8

but this did not work.

Someone could help me?

Thank you very much!!

Andrea

Try editing /etc/systemd/resolved.conf inside your container.

Hi CyrusTheVirusG,
thank you for your answer. I tried it, but it doens’t work.

I have solved with another suggestion, typing
echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf

Andrea

Ah forgot to mention the restart:

systemctl restart systemd-resolved

Not sure if your changes are permanent the way you are doing it.

You can verify the nameservers in use with:

systemd-resolve --status

Yes I had restarted, but it didn’t work (I don’t know why).

The changes are not permanent by my way. But, at least for me, is not a problem: I run the command every time I need it.