How Linux firewalls should be set up

Source: Internet
Author: User
Tags iptables ssh port

Question: As a result of scientific research requirements, most of our department did not use Windows system, and the use of Linux, is not accustomed to boot is a dark interface, like the legendary DOS. Fortunately, the scientific research of those software has instructions, but the firewall on Linux did not mention, I am very worried about the worm or backdoor intrusion, how to start it?

Answer: Because you did not say which Linux distribution, but the bottom of the Linux basic things are the same, so small to give you the method for the vast majority of distributions are effective. Linux itself has a firewall named "Iptables". The Dark One you said is the terminal. Enter the following command in the terminal to open the firewall:

Chkconfig iptables on

If the firewall is closed, enter:

Chkconfig iptables off

All two of these commands have to be restarted for the system to take effect.

You can use the service command if you do not want to take effect immediately by restarting the system. The disadvantage is that the settings will be lost when you reboot the system.

Firewall turned on:

Service Iptables Start

To turn off the firewall:

Service Iptables Stop

To set a switch on some ports in the firewall, modify the edit/etc/sysconfig/iptables file, such as SSH Port 22, which can be added as follows:

-A rh-firewall-1-input-m state――state new-m tcp-p tcp――dport 22-j ACCEPT

In short, "ptables" function is very powerful, here can not be said clearly, specifically please refer to the "ptables" information.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.