Build a Linux Firewall and set a firewall for individual users

Source: Internet
Author: User
Build a Linux Firewall and set up a firewall for individual users-Linux Enterprise Application-Linux server application information. The following is a detailed description. As an example, we create a firewall for a common home user. Assume that the home user generally uses his computer for Internet browsing and email. All we need to do is allow all necessary connections to pass, and disable all irrelevant connections. The content of the firewall configuration file is as follows:


1 * filter
2: input drop [0: 0]
3: forward drop [0: 0]
4: output drop [0: 0]
5
6 # Allow local loopback connection
7-a input-I lo-j ACCEPT
8
9 # drop illegal connection
10-a input-m state -- state INVALID-j DROP
11-a output-m state -- state INVALID-j DROP
12-a forward-m state -- state INVALID-j DROP
13
14 # Allow all established and related connections
15-a input-m state -- state ESTABLISHED, RELATED-j ACCEPT
16-a output-m state -- state ESTABLISHED, RELATED-j ACCEPT
17
18 # DNS servers of the ISP that can be connected
19-a output-d 2.3.4.10-m state -- state NEW-p udp -- dport 53-o eth0-j ACCEPT
20-a output-d 2.3.4.11-m state -- state NEW-p udp -- dport 53-o eth0-j ACCEPT
21
22 # allow external connection to the Web server
23-a output-d 0/0-m state -- state NEW-p tcp -- dport http-o eth0-j ACCEPT
24-a output-m state -- state NEW-p tcp -- dport https-o eth0-j ACCEPT
25
26 # allow external connections to the SMTP and POP3 servers of the ISP
27-a output-d 2.3.4.5-m state -- state NEW-p tcp -- dport smtp-o eth0-j ACCEPT
28-a output-d 2.3.4.5-m state -- state NEW-p tcp -- dport pop3-o eth0-j ACCEPT
29
30 # record other external connections
31-a output-o eth0-j LOG
32 # DROP external connection by default
33
34 COMMIT

The meaning of a specific command line can be easily understood by referring to the above, which is not described here. In fact, as long as we are familiar with the firewall settings in a specific environment, we can easily create corresponding firewalls for other application environments.

Prepared remarks:

Here, we introduce how to use iptables to create a firewall in Linux. In fact, due to different requirements, there is no complete firewall guide. We can only learn the basic concepts and terms on our own.

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.