FreeBSD新的JAIL管理工具QJAIL

    一般而言,使用FreeBSD的大家都知道,jail是FreeBSD的重要组成部分,而要方便的使用jail,则不得不提ezjail,warden这两样神器。当然,正常来说ezjail用得比较广泛,而warden是PC-BSD的东西也是图形化的产物。

    使用过ezjail的大神们都知道,要使用ezjail是需要主系统配合的,也就是需要主系统拥有系统原代码也就是有/usr/src这个目录 ,然后再使用make buildworld这个命令编译出内核后,才能使用ezjail创建新的jail。哦,还忘记了两点。

  • 要在/etc/rc.conf中为jail分配IP
  • 需要配置row_socket,不然jail不能访问外网

    当然,以上两点虽然麻烦但还是好说,那个make buildworld就有点受不了了。机器慢点要编译一天,而且每次系统有更新就要再来一次(如果需要jail保持最新版本)。而warden的话就好多了,warden的基系统不是编译而是从网上下载的,这个听起来是不是有点像docker?好吧,warden只能在PC-BSD中使用。

    然而现在,FreeBSD 11 发布后,情况有所改变,FreeBSD 11中新增加了一个jail管理工具,叫QJAIL。这个工具更加简化了jail的管理。哦,当然,QJAIL只能在FreeBSD 11中安装使用。下面说一下基本用法:

1. 安装

    安装没有什么好说的,我用的是PKG来安装的,安装命令是:

pkg install qjail

2. 初始化

   首先需要初始化基础系统,这里和ezjail有不同的地方,ezjail是要buildworld,但是qjail和warden一样,是从网上下载二进制包,再进行解压的。命令如下:

qjail install

输入完命令后:

下载完成后:

3. 创建jail

  初始化qjail后,可以进行jail的安装,使用命令:

qjail create -4 192.168.88.240 postgresql

以下可以看到已经建立好了叫postgresql的jail:

4. 允许ping外网

    在这个时候,其实jail还是不能从里面进行ping操作,但是在外面可以ping这个jail。如图:

    但是jail里面不行,如图:

这个时候,就要使用命令:

qjail config -k postgresql

记得小k代表启动row_socket,大K代表禁用row_socket,而且要在jail停止的情况下可以配置。如图:

5.后续

    这个就是qjail的最基础用法了,是不是比ezjail要简单一些。哦,对了忘记说了,使用qjail创建的jail,默认是继承了主系统的一些配置,如:网关,路由和DNS,生产的jail天生就配置好了dns,而不用像ezjail那样还要自己再配置一遍,或者是使用新模板。

转载于:https://my.oschina.net/jktantan/blog/1547483

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
The critically-acclaimed FreeBSD guide, now expanded, revised, and updated! FreeBSD is the muscle behind companies from Netflix to EMC. Any place where someone does heavy lifting on the Internet, you’ll find FreeBSD. Absolute FreeBSD brings FreeBSD’s strengths to bear on your problems. Absolute BSD taught new sysadmins how to build and manage a FreeBSD server. Absolute FreeBSD dove deep into server management, taking you beyond just making things work and into understanding why they work. This third edition of Absolute FreeBSD updated all that knowledge and covers FreeBSD’s newest features. You’ll learn: How to best install FreeBSD to meet your needs Which filesystem to use in your environment How to back up and restore critical data When and how to tweak the kernel, and when not to Network configuration, from activating interfaces to selecting congestion control algorithms Managing both UFS and ZFS, as well as FreeBSD’s other important filesystems FreeBSD’s software packaging system, including how to build your own package repository How and when to upgrade How to build your own FreeBSD Advanced security features like blacklistd and packet filtering Monitoring and Adjusting Performance Container-style virtualization with jails Diskless systems Panic management and bug reporting New readers will still get the solid introduction they need, but fans of the earlier editions will expand their skills still further. All in the inimitable style that has made Lucas’ system administration books so popular.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值