แค่เว็บๆหนึ่ง ! ที่อยากเก็บประสบการณ์
Home
 

Server จากเชียงใหม่(2)

วันนี้เปลี่ยนใจ  อยากลงServer ขึ้นมา  เอาตัวเดิมที่เป็น Transparent Proxy Linux RH9  มาเปลี่ยนเป็น Freebsd 6.2
ติด ตั้ง  OS เสร็จแล้ว compile Kernel  ใหม่ให้Support NAT
#/usr/src/sys/i386/conf
#cp GENERIC XNAT
#pico XNAT แก้ไข   ident           GENERIC    –>  เป็น     ident           RIP
เพิ่ม option เข้าไปดังนี้
options IPFIREWALL
options IPFIREWALL_FORWARD
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=120
options IPDIVERT
options BRIDGE
options SC_DISABLE_REBOOT   #ป้องกันการกด ctrl+alt+del
เสร็จ แล้ว Save
#config XNAT
#cd ../compile/XNAT
#make depend; make ; make install
จากนั้นรอ ประมาณ 5 นาที  (เครื่อง P4 3.0)
แก้ไขไฟล์ rc.conf
#pico /etc/rc.conf
เพิ่มเข้าไปดังนี้
firewall_enable=”YES”
firewall_type=”OPEN”
firewall_quite=”YES”
natd_enable=”YES”
natd_interface=”rl0″  –> lan ใบที่ต่อ internet
 natd_flags=”-s -u -m”
 ต่อมา  Installing Squid »
#tar zxvf squid-2.5.STABLE10.tar.gz
#cd squid-2.5.STABLE10
#./configure –enable-removal-policies  –enable-delay-pools –enable -ipf-transparent   –enable-snmp  –enable-storeio=diskd,ufs  –enable-storeio=diskd,ufs –disable-ident-lookups   ; make all ; make install
รอๆๆจนเสร็จ จากนั้นเข้าไปแก้ไขไฟล์ Squid.conf
# pico /usr/local/squid/etc/squid.conf แก้ไขรายการดังนี้
 http_port 8080
 icp_port 3130
cache_dir ufs /usr/local/squid/var/cache 100 16 256
cache_access_log /usr/local/squid/var/log/access.log
cache_access_log /usr/local/squid/var/log/cache.log
cache_ store_log /usr/local/squid/var/log/store.log
acl localhost src 127.0.0.1/255.255.255.255 (ของเดิม)
 acl mynet src 192.168.1.0/255.255.255.0 (พิมพ์เพิ่มเข้าไป)
 acl to_localhost 127.0.0.1/8 (ของเดิม)
#http_access allow our_networks (ของเดิม)
 http_access allow  mynet (พิมพ์เพิ่มเข้าไป)
 #And finally deny all other access to this proxy (ของเดิม)
 http_access deny all (ของเดิม)
 #Transparent Proxy
 httpd_accel_host
 virtual httpd_accel_port  80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
จากนั้นสร้าง cache
#cd /usr/local/squid/var/
#mkdir cache
# chown -R nobody:nogroup cache
# chmod -R 777 cache
# cd  var/log
# touch access.log cache.log store.log
 # chmod 777 *
# cd /usr/local/squid/sbin
# ./squid ?z
เพิ่มบรรทัดล่างลงในไฟล์ /etc/rc.local เพื่อให้ squid ทํางานอัตโนมัติ
 #pico /etc/rc.local
 /usr/local/squid/bin/RunCache &
/usr/local/squid/bin/RunCache &
ipfw add 1000 deny tcp from any to any 135
ipfw add 1100 deny udp from any to any 135-138
ipfw add 1200 deny tcp from any to any 139
ipfw add 1201 deny tcp from any to any 1863
ipfw add 1202 deny udp from any to any 1863
ipfw add 1300 deny tcp from any to any 445
ipfw add 1400 deny udp from any to any 445
 ipfw add 1500 deny tcp from any to any 593
ipfw add 1600 fwd 192.168.1.1,8080 tcp from 192.168.1.0/24 to any 80
เสร็จแล้วให้ Reboot  ลองให้เครื่องลูกเข้า Internet ดูครับ ไว้ค่อยมาแนะนำการลง MRTG  วันหลังนะครับ

 

Off 

March 23, 2012 This post was written by Categories: เรื่องเล่ารายวัน No comments yet


Top