LXC centos DNS

Xilmen

Active Member
Mar 30, 2017
26
0
41
35
Hello everybody,

I have a problem with my LXC container under centos. My DNS does not resolve the name.

Conversely on debian LXC container no worries.

/etc/hosts
Code:
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
# --- BEGIN PVE ---
192.168.2.223 try1.lan try1

/etc/sysconfig/network-scripts/ifcfg-eth0
Code:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.2.223
NETMASK=255.255.255.0
GATEWAY=192.168.2.254
DHCP_HOSTNAME=try1
DNS1=192.168.2.254

/etc/resolv.conf
Code:
# --- BEGIN PVE ---
search lan
nameserver 192.168.2.254
nameserver 208.67.220.220
nameserver 208.67.222.222
# --- END PVE ---

Can you help me ?
 
just to rule out the basics, are you able to ping your gateway and the DNS servers ?
 
Yes of course . I ping well my dns and gateway

For info all my LXC container under debian works correctly. (Same server, same network)
 
you can try to debug DNS queries with
dig google.com @ip_of_your_dns_server
 
I have no problem with external name. Just local names only on cento containers

Code:
; <<>> DiG 9.9.4-RedHat-9.9.4-38.el7_3.3 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24957
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;google.com.                    IN      A

;; ANSWER SECTION:
google.com.             300     IN      A       216.58.198.206
google.com.             300     IN      A       216.58.198.206
google.com.             300     IN      A       216.58.198.206

;; Query time: 26 msec
;; SERVER: 192.168.2.254#53(192.168.2.254)
;; WHEN: jeu. mai 04 23:45:20 UTC 2017
;; MSG SIZE  rcvd: 87
 
I found the "problem" with a lxc machine on centos. In dhcp it shares its name with DHCP / DNS all works. In ip static it does not share any info.