Solved [ jail ] problems with DNS resolving/networking...

Hi,

I'm new to FreeBSD and jails... and I have difficulties with setting up networking inside a jail.

The jail management utility I use is ezjail. I tried different utilities (iocage, qjail, cbsd etc.) but without success.

My host system: FreeBSD 11.1-RELEASE-p10 #0: Tue May 8 05:21:56 UTC 2018 amd64

allow.raw_sockets=1 is enabled and I can ping inside of the jail, but whenever I want to install a package I get this message:

Code:
root@myjail:~ # ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1): 56 data bytes
64 bytes from 1.1.1.1: icmp_seq=0 ttl=57 time=10.819 ms
64 bytes from 1.1.1.1: icmp_seq=1 ttl=57 time=10.140 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=57 time=9.885 ms
^C
--- 1.1.1.1 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 9.885/10.281/10.819/0.394 ms
root@myjail:~ # pkg install vim
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:11:amd64/quarterly, please wait...
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:11:amd64/quarterly/Latest/pkg.txz: No address record
A pre-built version of pkg could not be found for your system.
Consider changing PACKAGESITE or installing it from ports: 'ports-mgmt/pkg'.
root@myjail:~ #

if I type ping + domain I get this output:

Code:
root@myjail:~ # ping freebsd.org
ping: cannot resolve freebsd.org: Host name lookup failure

This is what my /etc/resolv.conf file looks like:

Code:
# Generated by resolvconf
search fritz.box
nameserver 192.168.178.1
nameserver fd00::3631:c4ff:fe16:4369

nameserver 127.0.0.1
options edns0

thank you in advance
:)
 
The issue is clearly with /etc/resolv.conf because you get resolving issues. Check and verify if 192.168.178.1 is correct and can be reached from the jail. Remove the other IP addresses, at least for now. I'd also remove the edns0 option.
 
  • Thanks
Reactions: jdb
It still doesn't work... I switched over to iocage and deleted all of the other jail management utilities.

Now with iocage:

  • ping: EDIT: only IP adresses :/ but not hostnames
    Code:
    root@myjail:~ # ping freebsd.org ping: cannot resolve freebsd.org: Host name lookup failure
  • drill/dns: working :)
  • pkg: not working :(
I get this output when I want to install a package:

Code:
root@myjail:~ # pkg install vim
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:11:amd64/quarterly, please wait...
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:11:amd64/quarterly/Latest/pkg.txz: No address record
A pre-built version of pkg could not be found for your system.
Consider changing PACKAGESITE or installing it from ports: 'ports-mgmt/pkg'.

...and I get this output when I resolve pkg.freebsd.org

Code:
root@myjail:~ # drill pkg.freebsd.org
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 17211
;; flags: qr rd ra ; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;; pkg.freebsd.org.    IN    A

;; ANSWER SECTION:
pkg.freebsd.org.    300    IN    CNAME    pkgmir.geo.freebsd.org.
pkgmir.geo.freebsd.org.    150    IN    A    213.138.116.73

;; AUTHORITY SECTION:

;; ADDITIONAL SECTION:

;; Query time: 216 msec
;; SERVER: 192.168.178.1
;; WHEN: Thu Jun  7 19:19:43 2018
;; MSG SIZE  rcvd: 74
root@myjail:~ #
 
I finally got rid of the DNS resolving problem by removing the leading space before the nameserver definition in /etc/resolv.conf
 
Back
Top