Get the App
SLTechnology News&Howtos  ›  Servers  › 

CentOS 7.4 enables remote access with Iptables

Shulou Source: shulou.com Published: 2022-06-02 19:29:11 09月22日 Update

CentOS 7 uses firewall as its firewall by default. Install iptables Firewall first.

1. Close firewall:

Systemctl stop firewalld.service

Systemctl disable firewalld.service

Systemctl mask firewalld.service

2. Install iptables firewall

Yum install iptables-services-y

3. Start the setup firewall

# systemctl enable iptables

# systemctl start iptables

4. View firewall status

Systemctl status iptables

5 Editing the firewall and adding ports

Vi / etc/sysconfig/iptables # Editing Firewall profile

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

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

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

: wq! # Save exit

3. Restart the configuration, restart the system

Systemctl restart iptables.service # restart the firewall to make the configuration effective

Systemctl enable iptables.service # set the firewall to boot

Tags: Firewall Fire Protection configuration File status Port system Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei vpn Shulou Technology Xiaomi Apple