How to install and configure the Shorewall firewall in Linux

Source: Internet
Author: User
Article Title: install and configure the Shorewall firewall in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Environment Description: This machine only has one Nic and uses a static IP address to access the Internet.

Command: apt-get install shorewall ubuntu will automatically install it for you, but shorewall is neither configured nor started

「 1 」 first cp/usr/share/doc/shorewall/examples/one-interface/*/etc/shorewall

"2": Change/etc/shorewall. conf to STARTUP_ENABLED = No to STARTUP_ENABLED = Yes

"3": Change/etc/default/shorewall to startup = 0 to startup = 1.

"4" Run ifconfig to confirm that the default Nic name is eth0. Write down the NIC name

"5": Change/etc/shorewall/interfaces to net eth0 detect dhcp, tcpflags, logmartians, and eth0 in nosmurfs to your Nic name.

"6": Modify the/etc/shorewall/rules file to define the access rule. By default, the file allows local computers to access all external addresses, prohibit external computers from accessing this address. For example, if you open the ssh service and the port is 22, which of the following statements do you Want to allow others to access? Create a rule in ACCEPT $ FW net icmp?

ACCEPT net $ fw tcp 22. Here we will also briefly describe some of the rules. net represents an Internet computer. $ fw represents a local computer, that is, the firewall itself interprets ACCEPT net $ fw tcp 22, which means to allow the Internet to access the local machine (firewall) through the TCP protocol to access port 22. If it is disabled, it means DROP.

DROP net $ fw tcp 22 if it is to allow access from an IP address on the Internet, the rule can be written in this way.

ACCEPT net: 192.168.1.10 $ fw tcp 22

Shorewall start.

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.