Three applications of Linux Firewall

Source: Internet
Author: User
Linux firewall's three applications-Linux Enterprise applications-Linux server application information. The following is a detailed description. [Guide] The iptables command is used to filter packets and perform NAT Network Address Translation as shown in the following man queries. This command is widely used, many applications on the network can be implemented.

The iptables command is used to filter packets and perform NAT Network Address Translation (Network Address Translation) as seen in man queries. This command has many applications, many applications on the network can be implemented.

Iptables-administration tool for IPv4 packet filtering and NAT

Application 1: allow computers on the regional network to share bandwidth (NAT) with a real IP Address)

Required devices: One Linux server and two network cards

Nic 1: eth0, use real IP address, Nic 2: eth1, use 192.168.1.254

Set: Write the following lines in/etc/rc. d/rc. local:

Echo "1">/proc/sys/net/ipv4/ip_forward

Modprobe ip_tables

Modprobe ip_nat_ftp

Modprobe ip_conntrack

Modprobe ip_conntrack_ftp

Iptables-t nat-a postrouting-o eth0-s 192.168.1.0/24-j MASQUERADE


Application 2: allow computers on the regional network to share bandwidth (NAT) with an ADSL)

This example is very similar to the previous example, but a certain setting must be modified.

Required devices: One Linux server and two network cards

Nic 1: eth0, use real IP address, Nic 2: eth1, use 192.168.1.254

Set: Write the following lines in/etc/rc. d/rc. local:

Echo "1">/proc/sys/net/ipv4/ip_forward

Modprobe ip_tables

Modprobe ip_nat_ftp

Modprobe ip_conntrack

Modprobe ip_conntrack_ftp

Iptables-t nat-a postrouting-o ppp0-s 192.168.1.0/24-j MASQUERADE


Application 3: allow external computers to access a server in the region Network)

This method protects internal servers.

Required devices: One Linux server and two network cards

Nic 1: eth0, use real IP address, Nic 2: eth1, use 192.168.1.254

Set: Write the following lines in/etc/rc. d/rc. local:

Echo "1">/proc/sys/net/ipv4/ip_forward

Modprobe ip_tables

Modprobe ip_nat_ftp

Modprobe ip_conntrack

Modprobe ip_conntrack_ftp

Iptables-t nat-a postrouting-o eth0-s 192.168.1.0/24-j MASQUERADE

Iptables-t nat-a prerouting-I eth0-p tcp-d real IP -- dport 80-j DNAT -- to-destination 192.168.1.13: 80

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.