ºìÁªLinuxÃÅ»§
Linux°ïÖú

RH9.0ÅäÖ÷ÓÉ£¬Í¸Ã÷´úÀí£¬CS 1.5 ·þÎñÆ÷,Ó²ÅÌÐÔÄÜÓÅ»¯!

·¢²¼Ê±¼ä:2006-09-11 00:36:03À´Ô´:ºìÁª×÷Õß:nxfte
±¾ÈËΪһÍø°ÉССÍø¹Ü,¸ßÖÐû±ÏÒµ,µçÄÔÏà¹Ø֪ʶ¾ùÊÇ×Ôѧ<ѧϰ×ÊÁÏÀ´×Ô»¥ÁªÍø>,×ÛÉÏËùÊö,ˮƽÓÐÏÞ,´íÎóÄÑÃâ,Ï£Íû´ó¼ÒÖ¸Õý´íÎó,²»ÒªÎóµ¼Á˳õѧÕß:}.

Íø°ÉÒÔÇ°ÓÃWIN2003ΪÍø°ÉÌṩNAT¹²ÏíÉÏÍø,°²×°ÁËÈðÐÇ·À»ðǽ,ÓõÃϵͳ×Ô´øµÄIIS6Ö§³ÖASP.NET.ÅäÖÃLINUX×ö·þÎñÆ÷ֻΪһʱºÃÆæ.ÔÚ´Ë֮ǰ ±¾ÈËÖ»»á¼òµ¥µÄ°²×°Ò»¸ö×ÀÃæµÄLINUX :{.·Ï»°ÉÙ˵,ÑÔ¹éÕý´«!

Íø°É¹âÏ˽ÓÈë,¹Ì¶¨IP.·þÎñÆ÷ÅäÖÃP4 2.4,512M DDR,845GÖ÷°å,IDE 120GÓ²ÅÌ,D-Link 530Tx Ë«Íø¿¨,LINUX9×Ô´øÇý¶¯,ËùÒÔ,°²×°ÍêºóÖ±½ÓÓþÍÐÐÀ²~:} eth0 ½ÓÍâÍø,IP:192.168.1.10 ÑÚÂ룺255.255.255.0 Íø¹Ø:192.168.1.1 eth1½ÓÄÚÍø,IP:192.168.2.1 ÑÚÂë:255.255.255.0 ;DNS:202.102.128.68; 202.102.152.3; 218.56.57.58(ɽ¶«Ê¡µÄDNS)»úÆ÷Ãû netserver.¶ÔLINUX½øÐÐÅäÖÃʱÓõıÉÈ˵ĻúÆ÷,ʹÓõÄÊÇLINUXµÄSSH·þÎñ,±ÉÈ˵ĻúÆ÷IP:192.168.2.3,ÒòΪÊÇWIN2KµÄϵͳ,ËùÒÔÓõÄÊÇÁ½¸öÎļþÃûΪpsftp.exeºÍputty.exe.·þÎñÆ÷¶ÔÍâÖ»ÌṩWEB·þÎñºÍCS ·þÎñ,ËùÒÔ,¿ª·ÅµÄ¶Ë¿ÚÖ»ÓÐWWW¶Ë¿ÚºÍCSµÄ27015,27016,27017<27015Ϊ1.5 PUB Server,27016Ϊ1.6 Race server,27017Ϊ1.5 Race Server(ÒòΪʱ¼ä¹Øϵ,1.6µÄFÔÝʱ»¹Ã»×ö:{)>

linuxϵͳĬÈÏÓïÑÔʹÓÃENGLISH,ÔÚÑ¡ÔñÎļþ°üµÄʱºò,ÏÈ°ÑËùÓеİü¶¼²»Ñ¡,È»ºóֻѡÔñWEB·þÎñÆ÷,ÒÔ¼°PHP,MYSQLÏà¹ØµÄÑ¡ÏîÑ¡ÉÏ,»¹ÓÐ SAMBA,SSH.ÕâÑù,×ܹ²ÐèÒªµÄ¿Õ¼äÔÚ 480M×óÓÒ°É~ÔÚ°²×°µÄ¹ý³ÌÖÐÅäÖúÃIP,ÑÚÂë,Íø¹Ø,DNS.°²×°Íêºó,SSH¾Í¿ÉÒÔÓÃÀ²!

Ê×ÏÈÅäÖù²ÏíÉÏÍøºÍ·À»ðǽ!<ÒÔÏÂÄÚÈÝΪתÌû,²¢¾­¹ý¼òµ¥ÐÞ¸Ä>

±¾Àý iptables ÏȾܾøËùÓзâ°ü,ÔÚ¿ª·ÅÐèÒª·ÅÐеķâ°ü,Èç´Ë°²È«ÐԽϸß.

vi /bin/firewall.iptables # ÔÚ /bin Ŀ¼Ï½¨Á¢Ò»ÐÂÎĵµ,ÎļþÃûΪ firewall.iptables


ÄÚÈÝÈçÏÂ:
#!/bin/bash
# Load module ÔØÈëÏà¹ØÄ£¿é
modprobe ip_tables
modprobe ip_nat_ftp
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc


# start firewall service with deny all IPTABLES³õʼÉ趨,¾Ü¾øËùÓзâ°ü.
iptables -F
iptables -F -t nat
iptables -X
iptables -X -t nat
iptables -P INPUT DROP
iptables -P FORWARD ACCEPT
iptables -P OUTPUT DROP

iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

#°Ñeth1ÉèΪÐÅÈÎÉ豸
iptables -A INPUT -i eth1 -j ACCEPT
iptables -A OUTPUT -o eth1 -j ACCEPT

# ICMP Control ÍⲿµçÄÔPING²»µ½´ËÖ÷»ú,µ«´ËÖ÷»ú¿ÉÒÔPINGÍⲿµçÄÔ
iptables -A OUTPUT -o eth0 -p icmp -j ACCEPT
iptables -A INPUT -i eth0 -p icmp --icmp-type echo-reply -j ACCEPT
iptables -A INPUT -i eth0 -p icmp --icmp-type echo-request -j DROP

# outgoing ·ÅÐдËÖ÷»ú³öÈ¥µÄWAN·â°ü
iptables -A INPUT -i eth0 -p TCP --sport www -j ACCEPT
iptables -A OUTPUT -o eth0 -p TCP --dport www -j ACCEPT
iptables -A INPUT -i eth0 -p UDP --sport www -j ACCEPT
iptables -A OUTPUT -o eth0 -p UDP --dport www -j ACCEPT
iptables -A INPUT -i eth0 -p TCP --sport 27015 -j ACCEPT
iptables -A OUTPUT -o eth0 -p TCP --dport 27015 -j ACCEPT
iptables -A INPUT -i eth0 -p TCP --sport 27016 -j ACCEPT
iptables -A OUTPUT -o eth0 -p TCP --dport 27016 -j ACCEPT
iptables -A INPUT -i eth0 -p TCP --sport 27017 -j ACCEPT
iptables -A OUTPUT -o eth0 -p TCP --dport 27017 -j ACCEPT

# incoming ·ÅÐдÓWAN½øÀ´µÄ·â°ü
iptables -A INPUT -i eth0 -p TCP --dport www -j ACCEPT
iptables -A OUTPUT -o eth0 -p TCP --sport www -j ACCEPT
iptables -A INPUT -i eth0 -p UDP --dport www -j ACCEPT
iptables -A OUTPUT -o eth0 -p UDP --sport www -j ACCEPT
iptables -A INPUT -i eth0 -p TCP --dport 27015 -j ACCEPT
iptables -A OUTPUT -o eth0 -p TCP --sport 27015 -j ACCEPT
iptables -A INPUT -i eth0 -p TCP --dport 27016 -j ACCEPT
iptables -A OUTPUT -o eth0 -p TCP --sport 27016 -j ACCEPT
iptables -A INPUT -i eth0 -p TCP --dport 27017 -j ACCEPT
iptables -A OUTPUT -o eth0 -p TCP --sport 27017 -j ACCEPT

# SET NAT camouflage IP with more to one NAT·â°üαװ
echo "1" > /proc/sys/net/ipv4/ip_forward
#iptables -t nat -A PREROUTING -i eth1 -p tcp -s 192.168.2.0/24 --dport 80 -j DNAT --to 192.168.2.1:3128
#iptables -t nat -A PREROUTING -i eth1 -p tcp -s 192.168.2.0/24 --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o eth0 -j MASQUERADE

ÖÁ´Ëfirewall.iptablesÄÚÈݽáÊø.

É趨firewall.iptablesΪ¿ÉÖ´ÐÐÎļþ
chmod 700 /bin/firewall.iptables

¿ª»ú×Ô¶¯ÔËÐÐ firewall.iptables
vi /etc/rc.d/rc.local
ÔÚ×îºóÃæ¼ÓÈëfirewall.iptables

ÆäËûort number Çë×ÔÐÐ×Բο¼ /etc/services ÈÈ
cat /etc/services | less #²é¿´/etc/servicesÈÈÝ£°´page downµ½ÏÂÒ»Ò³
#°´À뿪
#ÔËÐÐfirewall.iptabls
firewall.iptables
#ÔÚ/etc/sysconfig/ÏÂÃæÉú³É·À»ðǽ¹æÔòÎļþ
cd /etc/sysconfig
iptables-save > iptables
ÖÁ´Ë,¹²ÏíÉÏÍø,·À»ðǽÅäÖÃÍê³É!


squid´úÀíÉèÖÃ
ÒÔÏÂÊÇÎÒµÄ/etc/squid/squid.confÄÚÈÝ

http_port 3128
cache_mem 64 MB
cache_swap_low 75
cache_swap_high 85
maximum_object_size 4096 KB
maximum_object_size_in_memory 8 KB
ipcache_size 1024
ipcache_low 90
ipcache_high 95
fqdncache_size 1024
cache_dir ufs /var/spool/squid 1000 16 256
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
pid_filename /var/run/squid.pid
client_netmask 255.255.255.0
acl all src 0.0.0.0/0.0.0.0
acl localhost src 127.0.0.0/255.0.0.0
http_access deny all
acl our_networks src 192.168.2.0/24
http_access allow localhost
cache_mgr awp46@126.com
cache_effective_user squid
cache_effective_group squid
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
visible_hostname netserver
httpd_accel_host virtual
httpd_accel_port 80


sambaÉèÖÃ
ÒÔÏÂÊÇÎÒµÄ/etc/samba/smb.confÄÚÈÝ

workgroup = workgroup
server string = Workgroup
hosts allow = 192.168.2.3
guest account = root
log file = /var/log/samba/%m.log
security = share
client code page= 936
encrypt passwords = yes
smb passwd file = /etc/passwd
[admin]
path = /
valid users = root
public = yes
writeable = yes
directory mode = 0777

±¸×¢: ÒòΪSAMBAÖ»ÊÇÎÒ×Ô¼ºÊ¹ÓÃ,ËùÒÔ,¹²ÏíÁ˸ùĿ¼,²¢ÇÒÊÇÍêȫȨÏÞ!ƽʱÎÒµÄSAMBA·þÎñÊǹصÄ,Ö»ÓÐÓõ½µÄʱºò²Å¿ª.

WEBÉèÖÃ
ÒòΪ°²×°µÄʱºò¶¼Ñ¡¶¨ÁËPHP,MYSQLÒÔ¼°Ïà¹ØµÄ,ËùÒÔÕâÒ»ÏîÅäÖõÄʱºòÌرðÊ¡ÊÂ:},ÒÔÏÂÊÇÎÒ/etc/httpd/conf/httpd.confÀïÐ޸ĹýµÄµØ·½,ÆäËûµØ·½Ã»±ä

