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.