From owner-freebsd-questions@FreeBSD.ORG Wed Nov 18 05:04:46 2009 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDE911065670 for ; Wed, 18 Nov 2009 05:04:46 +0000 (UTC) (envelope-from admik@b.admik.pp.ru) Received: from b.admik.pp.ru (b.admik.pp.ru [95.172.133.149]) by mx1.freebsd.org (Postfix) with ESMTP id C867A8FC08 for ; Wed, 18 Nov 2009 05:04:44 +0000 (UTC) Received: from b.admik.pp.ru (b.admik.pp.ru [95.172.133.149]) by b.admik.pp.ru (8.14.3/8.14.2) with ESMTP id nAI4maTf080388 for ; Wed, 18 Nov 2009 11:48:36 +0700 (KRAT) (envelope-from admik@b.admik.pp.ru) Received: (from admik@localhost) by b.admik.pp.ru (8.14.3/8.14.2/Submit) id nAI4macp080387 for questions@freebsd.org; Wed, 18 Nov 2009 11:48:36 +0700 (KRAT) (envelope-from admik) Date: Wed, 18 Nov 2009 11:48:36 +0700 From: Michael Svobodin To: questions@freebsd.org Message-ID: <20091118044836.GA70999@b.admik.pp.ru> References: <4B02A81F.1030101@shopzeus.com> <44tyws3n28.fsf@be-well.ilk.org> <4B02E742.4010705@shopzeus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B02E742.4010705@shopzeus.com> User-Agent: Mutt/1.4.2.3i Cc: Subject: Re: jail - beginner questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Nov 2009 05:04:46 -0000 On Tue, Nov 17, 2009 at 10:41:14PM +0430, Laszlo Nagy wrote: > My computer is a windows machine, with address 192.168.0.X > Then the FreeBSD host is actually a guest os running in wvmare. It has > address 192.168.37.133 > And finally, the vm1 jail should have 192.168.0.11 > > I don't know why 192.168.0.11 is not working for the jail. Anyway, if I > change the jail's address to 192.168.10.11 then > > /etc/rc.d/jail start vm1 > Starting jails: vm1.localdomain. > The address 192.168.0.11 must be assigned to a interface in the host FreeBSD. You can do it before starting the jail, or when the jail is being started. To assign the address before starting the jail do somthing like this: # ifconfig lnc0 alias 192.168.0.11/24 where lnc0 is the name of nic in the host FreeBSD And you can add to /etc/rc.conf: ifconfig_lnc0_alias0="inet 192.168.0.11/24" to assign the address then the host FreeBSD is booting. To assing the address when the jail is being started just add to /etc/rc.conf this: jail_vm1_interface="lnc0" This way is preferred. > Now the next question: how can I access the hosted (jailed) OS? I know > it is a dumb question, but I have no idea. I would like to: > > a.) run sshd in the jail > b.) login from the host to the jailed (hosted) OS > c.) install programs on the jail, configure them and finally > d.) use NATD to divert some pacakges from the host to the jail and back b.) 1. get the jails list: # jls JID IP Address Hostname Path 9 192.168.64.14 mx1.loc /store/jail/mx1 8 192.168.64.25 nslst.loc /store/jail/nslst 2. select required jail by JID, for example 9 for mx1.loc and do: # jexec 9 tcsh 3. you're in a.) Login inside the jail. Now add to /etc/rc.conf sshd_enable="YES" and execute: # /etc/rc.d/sshd start c.) When you're inside the jail you can install software like in the host system. You can use the pkg_add or the ports system. d.) It requires to use firewall either ipfw or pf. For example you can add to your /etc/pf.conf: nat on lnc0 from 192.168.0.11 to any -> 192.168.37.133 But the firewall requires more lines then this one to work correcly with all network traffic. And you have to know exactly what you want to get for using it. > > Probably this is what everybody does, so if you could point me to a > tutorial or something, I would appriciate it. > > Thanks, > > Laszlo > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"