0
点赞
收藏
分享

微信扫一扫

redhat6访问控制

redhat6访问控制

应用环境:客户因安全要求限制访问设备。

准备设备:

服务器1:10.163.6.130

服务器2:10.163.6.131

测试需求:

端口1:8080 应用端口

端口2:55555 ssh端口

需求1:允许10.163.6.130访问10.163.6.131设备8080端口。

需求2:允许10.163.6.130访问10.163.6.131设备55555端口。

10.163.6.130配置:
启用防火墙:

service iptables start

限制远程端口以及保存配置:

[root@localhost ~]# iptables -I INPUT -s 192.168.25.130 -p tcp --dport 8080 -j ACCEPT [root@localhost ~]# iptables -I INPUT -s 192.168.25.130 -p tcp --dport 55555 -j ACCEPT [root@localhost ~]# /etc/rc.d/init.d/iptables save iptables:将防火墙规则保存到 /etc/sysconfig/iptables: [确定]

修改ssh22端口为55555:

修改:#Port 22 为:Port 55555

重启ssh服务:

[root@localhost ~]# /etc/init.d/sshd restart 停止 sshd: [确定] 正在启动 sshd: [确定]

测试:

[root@localhost ~]# ssh -p 55555 root@192.168.25.131 root@192.168.25.131's password: Last login: Sun May 28 01:02:32 2023 from 192.168.25.1 [root@localhost ~]#

登陆成功

备注:因为未搭建8080服务跳过测试了,已测试其它服务器远程失败。

如果对您有所帮助请《点赞》、《收藏》、《转发》,您的支持是我持续更新的动力,有疑问请留言

举报

相关推荐

0 条评论