Test the nat translation of the firewall using linux and xp in the vmwarevm Environment

Source: Internet
Author: User

Test the nat translation of the firewall using linux and xp in the vmwarevm Environment


① The topology is set up. Two NICs are allocated to the linux system. One Nic is in the Vware3 subnet, the other is in the Vware2 subnet, And the NIC of the ftp server is allocated to the Vware3 subnet, assign the NIC of a host on the Internet to the Vware2 subnet.





Create two interfaces for linux. The IP address of one interface is 202.1.1.1, And the IP address of the other interface is 192.168.1.1.





Configure an IP address for the server in the CIDR Block 202.1.1.0/24 and an IP address for the Intranet host. The IP address is in the CIDR Block 192.168.1.0/24.



Now, the linux route function code is echo '1'>/proc/sys/net/ipv4/ip_forward.

Ping the server from an intranet host to test whether the connection is successful.

Configure Firewall rules now
# Loading the ftp forwarding Module
Modprobe ip_nat_ftp
Modprobe ip_conntrack_ftp
# Clear previous settings
Iptables-F
Iptables-F-t mangle
Iptables-F-t nat
# Set the filter table preset Policy
Iptables-P INPUTDROP
Iptables-P OUTPUT DROP
Iptables-P FORWARDDROP
# Start internal external Address Transfer
Iptables-t nat-a postrouting-o eth1-s 192.168.1.0/24-j SNAT -- to-source 202.1.1.1
# Set forwarding rules for FORWARD
Iptables-a forward-I eth0-o eth1-p tcp-d 202.1.1.2 -- dport 21-j ACCEPT
Iptables-a forward-I eth0-o eth1-p tcp-d 202.1.1.2 -- dport 20-j ACCEPT
# Set to allow established and related data to pass the FORWARD chain
Iptables-a forward-s 202.1.1.2-m state--state established, related-j ACCEPT
Now, ping the server on the Intranet host to test whether the connection is successful.

At this time, the following problems may occur when accessing the ftp server through the Intranet.

Solution: Open the client's internet browser, select Tools, select internet Options, select Advanced, deselect "use Passive ftp", and test again.

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.