CentOS 7 Linux iptables 开放端口映射

CentOS 7 Linux iptables 开放端口映射/bin/systemctlstop firewalld.servicesystemctldisablefirewalld.serviceyuminstalliptables-servicesPackageiptables-services-1.4.21-17.el7.x86_64alreadyinstalledandlatestversionvi/e…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

/bin/systemctl stop  firewalld.service

systemctl disable firewalld.service

yum install iptables-services

Package iptables-services-1.4.21-17.el7.x86_64 already installed and latest version

vi /etc/sysconfig/iptables

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

/bin/systemctl start  iptables.service

systemctl enable iptables.service

iptables -L

yum install nc

nc 106.14.21.223 6070

rpm –q telnet-client

 

[root@iZuf6492eksiqtd5hy86f8Z pay]# iptables -t nat -A PREROUTING -p tcp –dport 80 -j REDIRECT –to-port 8080  

[root@iZuf6492eksiqtd5hy86f8Z pay]# iptables -t nat -A PREROUTING -p tcp –dport 16070 -j REDIRECT –to-port 6070  

[root@iZuf6492eksiqtd5hy86f8Z pay]# service iptables save

iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]

 

service iptables status

/bin/systemctl restart  iptables iptables.service

/bin/systemctl start  iptables iptables.service

/bin/systemctl stop  iptables iptables.service

#查看已经开放的端口

[root@localhost bin]# netstat -tln

#查看网络连接

netstat -apn

#查看端口使用情况

[root@localhost bin]# lsof -i:3306

COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

mysqld  2728 mysql   30u  IPv6  27628      0t0  TCP *:mysql (LISTEN)

lsof -i TCP| fgrep LISTEN

[root@localhost bin]# netstat -anlp | grep 3306

tcp6       0      0 :::3306                 :::*                    LISTEN      2728/mysqld         

unix  3      [ ]         STREAM     CONNECTED     33068    3360/pulseaudio 

[root@localhost bin]# nc -lp 9393 &

[root@localhost bin]# netstat -an | grep 9393

tcp        0      0 0.0.0.0:9393            0.0.0.0:*               LISTEN     

tcp6       0      0 :::9393                 :::*                    LISTEN

vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 9393 -j ACCEPT

[root@localhost nescafe]# /bin/systemctl start  firewalld.service

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

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/179200.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 2021软件测试面试题及答案_2021年软件测试面试题大全

    2021软件测试面试题及答案_2021年软件测试面试题大全1.数据库增删改查基本上查询考的比较多,也有考察新增,修改,删除的,极个别的会给出表结构,字段要求,让你据此建表以及临时表查询语句主要考察子查询,聚合函数,多表查询,分组,可参考下面链接(sql50题)sql50题插入语句insertinto[table]([column],[column])values(?,?)删除语句deletefrom[table]wherecolumn=?修改语句update[table]setcolumn=?wherec

    2022年8月26日
    6
  • 数字通信系统的模型 框图「建议收藏」

    数字通信系统的模型 框图「建议收藏」1.2.

    2022年4月19日
    253
  • 原则干货存起来

    关键的设计原则在开始设计之前,思考一下关键的原则,将会帮助你创建一个最小花费、高可用性和扩展性的架构。分离关注点,将应用划分为在功能上尽可能不重复的功能点。主要的参考因素就是最小化交互,高内聚、低

    2021年12月23日
    48
  • 请描述django模板中标签的作用?_抽奖券模板

    请描述django模板中标签的作用?_抽奖券模板常用的模板标签if标签if标签相当于Python中的if语句,有elif和else相对应,但是所有的标签都需要用标签符号({%%})进行包裹。if标签中可以使用==、!=、<、<=、&

    2022年7月29日
    6
  • 大整数乘法python3实现

    大整数乘法python3实现由于python具有无限精度的int类型,所以用python实现大整数乘法是没意义的,但是思想是一样的。利用的规律是:第一个数的第i位和第二个数大第j位相乘,一定累加到结果的第i+j位上,这里是从0位置开始算的。代码如下:importsysdeflist2str(li): whileli[0]==0: delli[0] res=” foriinli: res+

    2022年6月2日
    32
  • mysql删除约束

    mysql删除约束1、删除notnull约束altertable表名modify列名类型;2、删除unique约束altertable表名dropindex唯一约束名;3、删除primarykey约束altertable表名dropprimarykey;4、删除foreignkey约束altertable表名dropforeignkey外键名;…

    2022年6月24日
    26

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

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