ServerAdmin awp46@126.com
ServerName 192.168.1.10:80
DirectoryIndex index.php index.htm
DefaultLanguage zh-cn
AddDefaultCharset GB2312

ÔÙÐèÒª¸ÄµÄ¾ÍÊÇMysql rootµÄÃÜÂë!ÎÒʹÓõÄÊÇphpadmin¸ÄµÄ,²¢ÇҰѳýÁËroot/localhostÒÔÍâµÄÓû§È«É¾³ýÁË!

ϵͳ·þÎñ:
ÓÃntsysvÃüÁî´ò¿ª·þÎñÉèÖÃ,ÎÒ´ò¿ªµÄ·þÎñÓÐhttpd,iptables,mysqld,network,smb,squid,sshd,syslog.
ÁíÍâÒ²¿ÉÒÔÓÃservies ·þÎñÃû³Æ stop/start Í£Ö¹·þÎñ/´ò¿ª·þÎñ
Àý:servies httpd stop

Ó²ÅÌÓÅ»¯.ÓÅ»¯Ç°Ò»¶¨Òª±¸·ÝºÃÊý¾Ý,³öÏÖÒâÍâ,ûÈËÄܾȵÃÁËÄã!:{
ÏÔʾӲÅ̹¤×÷²ÎÊý:
hdparm -v /dev/hda
²âÊÔÓ²ÅÌÐÔÄÜ:
hdparm -Tt /dev/hda
ÔÚ/etc/rc.d/rc.localÀïÃæ¼ÓÉÏÏÂÃæµÄÃüÁî,ÕâÑùÔÚ¿ª»úµÄʱºò¾Í×Ô¶¯ÓÅ»¯ÁË.ÔÚ¼Ó֮ǰҪÏȲâÊÔºÃ,¿´Ôõô¸Ä×ÅÐÔÄܸ߼´¿É
hdparm -c3 -d1 -k1 -m16 -a64 /dev/hda

CS 1.5 ·þÎñÆ÷¼ÜÉè!
ËùÐèÎļþhlds_l_3111_full.bin,cs_15_full.tar.gz(¿´ÍøÉÏÆäËûÎÄÕÂ˵»¹ÒªÃâCD KEY²¹¶¡,ÎÒûÕÒµ½,¾ÍûÓÃ,µ«Ò»ÑùÄܽø,²»ÓÃÃâCDKEY²¹¶¡~)
ÓÃchmod 700 hlds_l_3111_full.bin ÃüÁî°Ñhlds_l_3111_full.binÉèΪ¿ÉÖ´ÐÐÎļþ,È»ºóÖ´ÐÐhlds_l_3111_full.bin,ÊäÈëYESºó¾Í¿ÉÒԵõ½hlds_l_3111_full.tar.gzµÄѹËõÎļþ!½âѹºóµÃµ½Ò»¸öhlds_lµÄĿ¼,È»ºóÔÙ°Ñcs_15_full.tar.gz½âѹµ½hlds_lµÄĿ¼ÏÂÃæ!
ÎÒµÄhlds_lĿ¼/game/hlds_l
vi /bin/startcs1
cd /game/hlds_l
./hlds_run -game cstrike +ip 192.168.1.10 +port 27015 +maxplayers 22 +map de_dust2 -nomaster +sv_lan 1 +servercfgfile server1.cfg +mapcyclefiles mapcycle1.txt +motdfile motd1.txt
chmod 700 /bin/startcs1

vi /bin/startcs2
cd /game/hlds_l
./hlds_run -game cstrike +ip 192.168.1.10 +port 27016 +maxplayers 12 +map de_dust2 -nomaster +sv_lan 1 +servercfgfile server2.cfg +mapcyclefiles mapcycle2.txt +motdfile motd2.txt
chmod 700 /bin/startcs2

vi /bin/startcs3
cd /game/hlds_l
./hlds_run -game cstrike +ip 192.168.1.10 +port 27017 +maxplayers 12 +map de_dust2 -nomaster +sv_lan 1 +servercfgfile server3.cfg +mapcyclefiles mapcycle3.txt +motdfile motd3.txt
chmod 700 /bin/startcs1

ÕâÑù,Ï뿪CS·þÎñÆ÷µÄʱºò,Ö±½ÓÊäÈëstartcs1¼´¿É!
Èç¹ûCS ·þÎñÆ÷ÖÐ;µ±µô,¾ÍÒªÊÖ¶¯ÊäÈëstartcs1,ÄÇÑùºÜÊÇÂé·³!ÓÃÏÂÃæµÄ·½·¨¿ÉÒÔ½â¾ö!
vi /bin/autostartcs1
while true
do
startcs1
done

vi /bin/autostartcs2
while true
do
startcs2
done

vi /bin/autostartcs3
while true
do
startcs3
done

´ò¿ªCS ·þÎñÆ÷µÄʱºò,ÓÃautostartcs1!ÕâÑù¾Í²»ÅÂCS·þÎñÆ÷ÖÐ;µ±µôÁË!
ÖÁÓÚCS·þÎñÆ÷²å¼þµÄ°²×°,µ½www.unitedadmins.comÏÂÔØFOR linux°æ±¾,½âѹµ½hlds_l/cstrikeÏÂÃæ,Àý:hlds/cstrike/addons/amx
¼ÇµÃÔÚÿ¸öserver.cfgÀïÃæ¼ÓÉÏ:
max_queries_sec "5"
max_queries_sec_global "10"
max_queries_window "30"
·ñÔò¾ÍÓпÉÄܳöÏÖCS·þÎñÆ÷¸ôÈý²îÎåµôÏßµÄÎÊÌâ!
¸½/hlds_l/cstrike/liblist.gamÄÚÈÝ
game "Counter-Strike"
url_info "www.counter-strike.net"
url_dl ""
version "1.5"
size "184000000"
svonly "0"
secure "0"
type "multiplayer_only"
cldll "1"
hlversion "1110"
nomodels "1"
nohimodel "1"
mpentity "info_player_start"
gamedll_linux "addons/metamod/dlls/metamod_i386.so"
trainmap "tr_1"

/hlds_l/cstrike/addons/metamod/plugins.iniÎļþÄÚÈÝ
linux addons/wwcl/dlls/pcawwclconfig_mm_i386.so
linux addons/booster/booster_mm.so
linux addons/amx/dlls/amx_mm_i386.so
linux addons/amx/dlls/fun_ms_i386.so
//linux addons/amx/dlls/war3_ms_i386.so
//linux addons/amx/dlls/udp_ms_i386.so
linux addons/amx/dlls/csstats_ms_i386.so
//linux addons/hlguard/dlls/hlguard_mm_i586.so
//linux addons/cdeath/cdmod_i586.so
//linux addons/chickenmod/dlls/chicken_mm_i386.so
//linux addons/statsme/dlls/sm_cstrike_mm_i386.so
//linux addons/clanmod/dlls/clanmod_mm_i586.so

±¸×¢:Èç¹û³öÏÖÌøPINGÏÖÏó,¸Ä±ä³ÌÐòHLDSµÄÓÅÏȼ¶¾Í¿ÉÒÔÁË!
ÏÔʾ½ø³Ì:
ps -e
.............
3386 pts/0 00:00:00 hlds_run
........
Ìá¸ß½ø³ÌIDΪ 3386 HLDSµÄÓÅÏȼ¶
renice +1 3386


µ½´ËΪÖÁ,»ù±¾ÉϾÍËãÊÇÅäÖÃÍê³ÉÁË!ºÇºÇ!Öм䱾ÈËÒÑÖªµÄµ«ÔÝʱ»¹Ã»½â¾öµÄÎÊÌâÓÐÏÂÃæ2¸ö:
1.Squid´úÀíµÄÒÉÎÊ!
#iptables -t nat -A PREROUTING -i eth1 -p tcp -s 192.168.2.0/24 --dport 80 -j DNAT --to 192.168.2.1:3128
#iptables -t nat -A PREROUTING -i eth1 -p tcp -s 192.168.2.0/24 --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o eth0 -j MASQUERADE
ÏëҪʵÏÖSQUID͸Ã÷´úÀí,Ò»¸öÊÇ°ÑsquidµÄ¶Ë¿ÚÉèÖÃΪ80,µ«ÕâÑù¾ÍºÍWEBµÄ³åÍ»ÁË!Èç¹û²»Ïë¸ÄWEBµÄ¶Ë¿Ú,¾ÍÒªÓÃÉÏÃæµÚÒ»ÐлòÊǵڶþÐеÄÃüÁî,µ«ÎÒÊÔÁË,ÓÃÄÄÒ»¸ö¶¼²»ÐÐ!¹òÇóLINUX¸ßÊÖÖ¸µã!


2.CS ·þÎñÆ÷PINGµÄÎÊÌâ
ÔÚWINDOWSÏÂÃæ,CS·þÎñÆ÷ĬÈÏFPSÊÇ64,ÓÃÁËHL-Booster¼ÓËÙºó,¶¼ÄÜ´ïµ½512»òÊǸü¸ß!(ÊäÈëstats,²é¿´·þÎñÆ÷FPS!)
µ«linux ÏÂÃæµÄ·þÎñÆ÷ÓÃÁËbooster¼ÓËÙÒÔºó,ÓÃstats²é¿´FPS»¹ÊÇ50,ÕâÑù,¾ÍËãÊÇ´Ó¾ÖÓòÍø½øCS·þÎñÆ÷,PING¾Í20×óÓÒ!½ø¼ÓËÙºóWINDOWSϵÄCS ·þÎñÆ÷PINGÔÚ10ÒÔÄÚ!
sys_ticrate 10000
booster_maxsysticrate 10000
booster_minsysticrate 10000
ÔÚserver.cfgÀïÃæ¼ÓÉÏÕâЩ²ÎÊýÒ²²»¹ÜÓÃ:{
¹òÇóLINUXÏÂCS ·þÎñÆ÷ÖÆ×÷¸ßÊÖÖ¸µã!
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 3 ÌõÆÀÂÛ

  1. juanshuchun ÓÚ 2006-10-27 21:35:11·¢±í:

    learning

  2. machonghao ÓÚ 2006-10-23 17:18:46·¢±í:

    ºÃ¶«Î÷£¬Ð»Ð»¡£

  3. 202.102.151.* ÓÚ 2006-10-10 15:40:28·¢±í:

    ÔÚhldsµÄÆô¶¯ÎļþÖмÓÈë-pingbooster 3£¬ÕâÑù·þÎñÆ÷²Å¼ÓËÙÁË£¬sys_ticrate 10000
    booster_maxsysticrate 10000
    booster_minsysticrate 10000
    ²Å¹ÜÓ㬲»¹ýÕâÈý¸ö²ÎÊý£¬Ó¦¸ÃÐèÒªºÏÀíµÄÉèÖã¬Òª²»·þÎñÆ÷µÄcpuÊܲ»ÁË¡£