CentOS 7.4利用Iptables开启远程访问

发布时间:2020-07-08 07:07:42 作者:chinafboy
阅读:1098
Centos服务器限时活动,0元免费领! 查看>>

CentOS 7默认使用的是firewall作为防火墙,首先安装iptables防火墙。

1、关闭firewall:

systemctl stop firewalld.service

systemctl disable firewalld.service

systemctl mask firewalld.service

2、安装iptables防火墙

yum install iptables-services -y

CentOS 7.4利用Iptables开启远程访问

3.启动设置防火墙

# systemctl enable iptables

# systemctl start iptables

4.查看防火墙状态

systemctl status iptables

CentOS 7.4利用Iptables开启远程访问

5编辑防火墙,增加端口

vi /etc/sysconfig/iptables #编辑防火墙配置文件

CentOS 7.4利用Iptables开启远程访问

-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

:wq! #保存退出

3.重启配置,重启系统

systemctl restart iptables.service #重启防火墙使配置生效

systemctl enable iptables.service #设置防火墙开机启动

CentOS 7.4利用Iptables开启远程访问

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读:
  1. Centos 7.4中的远程访问控制
  2. CentOS 7.3上安装shadowsocks遇到的坑

开发者交流群:

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

it运维 centos 云服务

上一篇:VC自绘控件框架

下一篇:将SpringCloud ConfigServer持久化存储改为MySQL

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》
开发者交流群×