论坛风格切换切换到宽版
  • 746阅读
  • 8回复

[问题求助][RedHat] 想用iptables限制只能内网的地址才能用ssh服务,能实现吗? [复制链接]

上一主题 下一主题
离线kekehsu.
 
发帖
2147
C币
-193213
威望
407
贡献值
1
银元
-3
铜钱
4694
人人网人气币
0
只看楼主 倒序阅读 使用道具 楼主  发表于: 2009-05-01
如题,不知道.iptables能.不能做到这一点,版主老大看看行得通不.

评价一下你浏览此帖子的感受

精彩

感动

搞笑

开心

愤怒

无聊

灌水
离线magicworm.
发帖
1957
C币
-199353
威望
335
贡献值
1
银元
-1
铜钱
4296
人人网人气币
0
只看该作者 沙发  发表于: 2010-04-13
Re:[RedHat]
楼上的哥哥,能给个具体语句吗?

离线八爪鱼.
发帖
2055
C币
-193375
威望
397
贡献值
1
银元
0
铜钱
4633
人人网人气币
0
只看该作者 板凳  发表于: 2010-04-13
Re:[RedHat]


QUOTE:原帖由 storysky 于 2009-2-27 16:08 发表
如题,不知道iptables能不能做到这一点,版主老大看看行得通不

用tcpwarpper更好的

离线yahaba88.
发帖
2115
C币
-235507
威望
411
贡献值
1
银元
-2
铜钱
4751
人人网人气币
0
只看该作者 地板  发表于: 2010-04-13
Re:[RedHat]
谁能给个具体的实现办法?

发帖
1962
C币
-193675
威望
342
贡献值
1
银元
0
铜钱
4344
人人网人气币
0
只看该作者 4楼 发表于: 2010-04-13
Re:[RedHat]
[root@nihao ~]# more /etc/hosts.deny
#
# hosts.deny    This file describes the names of the hosts which are
#               *not* allowed to use the local INET services, as decided
#               by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow.  In particular
# you should know that NFS uses portmap!
  sshd: ALL : deny
[root@nihao ~]# more /etc/hosts.allow
#
# hosts.allow   This file describes the names of the hosts which are
#               allowed to use the local INET services, as decided
#               by the '/usr/sbin/tcpd' server.
#
sshd: 192.168.0.230 :allow
这里写允许的ip或者网段

离线2006195113.
发帖
2126
C币
-235311
威望
395
贡献值
1
银元
0
铜钱
4650
人人网人气币
0
只看该作者 5楼 发表于: 2010-04-13
Re:[RedHat]


QUOTE:原帖由 gilet 于 2009-2-27 16:47 发表
[root@nihao ~]# more /etc/hosts.deny
#
# hosts.deny    This file describes the names of the hosts which are
#               *not* allowed to use the local INET services, as decided
#         ...

谢谢这位仁兄,请问如果输入网段要加子网掩码吗?怎么加掩码?

[ 本帖最后由 storysky 于 2009-2-27 16:55 编辑 ]

离线realrocking.
发帖
2038
C币
-60792
威望
382
贡献值
1
银元
-2
铜钱
4596
人人网人气币
0
只看该作者 6楼 发表于: 2010-04-13
Re:[RedHat]
不客气

发帖
2095
C币
-193313
威望
380
贡献值
1
银元
-1
铜钱
4709
人人网人气币
0
只看该作者 7楼 发表于: 2010-04-13
Re:[RedHat]
iptables -A INPUT -p tcp -s 192.168.0.0/24 --destination-port 22 -j ACCEPT
iptables -A INPUT -p tcp -s 192.168.1.0/24 --destination-port 22 -j ACCEPT
iptables -A INPUT -p tcp -s ! 127.0.0.1 --destination-port 22 -j DROP


发帖
2242
C币
-553427
威望
419
贡献值
2
银元
0
铜钱
4762
人人网人气币
0
只看该作者 8楼 发表于: 2010-04-13
Re:[RedHat]


QUOTE:原帖由 storysky 于 2009-2-27 16:50 发表

谢谢这位仁兄,请问如果输入网段要加子网掩码吗?怎么加掩码?

用/
快速回复
限100 字节
如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
 
上一个 下一个