Article Title: how to configure proxy 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.
First download the latest source code of iptables. Compile and install iptables, stop iptables installed in the system, use the latest installed iptables, and use the latest installed iptables tool.
Tutorial 1: Install
1. Slave.
2. Go to the/usr/local/src directory, uncompress the package, and enter the iptables source code directory,
# Cd/usr/local/src
# Bunzip2 iptables-1.2.9.tar.bz
# Tar xf iptables-1.2.9.tar
# Cd iptables-1.2.9
3. Use the following commands to compile and install the iptables source code package.
# Make PREFIX =/usr
# Make PREFIX =/usr install
Note: When you use the PREFIX =/usr parameter to specify iptables to install related files, use the/usr directory as the top directory instead of the default/usr/local directory, for example, iptables files are installed in/usr/sbin,/usr/lib,/usr/man, and other directories. Run the ls command to view these directories, attackers can find executable files and library files related to iptabels,
4. After the installation is complete, use the default iptables command and the newly installed iptables command to compare and view the version information.
#/Sbin/iptables? V
5. To use the newly installed iptables tool, you need to stop the iptabels Command executed during system startup and remove the firewall STARTUP script from the system startup queue,
# Chkconfig? Level 2345 iptables off
# Chkconfig? List iptables
Then restart the system with reboot.
Experiment 2: Use iptables to set the local machine to reject connections of a specific type
Use the latest iptables tool to set the local firewall. Enable the local firewall to reject external connections to the local telnet. ftp.
1. Continue the experiment. After restarting, log on as the root user. Run the iptables command to view the current firewall. No firewall settings are displayed,
#/Usr/sbin/iptables? L
2. Run the/etc/rc. d/init. d/vsftp script to start the vsftp server.
#/Etc/rc. d/init. d/vsftp start
3. Connect to the ftp server from another client in the LAN. The connection is successful!
If not! You need to carefully check whether the preceding steps are correct.
4. Run the vi command to edit the/etc/xinetd. d/telnet configuration file. Change "disable = yes" to "disable = no ". Save the disk and exit. Restart the service.
#/Etc/rc. d/init. d/xinetd restart
Access the local telnet service from another machine and the connection is successful.
If not! He needs to carefully check whether the above steps are correct
5. Use the following iptalbes command to disable External telnet connections.
#/Usr/sbin/iptables? A input? P tcp? Dport telnet-j DROP
6. After the configuration is complete, use the "-L" option of iptables to view the firewall settings. You can see that the firewall rules set above are in the INPUT chain.
# Iptables? L
7. Use the external host that is connected in the previous step to telnet to the local host, and the connection is denied,
But use ftp to connect. The external connection is still valid.
8. Use the same method. Set firewall rules for rejecting FTP connections
#/Usr/sbin/iptables? A input-p tcp -- dport ftp-j DROP
Run the iptables command to view the firewall. The result shows that the firewall rule you just set has been registered.
# Iptables? L
9. Use the iptables Command Option "-F" to clear all firewall rules
# Iptables? F
# Iptables? L
[1] [2] [3] Next page