Controls IP packet forwarding #
net.ipv4.ip_forward = 1
Controls source route verification #
net.ipv4.conf.default.rp_filter = 1
Do not accept source routing #
net.ipv4.conf.default.accept_source_route = 0
Controls the System Request debugging functionality of the kernel #
kernel.sysrq = 0
Controls whether core dumps will append the PID to the core filename #
Useful for debugging multi-threaded applications #
kernel.core_uses_pid = 1
Controls the use of TCP syncookies #
net.ipv4.tcp_syncookies = 1#
net.ipv4.tcp_synack_retries = 2
############## IPv4 networking start ##########
Send redirects, if router, but this is just server #
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
Accept packets with SRR option? No #
net.ipv4.conf.all.accept_source_route = 0
Accept Redirects? No, this is not router #
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
Log packets with impossible addresses to kernel log? yes #
net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
Ignore all ICMP ECHO and TIMESTAMP requests sent to it via broadcast/multicast #
net.ipv4.icmp_echo_ignore_broadcasts = 1
'Prevent against the common 'syn flood attack #
net.ipv4.tcp_syncookies = 1
Enable source validation by reversed path, as specified in RFC1812 #
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
==================================
لحفظ التغيرات
Ctrl + X نضغط
Y ثم
Enter ثم
الخطوة الثانية / تنصيب السكويد من خلال تنفيذ الأوامر التالية بالتسلسل
sudo apt-get install squid
sudo apt-get install squid squidclient squid-cgi
sudo apt-get install automake
وبعدھا نمسح الإعدادات الديفولت للسكويد عن طريق الأمر التالي
sudo echo -n > /etc/squid/squid.conf
الخطوة الثالثة / نغير إعدادات الكاش حسب الحاجة من خلال الامر
sudo nano /etc/squid/squid.conf
نضع الإعدادات التالية والجاھزة
================
http_port 3128 transparent
visible_hostname Server
cache_mgr alhadithi@ dijlh.net
cache_mem 1024 MB
maximum_object_size_in_memory 512 KB
maximum_object_size 20 MB
minimum_object_size 0 KB
cache_swap_low 90
cache_swap_high 95
cache_dir ufs /var/spool/squid 40960 16 256
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log none
pid_filename /var/run/squid.pid
cache_swap_log /var/log/squid/swap.state
dns_nameservers /etc/resolv.conf
emulate_httpd_log off
hosts_file /etc/hosts
half_closed_clients off
negative_ttl 1 minutes
refresh_pattern ^ftp: 15 20% 2280
refresh_pattern ^gopher: 15 0% 2280
refresh_pattern . 15 20% 2280
refresh_pattern http://*.windowsupdate.microsoft.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://office.microsoft.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://windowsupdate.microsoft.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://wxpsp2.microsoft.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://xpsp1.microsoft.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://w2ksp4.microsoft.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://download.microsoft.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://download.macromedia.com/ 0 80% 20160 reload-into-ims
refresh_pattern ftp://ftp.nai.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://ftp.software.ibm.com/ 0 80% 20160 reload-into-ims
refresh_pattern -i \.(flash|x-flash|flv|x-flv)$ 43200 90% 432000
refresh_pattern -i \.asp$ 10 90% 60 override-expire override-lastmod
refresh_pattern -i \.gif$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.jpg$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.bom\.gov\.au 30 20% 120 override-expire override-lastmod
refresh_pattern -i \.html$ 10 90% 22160 override-expire override-lastmod
refresh_pattern -i \.htm$ 10 90% 22160 override-expire override-lastmod
refresh_pattern -i \.class$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.zip$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.jpeg$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.mid$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.shtml$ 480 50% 22160 override-expire override-lastmod
refresh_pattern -i \.exe$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.thm$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.wav$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.txt$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.cab$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.au$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.mov$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.xbm$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.ram$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.avi$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.chtml$ 480 50% 22160 override-expire override-lastmod
refresh_pattern -i \.thb$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.dcr$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.bmp$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.phtml$ 480 50% 22160 override-expire override-lastmod
refresh_pattern -i \.mpg$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.pdf$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.art$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.swf$ 5 90% 60 override-expire override-lastmod
refresh_pattern -i \.mp3$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.ra$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.spl$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.viv$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.doc$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.gz$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.Z$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.tgz$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.tar$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.vrm$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.vrml$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.aif$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.aifc$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.aiff$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.arj$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.c$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.cpt$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.dir$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.dxr$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.hqx$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.jpe$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.lha$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.lzh$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.midi$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.movie$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.mp2$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.mpe$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.mpeg$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.mpga$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.pl$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.ppt$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.ps$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.qt$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.qtm$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.ras$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.sea$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.sea$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.sit$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.tif$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.tiff$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.snd$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.wrl$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern -i \.js$ 10080 90% 43200 override-expire override-lastmod
refresh_pattern ^ftp:// 480 60% 22160
refresh_pattern ^gopher:// 30 20% 120
refresh_pattern . 480 50% 22160
refresh_pattern -i (html|htm|/)$ 0 20% 720
refresh_pattern -i (asp\?|php\?) 0 20% 720
refresh_pattern -i (asp|php)$ 0 20% 720
refresh_pattern ^http://*.facebook.*/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://*.google.*/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://*iraqnaa.*/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://*.akamai.*/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://*.windowsmedia.*/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://*.googlesyndication.*/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://*.plasa.*/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://*.telkom.*/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://www.friendster.com/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://www.dijlh.net/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://www.friendster.com/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://www.wikimapia.org/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://mail.yahoo.com/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://*.yahoo.*/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://*.yimg.*/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://*.gmail.*/.* 720 90% 4320 reload-into-ims override-lastmod
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1
acl localhost src 127.0.0.0/255.255.255.255
acl SSL_ports port 443 563
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 # https, snews
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
acl localnetwork src 192.168.10.0/24
http_access allow localhost
http_access allow localnetwork
http_access deny all
tcp_outgoing_tos 0x30 localnetwork
zph_mode tos
zph_local 0x30
zph_parent 0
zph_option 136
=======================
لحفظ التغيرات
Ctrl + X نضغط
Y ثم
Enter ثم
عمل ريستارت للكاش من خلال تنفيذ الأمر
sudo /etc/init.d/squid restart
الخطوة الرابعة / عمل ناتينك ماسكويد لايبيات الشبكة من خلال تنفيذ الأمر
sudo nano /etc/rc.local
ثم مسح محتويات الملف وإضافة السكربت التالي
======================
#!/bin/sh
# squid server IP
SQUID_SERVER="192.168.10.1"
# Interface connected to Internet
INTERNET="eth0"
# Interface connected to LAN
LAN_IN="eth1"
# Squid port
SQUID_PORT="3128"
# DO NOT MODIFY BELOW
# Clean old firewall
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
# Load IPTABLES modules for NAT and IP conntrack support
modprobe ip_conntrack
modprobe ip_conntrack_ftp
# For win xp ftp client
#modprobe ip_nat_ftp
echo 1 > /proc/sys/net/ipv4/ip_forward
# Setting default filter policy
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
==========================
لحفظ التغيرات
Ctrl + X نضغط
Y ثم
Enter ثم
ألان تم الانتھاء من إعداد السيرفر بنجاح
reboot نقوم بترسيت السيرفر
الان جميع البينات راح تمر بالكاش وتنخزن وتخرج
وما يحتاج نضيف أي بروكسي في المتصفح
والنت الان شغال في الحاسبة الي دخلنا منھا للسيرفر
=======================================
اقدم لكم الدعم الفنى عن طريق الرابط التالى