linux 查看1521端口状态,linux防火墙开放1521端口

linux 查看1521端口状态,linux防火墙开放1521端口问题描述:使用plsql连接数据库发现TNS报错,登录服务器发现防火墙开放,如果直接关闭防火墙,所有的端口都可以连接,但是实际中可能会遇到开启防火墙的库,这时候需要开放单一端口对某一服务器或者某一网段1.开放1521端口对所有服务器vi/etc/sysconfig/iptables-AINPUT-mstate–stateNEW-mtcp-ptcp–dport1521-…

大家好,又见面了,我是你们的朋友全栈君。

问题描述:使用plsql连接数据库发现TNS报错,登录服务器发现防火墙开放,如果直接关闭防火墙,所有的端口都可以连接,但是实际中可能会遇到开启防火墙的库,这时候需要开放单一端口对某一服务器或者某一网段

92f10edd9c58eaeb160bc43b77b0ac79.png

1.开放1521端口对所有服务器

vi /etc/sysconfig/iptables

-A INPUT -m state –state NEW -m tcp -p tcp –dport 1521 -j ACCEPT

这句要放在 -A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT 后面,要不然不生效

69093a23a0f8132bfad26415ea04ab51.png

重启防火墙

[root@orcl ~]# service iptables restart

iptables: Setting chains to policy ACCEPT: filter [ OK ]

iptables: Flushing firewall rules: [ OK ]

iptables: Unloading modules: [ OK ]

iptables: Applying firewall rules: [ OK ]

[root@orcl~]# service iptables status

Table: filter

Chain INPUT (policy ACCEPT)

num target prot opt source destination1 ACCEPT all — 0.0.0.0/0 0.0.0.0/0state RELATED,ESTABLISHED2 ACCEPT icmp — 0.0.0.0/0 0.0.0.0/0

3 ACCEPT all — 0.0.0.0/0 0.0.0.0/0

4 ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22

5 ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:1521

6 REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)

num target prot opt source destination1 REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)

num target prot opt source destination

2.开放1521端口给指定网段,添加的指定IP,但是识别的是子网内的所有IP,其他同网段的IP都可以访问。如果去掉/24,指定IP的话,就访问不了。怎么指定单一端口给某一服务器?

-A INPUT -s 192.168.163.6/24 -p tcp -m tcp –dport 1521 -j ACCEPT

[root@orcl ~]# vi /etc/sysconfig/iptables

[root@orcl~]# service iptables restart

iptables: Setting chains to policy ACCEPT: filter [ OK ]

iptables: Flushing firewall rules: [ OK ]

iptables: Unloading modules: [ OK ]

iptables: Applying firewall rules: [ OK ]

[root@orcl~]# service iptables status

Table: filter

Chain INPUT (policy ACCEPT)

num target prot opt source destination1 ACCEPT all — 0.0.0.0/0 0.0.0.0/0state RELATED,ESTABLISHED2 ACCEPT icmp — 0.0.0.0/0 0.0.0.0/0

3 ACCEPT all — 0.0.0.0/0 0.0.0.0/0

4 ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22

5 ACCEPT tcp — 192.168.163.0/24 0.0.0.0/0 tcp dpt:1521

6 REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)

num target prot opt source destination1 REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)

num target prot opt source destination

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/132627.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

  • mina框架是什么意思(个人年度总结框架)

    参考:http://xinsync.xju.edu.cn/index.php/archives/category/prglang/java/mina简单介绍:MINA框架是对java的NIO包的一个封装,简化了NIO程序开发的难度,封装了很多底层的细节,然开发者把精力集中到业务逻辑上来,最近做了一个相关的项目,为了备忘对MINA做一个总结。下面这个start方法用来初始化MINA:priv…

  • EtherCAT总线通信Freerun、SM、DC三种同步模式分析

    EtherCAT总线通信Freerun、SM、DC三种同步模式分析EtherCAT总线三种同步模式分析一、分布式时钟作用使所有EtherCAT设备使用相同的系统时间,从而控制各设备任务的同步执行。二、名词解析1、 现场总线高速数据传递:即主站周期的向从站发送输出信息并周期地读取从站的输入信息2、 OutputValid:输出有效,指的是主站输出有效,表示的是从站将数据帧中对应数据从同步管理器通道上下载下来的一个过程。3、 InputLatch…

  • [Arm]使用modprobe时 “modprobe: can‘t change directory to …”

    [Arm]使用modprobe时 “modprobe: can‘t change directory to …”最近在加载一个叫dmatest的模块时,报错modprobe:can’tchangedirectoryto’…’:Nosuchfileordirectory,做一个问题记录。首先,modprobe的解释:modprobe是linux的一个命令,可载入指定的个别模块,或是载入一组相依的模块。modprobe会根据depmod所产生的相依关系,决定要载入哪些模块。若…

    2022年10月28日
  • python fill函数填充_python开始填充

    python fill函数填充_python开始填充摘要:这篇Python开发技术栏目下的“pythondataframe向下向上填充,fillna和ffill的方法”,介绍的技术点是“DataFrame、fillna、Python、ffill、_和__、填充”,希望对大家开发技术学习和问题解决有帮助。今天小编就为大家分享一篇pythondataframe向下向上填充,fillna和ffill的方法,具有很好的参考价值,希望对大家有所帮助。一起…

  • Nginx的 HTTP 499 状态码处理

    Nginx的 HTTP 499 状态码处理

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号