Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 www.google.com :

;; 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
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
xn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=503<RXCSUM,TXCSUM,TSO4,LRO>
        ether 12:31:39:1c:f0:bf
        inet 192.168.1.101 netmask 0xffffffff broadcast 192.168.1.101
        inet 192.168.1.102 netmask 0xffffffff broadcast 192.168.1.102
        inet 10.110.238.77 netmask 0xfffffe00 broadcast 10.110.239.255
        inet 10.0.0.1 netmask 0xffffffff broadcast 10.0.0.1
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        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.
ifconfig_xn0="DHCP"

### Standard FreeBSD configuration from here onwards.
sshd_enable="YES"
ezjail_enable="YES"

#for custom configs I hand made
ifconfig_xn0_alias0="inet 192.168.1.101/32"
ifconfig_xn0_alias1="inet 192.168.1.102/32"

pf_enable="YES"

cat /etc/pf.conf gives me:

ext_if="xn0" ##my network interface
MY_JAIL="10.0.0.1"
#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
add comment

1 Answer

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
ie.
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 ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.1-release/Latest/portup‌​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 ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-current/Latest 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
add comment

Your Answer

 
discard

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.