Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I posted on the freebsd forums. I've been trying all night and I've made some progress but still I can't connect to the internet from my freebsd jail.

Please just give me a hint here.

I get the following inside the jail if I do nslookup :

;; connection timed out; no servers could be reached

So, I can't seem to install stuff inside the jail. OR, is there any way I can install perl and starman on my host system and copy it into the jail?? In the end I just need this stuff installed and then I want my jail off the internet.

I tried various things, from the plain (1) jail command, (2) ezjail and finally (3) qjail. Also did a clean checkout of the freebsd source and did a buildworld.

This is my network config ifconfig -a:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
        inet netmask 0xff000000
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
xn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 12:31:39:1c:f0:bf
        inet netmask 0xffffffff broadcast
        inet netmask 0xffffffff broadcast
        inet netmask 0xfffffe00 broadcast
        inet netmask 0xffffffff broadcast
        media: Ethernet manual
        status: active

This is the rest of my system:

cat /etc/rc.conf gives me :

# EC2 uses DHCP; the network interface appears as xn0.

### Standard FreeBSD configuration from here onwards.

#for custom configs I hand made


cat /etc/pf.conf gives me:

ext_if="xn0" ##my network interface
#redirect http traffic to daltons jail
rdr pass on $ext_if inet proto tcp to port http -&gt; $MY_JAIL port http
#enable outgoing traffic from jail to the internet via NAT
nat on $ext_if from $MY_JAIL to any -&gt; $ext_if

Any ideas, clues or hints?!

share|improve this question
Did you copy /etc/resolv.conf from the host to the jail? – Chris S Feb 24 '13 at 6:31
@ChrisS yes I did for all of them, the ones I created with ezjail and qjail. – gideon Feb 24 '13 at 6:36
Yep. Double checked : -rw-r--r-- 1 root wheel 70 Feb 24 03:14 resolv.conf – gideon Feb 24 '13 at 6:47
up vote 2 down vote accepted

Sorry, got hung up on the connectivity issue and didn't realize you just want to install ports.

On the host system install PortUpgrade, it's much easier than fetching package deficiencies manually:

pkg_add -r portupgrade

Then use it to fetch the packages:

portupgrade -NRFPP $PKG_NAME
portupgrade -NRFPP lang/perl5.14

The package files will be dumped in the hosts /usr/ports/packages/All. Copy them to the jail(s). Install from jail:

pkg_add /path/to/file/downloaded/perl5.14.tgz

And Bob's your uncle.

I sometimes use unionfs so that the jails have the Package directory of the host; removes the copy step. UnionFS doesn't work on ZFS however (ZFS doesn't have Whiteout). And ZFS's snapshot/clone feature makes jails easier.

share|improve this answer
hey but how would I access the host from the jail? I would have to copy the package into the basejail first and then do pkg_add right? – gideon Feb 24 '13 at 6:59
Also, doing a pkg_add -r portupgrade gives me : Error: Unable to get‌​grade.tbz: File unavailable (e.g., file not found, no access) Ok, I guess I can install portupgrade with portmaster – gideon Feb 24 '13 at 7:01
Hrm, going to take some stick poking I guess. Try setenv PACKAGESITE then the pkg_add command. You can't access the host from the jail (the point of jails). You have to run each command on either the host or the jail. It's 2AM my time, sorry heading to bed. – Chris S Feb 24 '13 at 7:11
Thank you for your reply :) Yea I'm getting it installed with portmaster. What I mean't is, first I will do portupgrade -NRFPP lang/perl5.14 on the host which will download on the host. I will then copy this file into the basejail created by qjail and then inside the jail I will do pkg_add /path/to/file/downloaded/perl5.14.tgz right? – gideon Feb 24 '13 at 7:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.