RHEL6.1防火墙配置——以Webmin为例

Configuring Your RHEL Firewall For Webmin

本文以RHEL6.1为实例,详细讲述了Webmin在RHEL6.1中的安装和配置过程。
着重描述了防火墙规则的设置。

Many operating systems block access to port 10000 by default,

#主要包括RHEL、CentOS。

#不包括ubuntu

as they have a firewall activated as part of the installation process. This may prevent you from logging into http://yourserver:10000/

#RHEL6.1中默认情况下(无DNS,没有修改hosts文件)

#可能不能用主机名称代替localhost,

#使用https://localhost:10000/代替http://yourservername:10000/ 。

#原因如下:

#hosts文件没有解释主机名称

实例:

[root@dgdrhelsrv Downloads]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@dgdrhelsrv Downloads]#
 

from another system on your network or over the Internet.

The simplest way to open up port 10000 is to use one of the Webmin firewall management modules, such as Linux Firewall, BSD Firewall or IPFilter Firewall. However, to access this you'll need to run a brower on the same system as Webmin, and access it via the URL http://localhost:10000/.

The alternative is to login as root via SSH, and manually edit the firewall configuration file. On Redhat and derived systems, this is /etc/sysconfig/iptables, while on Debian it is /var/lib/iptables. The line you need to add is :

#命令参考如下

su -

vim vim /etc/sysconfig/iptables

编辑如下:

#需要注意的是,要在COMMIT行前添加一个新行。

-A INPUT -p tcp -m tcp --dport 10000 -j ACCEPT

/etc/init.d/iptables restart

exit

#实例:


[dgd@dgdrhelsrv Downloads]$ su root
Password:
[root@dgdrhelsrv Downloads]# rpm -i webmin-1.570-1.noarch.rpm
warning: webmin-1.570-1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 11f63c51: NOKEY
Operating system is Redhat Enterprise Linux
Webmin install complete. You can now login to https://dgdrhelsrv:10000/
as root with your root password.

[root@dgdrhelsrv Downloads]# vim /etc/sysconfig/iptables
[root@dgdrhelsrv Downloads]# /etc/init.d/iptables restart
iptables: Flushing firewall rules:                               [  OK  ]
iptables: Setting chains to policy ACCEPT: filter    [  OK  ]
iptables: Unloading modules:                                     [  OK  ]
iptables: Applying firewall rules:                               OK  ]
[root@dgdrhelsrv Downloads]#


It should be added in the file just after similar lines which grant access to ports 80, 22 and so on.

#这就是为什么要在COMMIT行前添加的原因。

Once this line has been added, you will need to apply the firewall configuration. This is typically done with the command /etc/init.d/iptables restart .

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值