Professional Documents
Culture Documents
IGOS Nusantara Dan Proxy Server Squid Trik: Konfigurasi Lain
IGOS Nusantara Dan Proxy Server Squid Trik: Konfigurasi Lain
IGOS Nusantara Dan Proxy Server Squid Trik: Konfigurasi Lain
Dari IGNwiki
Langsung ke: navigasi, cari Bagian ini membahas beragam trik terkait squid dan iptables, anatar lain: 1. 2. 3. 4. 5. Membuat skrip iptables untuk redirect Perintah iptables jika pakai ppp0 Blok satu IP ... lain-lain
Konfigurasi Lain
acl windowsupdate2 url_regex -i windowsupdate ## ACL Akses acl jaringanku src 192.168.0.0/24 acl hotspot src 10.1.0.0/24 http_access allow !windowsupdate !windowsupdate2 jaringanku http_access allow !windowsupdate !windowsupdate2 hotspot http_access deny all # ...
Skrip iptables
skrip iptables untuk mengatur redirect ke proxy server squid port 3128 Skema Jaringan http://igos-nusantara.or.id/wiki/Skema_Jaringan
#!/bin/sh # IP proxy server squid SQUID_SERVER="192.168.0.1" # Interface terkoneksi ke Internet INTERNET="eth0" # Interface terkoneksi ke LAN LAN_IN="eth1" # Squid port SQUID_PORT="3128" # Bersihkan iptables -F iptables -X iptables -t iptables -t iptables -t iptables -t firewall lama nat -F nat -X mangle -F mangle -X
# Muat modul IPTABLES untuk NAT dan sukungan IP conntrack modprobe ip_conntrack modprobe ip_conntrack_ftp # Untuk klien ftp win xp #modprobe ip_nat_ftp echo 1 > /proc/sys/net/ipv4/ip_forward # Seting filter default iptables -P INPUT DROP iptables -P OUTPUT ACCEPT # Unlimited access to loop back iptables -A INPUT -i lo -j ACCEPT iptables -A OUTPUT -o lo -j ACCEPT # Allow UDP, DNS and Passive FTP iptables -A INPUT -i $INTERNET -m state --state ESTABLISHED,RELATED -j ACCEPT # set this system as a router for Rest of LAN
iptables --table nat --append POSTROUTING --out-interface $INTERNET -j MASQUERADE iptables --append FORWARD --in-interface $LAN_IN -j ACCEPT # unlimited access to LAN iptables -A INPUT -i $LAN_IN -j ACCEPT iptables -A OUTPUT -o $LAN_IN -j ACCEPT # DNAT port 80 request comming from LAN systems to squid 3128 ($SQUID_PORT) aka transparent proxy iptables -t nat -A PREROUTING -i $LAN_IN -p tcp --dport 80 -j DNAT --to $SQUID_SERVER:$SQUID_PORT # if it is same system iptables -t nat -A PREROUTING -i $INTERNET -p tcp --dport 80 -j REDIRECT -to-port $SQUID_PORT # DROP everything and Log it iptables -A INPUT -j LOG iptables -A INPUT -j DROP
Blok satu IP
Cara blok salah satu IP untuk tidak diperbolehkan mengakses situs facebook.com Contoh: IP 192.168.0.3 ---> blok koneksi ke facebook.com IP all ---> bolek koneksi ke facebook.com Pakai squid:
acl bad_ip src 192.168.1.3/32 acl good_ip src 192.168.1.0/24 acl facebook_deny url_regex -i "facebook.com" http_access deny bad_ip facebook_deny http_access allow good_ip
Pakai iptables:
-A PREROUTING -i local_eth -d facebook.com -s 192.168.0.3 -j DROP
1. Spesifikasi Server
Sistem Operasi memakai IGOS Nusantara 2010 (Instal minimal) Posesor Intel(R) Xeon(TM) CPU 3.00GHz RAM 1 GB (yup memori masih kecil, harusnya update ke 4 GB) Harddisk 2 x 80 GB SCSI o Harddisk1: /dev/sda (untuk menyimpan sistem operasi) o Harddisk2: /dev/sdb (untuk menyimpan cache squid)
5. 5. Buat swap
6. Setelah konfigurasi squid.conf dilakukan, kini saatnya menjalankan squid. Ketikkan perintah agar squid membuat swap
7. # /usr/sbin/squid -z