การติดตั้ง Firewall แบบง่าย เอามาจาก http://projectfiles.com/firewall/
ให้เรา download script ชื่อ firewall_install.sh ได้จากเวบดังกล่าว หรือ download ได้จาก ที่นี่ จากนั้น
ใช้ winscp ส่งเข้าไปที่ Server ผู้เขียนเอาไปเก็บไว้ที่ /home/util จากนั้นให้เราเปลี่ยนโหมดเป็น 700 แล้วสั่งให้ทำงาน ตามคำสั่งล่างนั
[root@one util]# ls f* -l
-rw-r--r-- 1 root root 94031 Jul 31 2003 firewall_install.sh
[root@one util]# chmod 700 firewall_install.sh
[root@one util]# ls f* -l
-rwx------ 1 root root 94031 Jul 31 2003 firewall_install.sh
[root@one util]# ./firewall_install.sh
เมื่อเราได้ตอบคำถามเรียบร้อย เมื่อลองใช้คำสั่ง iptables -L จะได้ผลดังข้างล่างนี้
[root@one util]# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ftp
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:smtp
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:domain
ACCEPT udp -- anywhere anywhere state NEW udp dpt:domain
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:pop3
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:auth
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:imap
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:https
ACCEPT udp -- anywhere anywhere state NEW udp dpt:syslog
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:imaps
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:pop3s
ACCEPT all -- 192.168.1.0/24 anywhere state NEW
ACCEPT udp -- anywhere anywhere state NEW udp dpt:bootps
ACCEPT all -- anywhere anywhere state NEW
TRUSTED all -- anywhere anywhere state NEW
Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- 192.168.1.0/24 anywhere state NEW
TRUSTED all -- anywhere anywhere state NEW
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT icmp -- anywhere 192.168.1.0/24
DROP icmp -- anywhere anywhere state INVALID
Chain TRUSTED (2 references)
target prot opt source destination
ACCEPT icmp -- anywhere one.muphrtrc.ac.thicmp echo-request
DROP icmp -- anywhere anywhere
REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
[root@one util]#
ถ้าเราลองดู iptables เดิมก่อนการติดตั้ง rc.firewall จะได้ผลดังข้างล่างนี้
[root@one util]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.2.5 on Fri Jul 25 15:30:39 2003
*mangle
:PR
ไม่มีความเห็น