From nobody@FreeBSD.org  Wed Nov 24 06:50:12 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id BC35F16A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Nov 2004 06:50:12 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8115A43D5A
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Nov 2004 06:50:12 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id iAO6oCCQ000621
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Nov 2004 06:50:12 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id iAO6oCfC000620;
	Wed, 24 Nov 2004 06:50:12 GMT
	(envelope-from nobody)
Message-Id: <200411240650.iAO6oCfC000620@www.freebsd.org>
Date: Wed, 24 Nov 2004 06:50:12 GMT
From: Juan Pablo Villa <juan@datafull.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: DNS resolver broken under certain jail conditions
X-Send-Pr-Version: www-2.3

>Number:         74314
>Category:       kern
>Synopsis:       [resolver] [jail] DNS resolver broken under certain jail conditions
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bz
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 24 06:50:21 GMT 2004
>Closed-Date:    Tue Nov 17 21:13:59 UTC 2009
>Last-Modified:  Tue Nov 17 21:13:59 UTC 2009
>Originator:     Juan Pablo Villa
>Release:        4.9-RELEASE-p13
>Organization:
Datafull.com
>Environment:
FreeBSD XXXXXX.datafull.com 4.9-RELEASE-p13 FreeBSD 4.9-RELEASE-p13 #0: Sat Nov 20 22:57:03 ART 2004     root@:/usr/obj/usr/src/sys/GENERIC  i386

Also tested this with 4.10-RELEASE, 4.9-RELEASE, and 4.10-STABLE this one built on Nov 19 2004 (approx.). I've enjoyed my weekend rebuilding world like crazy, looking to avoid this bug without any results.
>Description:
When creating new jails for mi internal network, I hit the following:

I have 2 ethernet interfaces, lets say dc0 and dc1.
dc0 has an ip public address, connected to the internet thru a default gw
dc1 has a private ip address (i.e. 10.3.2.102)

If I start the jail env with an aliased ip from dc0, everything works ok, just as usual.
However, using aliases from dc1, things are a little bit different, because the resolver seems broken from inside the jail. 
Netcat and UDP traffic in general to host/outside seems ok in both ways, but DNS lookups don't work anymore.

Dig lookups from inside the jail result in the following:

#dig freebsd.org

; <<>> DiG 8.3 <<>> freebsd.org
;; res options: init recurs defnam dnsrch
;; res_nsend: Operation timed out

or a similar res_nsend error. 

Looking on the internet, a similar case is described on: http://archive.pilgerer.org/mharc/html/freebsd-questions/2004-04/msg02948.html

I guess that using jail aliases within the same net as the default gw works, and the rest of aliases don't (the rest don't have a default gw on the same net, of course). Just guessing.
>How-To-Repeat:
1) Create a jail env, as explained on jail(8)
2) Create an alias on dc1 for the jail (i.e. ifconfig dc1 -alias 10.3.2.11 netmask 255.255.255.255). dc1 must not be your main interface
3) Copy a working /etc/resolv.conf from host to jail
4) Initialize jail with that previous ip alias (i.e. jail /usr/jail/ jail.datafull.com 10.3.2.11 /bin/sh)
5) dig freebsd.org
6) nc -u YOUR_DNS.com 53

>Fix:
Just guessing here: If normal UDP traffic is possible (as shown by netcat), then a temporary workaround would be to install a recursive dns like dnscache (on host, or could be on the jail too). Haven't tried yet.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-jail 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Fri Jan 25 22:01:54 UTC 2008 
Responsible-Changed-Why:  
Reassign to appropriate mailing list. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74314 
Responsible-Changed-From-To: freebsd-jail->bz 
Responsible-Changed-By: bz 
Responsible-Changed-When: Sat Nov 29 16:50:28 UTC 2008 
Responsible-Changed-Why:  
Sounds like a NAT or configuration error. 
Let's see if it's still relevant and if so if we can get more information. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74314 
State-Changed-From-To: open->feedback 
State-Changed-By: bz 
State-Changed-When: Tue Jan 6 17:48:21 UTC 2009 
State-Changed-Why:  
Asked if it still can be reproduced or if we can get more information. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74314 

From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
To: bug-followup@FreeBSD.org, juan@datafull.com
Cc:  
Subject: Re: kern/74314: [resolver] [jail] DNS resolver broken under certain
 jail conditions
Date: Tue, 6 Jan 2009 17:47:57 +0000 (UTC)

 Hi,
 
 is this still relevant these days, as in, can you still reproduce it?
 To me it sounds like a NAT/configuration error somewhere.
 
 If you can still reproduce there is a number of things to know:
 - where is your DNS servers from resolve.conf in and outside the IP --
    is there a local resolver in the base system or is it external
    resolvers?
 - can you get tcpdumps of the packets to see how they go out and
    possibly see answers coming back from the base system?
 - ...
 
 -- 
 Bjoern A. Zeeb                      The greatest risk is not taking one.
State-Changed-From-To: feedback->closed 
State-Changed-By: bz 
State-Changed-When: Tue Nov 17 21:13:45 UTC 2009 
State-Changed-Why:  
Feedback timeout. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74314 
>Unformatted:
