I 'd like to ask you a little question about IPTABLES. Thank you!

Source: Internet
Author: User
I 'd like to ask you a little question about IPTABLES. Thank you! -- Linux Enterprise Application-Linux server application information. For details, refer to the following section. I have been studying IPTABLES over the past few days because I plan to use it as the company's soft route. After a long-term study of theoretical knowledge (despite a headache), the actual combat started yesterday morning and continued until now. The battle was fierce and it was a time of intense competition, iptables suffered a loss, and we were almost defeated. Instead, I went to the Forum to help the rescue. I hope you would give me some advice. Here, I would like to thank you all.
Next, I will first introduce the situation:
I plan to merge iptables and squid, both firewall and transparent proxy. I fought against iptables first, conquered iptables, and then stepped onto squid.
CENTOS5.2 (final) 2.6.18-92. el5
Two thousand MB Nic, eth0: Intranet, 192.168.1.1/24, eth1: Internet, x. x. And there is no physical damage.
Here are my tips:
Vi/etc/sysctl. conf
Change net. ipv4.ip _ forward = 0 to 1 to enable forwarding.
Cat/proc/sys/net/ipv4/ip_forward
1 #1 is displayed.
Modprobe ip_tables
Modprobe ip_nat_ftp
Modprobe ip_nat_irc
Modprobe ip_conntrack_ftp
Modprobe ip_conntrack_irc
Iptables-F
Iptables-X
Iptables-Z
Iptables-F-t nat
Iptables-X-t nat
Iptables-Z-t nat
Iptables-P INPUT DRPO
Iptables-P OUTPUT ACCEPT
Iptables-P FORWARD ACCEPT
Iptables-t nat-P PREROUTING ACCEPT
Iptables-t nat-P POSTROUTING ACCEPT
Iptables-t nat-P OUTPUT ACCEPT
Iptables-t nat-a postrouting-s 192.168.1.0/24-o eth1-j MASQUERADE
Service iptables restart (note that SQUID is not installed yet)

Then, iptables does not know which method to use, so that the following situation occurs:
On CENTOS, you can access both the Intranet and the INTERNET. However, the Intranet can be pinged to 192.168.1.1. If CENTOS eth0 is used, you cannot access the INTERNET.
I have read the following:/proc/sys/net/ipv4/ip_forward, showing: 1.
If something went wrong during my NAT operation, it would be impossible from the command point of view. POSTROUTING, PREROUTING, OUTPUT, and FORWARD are both ACCEPT, and I have not moved any other policies, iptables does not display any error message, And/var/log/messages is also normal ...... (I did not find the reason after two days)
So I hope you can help me to conquer LINUX!
Thank you!

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.