餱ȥƥȤͫݵ

⤷ƤȤɽεϿøȽ񤯡

linux

CBQ.initȤäLinuxǤQoS

ͥåȥӰɬפӰ򤢤餫ݤꡢɬװʾΥȥեå¤뤳Ȥäư̤QoS(Quality of Service)ʤɤȸLinuxIPΥȥեåȥ(Ӱ)򤹤ˤϡiproutetcȤ

ϽǤϤΤΡľŪǤϤʤʬŤ餤ΤɬפʾȾϡɥ쥹¤Ȥݡ¤ȤŪŪϤäꤷƤ뤿ᡢХåȴñꤷΤ

ǡCBQ.initȤtcwrapperȤƻȤ䤹script롣CBQȤΤClass-Based Queuingȸäơȥեå(ѥå)򥯥饹Ȥ줾ӰͤꤷƤǡͤĶѥåȤ˴ȤñqueueͥդӰȰۤʤꡢĤޤǷФäƤѥåȤ塼󥰤줺¾̿ǤˤʤäƤޤ֤ɤ롣

CBQ.initCentOS4ǻƤߤ(֤CentOS5ǤredhatǤƱǤ礦)ɬפʥ⥸塼ϺǾǤѰդƤΤǡñscript֤ɤ

ޤscriptŬdirectory֤ƤredhatϤchkconfigscriptΤᡢ/etc/init.d/֤ʤlinkʤꤷƤȡӥȤƴ뤳ȤǤ롣ʬ䤹뤿ᡢ/etc/init.d/cbqȤե֤̾Ƥߤ

# chkconfig --add cbq
# chkconfig --list | grep cbq
cbq             0:off   1:off   2:off   3:off   4:off   5:off   6:off

ʴǸ

ȤϡscriptΥȤ˽äեѰդ롣եredhatϤdistributionʤФʤߤηե֤ϥǥեȤǤ/etc/sysconfig/cbq/ʤΤǡä̵ФˤɤCentOSɸ๽ˤ̵ΤǺäƤ

# mkdir /etc/sysconfig/cbq/

եӰ椷饹ˡdirectory˥ե֤ե̾̿̾§ϰʲΤȤꡣ

cbq-lt;clsidgt;.lt;namegt;
  • clsidӰΥ饹IDǡ¾Υ饹(פ¾ե̾)ȽʣƤϤʤ0002FFFFޤǤͤꤹ롣
  • nameǤդʸʬ䤹̾ˤǤ⤷Ƥ

Ȥ/etc/sysconfig/cbq/cbq-5963.for_httpsʤɤȤե롣ƤϤʴ

DEVICE=eth0,1000Mbit,100Mbit
RATE=5Mbit
WEIGHT=500kbit
RULE=:443,
  • DEVICEˤоݤȤinterface̾ȡбʪNICΥ®١(̾ϥ®٤1/10)ꤹ롣
  • RATEˤϤΥ饹ؤγӰꤹ롣
  • WEIGHTϥȤꤹ롣̾RATE1/10
  • RULEϡ[[saddr[/prefix]][:port[/mask]],][daddr[/prefix]][:port[/mask]]ηǻꤹ롣޶ڤȾɥ쥹ȥݡȡȾǥƥ͡ä˻ꤷʤ(anyꤹ)Ͼάǽ

줬äȤŪñʻȤ嵭ȡ1GbpsΥ󥿡եeth0̤ѥåȤФݡȤ443ǤвΥɥ쥹Ǥ⡢Υǥƥ͡Ǥ5MbpsӰȤ롢ȸ̣WebФʤɤꤷơhttpsβӰ¤Ƥ櫓

ñʤwrapperȤϤƤ¿ˤ錄ꡢʤ꤭٤롣scriptΥȤȤƤ褯ŻޤäƤΤǡƤߤɤ(CBQ.initȤ̾ɡCBQʳǤ)

chkconfigǥӥϿƤСưˤ

# service cbq start

ɤưγǧϰʲΥޥɤǤǤ롣

# service cbq stats(Ӱξɽ)
# service cbq list(оݤΥꥹȤɽ)
# tc -s class ls dev eth0(tcǸˤϤʴ watchޥɤΰˤ)

ư̵꤬СchkconfigޥɤonˤƤСOSbootꤵ롣chkconfigȤʤϡΤޤscriptμ¹Ԥstart,stop,stats,listꤹƱ̤ˤʤ롣

NPTLɸ2.6kernelLinuxThreadsȤ

Linux kernelˤϡFreeBSDKSE䡢NetBSDSolarisLWPΤ褦ʡץ٤ƥȥåñ̤ʤޤǥץƥȥåκǾñ̤ǡåɤfork()ΥѡåȤǤclone()ȤLinuxȼΥƥॳǺ줿ץȤư롣

פϥ꥽ƥץȶͭޤ(ҥץѤΥ֤򥳥ԡ)줿ץʤΤºݤΥƥȥåκݤˤϡ꥽ڤؤȯʤΤǡ̾ΥץƥȤڤؤξǤ®ϤŪLWPȻ褦ʰդˤʤäƤ롣

kernelΥץƥȤФơɤΤ褦˥åɤƤ뤫glibc(libc,libthread)äƤơkernel2.4ϤκLinuxThreadsȤǹԤäƤåɤˤϤ줾̤pid(ץid)ʧФ졢줾Υץ(å)̤Υޥ͡㥹å(ץ)롣ȥåɴ֤(ºݤˤϥץ֤)ʥʤɤ꤬Ф뤳Ȥ(䤳ʤץȥåɤ)ޤpid̤˾񤹤뷹ꡢ̤Υåɤץ̤˵ưꤹpidȤ̤Ƥޤǽ⤢롣ǡkernel¦ä˽ɬפʤơkernelϥץȤƸƤΤ򥳥ƥȥåоݤˤФ褤ΤưϥץFreeBSDǤrfork()clone()˻ȤäLinuxThreadsߴμäʤ󤫤ơkseule塼餬ꤹˤϤ褯Ȥ줿ꤷ

2.6ϤkernelǤLinuxThreadsѤäNPTL(Native POSIX Thread Library)Ƥ롣kernelglibcξѹääƤơLinuxThreads⥹åɤ䤿®餷åɤˤѤ餺clone()ȤȤ䡢kernel鸫ݤΥƥȥåñ̤ϥץǤ뤳ȤʤɤѤʤܤ礭ѲȤơĤΥץˤϰĤpidҤԤ(åpidѤʤ)åidʿ򰷤뤳Ȥʤɤΰ㤤롣ޤPOSIX Thread(ɸŪʥåɼ)ؤνٹ礤⤤դ˸LinuxThreadsPOSIX Threadߴʬ¿ȸ롣

ԹˤLinuxThreadsPOSIXߴʬ˰¸ץबä硢2.4ϤǤäΤ2.6ϤͽʤưˤʤȤᤷ̤ˤʤ礬롣ʤȤΤˡ2.6kernelǤLinuxThreads¹ԤФ褤(LinuxThreadsˤkernelüʻųݤɬפʤΤǡglibcѰդʤ)

饤֥ڤؤϰ츫ƥѥ뤬ɬפʤ褦˴뤬libpthreadlibcưŪ󥯤ƤСldLinuxThradsǤɸNPTLǤ򤷤ƥ󥯤ƤȤߤʤΤǡѥѤߥХʥǤⵯưڤؤ뤳ȤǤ롣

ŪˤϴĶѿ LD_ASSUME_KERNEL kernelСɤĶѿƤʤХǥեȤNPTLglibc󥯤졢2.4.19ʤɤȤLinuxThreadsǤglibc󥯤롣

λȤ߼Τϡshared libraryɬפȤkernelСФơߤμkernelС񤭤뤿ΤΤĶѿ LD_ASSUME_KERNEL оݤkernelСȡld¹ԻˤkernelС˱shared library󥯤Ȥˡ(ΥС礭СɬפȤshared library󥯤ʤ)NPTLglibckernelС2.4.20˰¸Ƥ뤿ᡢLD_ASSUME_KERNELˤ̤οäƤȡΥСǥ󥯲ǽglibc(LinuxThreads)󥯤뤿ᤳʵưˤʤ롣

ʤߤưCentOS4ϤdzǧCentOS5ϤκǾ󥹥ȡȡLinuxThreadsߴglibcϥ󥹥ȡ뤵ʤ褦

åɼγǧΤ˰ʲΥޥɤѰդƤ롣

% getconf GNU_LIBPTHREAD_VERSION

ʲºݤưưǧΥץǷν꤫ޤ

% getconf GNU_LIBPTHREAD_VERSION
NPTL 2.3.4
% ldd ./mt
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00504000)
        libc.so.6 => /lib/tls/libc.so.6 (0x00353000)
        /lib/ld-linux.so.2 (0x00339000)
% ./mt
[2758]start
[2758]thread_id1=-1208775776
[2758]thread_id2=-1219265632
[2758][-1208775776]0
[2758][-1219265632]0
[2758][-1208775776]1
[2758][-1219265632]1
[2758][-1208775776]2
[2758][-1219265632]2
[2758][-1208775776]3
[2758][-1219265632]3
[2758][-1208775776]4
[2758][-1219265632]4
[2758][-1208775776]5
[2758][-1219265632]5
[2758][-1208775776]6
[2758][-1219265632]6
[2758][-1208775776]7
[2758][-1219265632]7
[2758][-1208775776]8
[2758][-1219265632]8
[2758][-1208775776]9
[2758][-1219265632]9
[2758]thread_id1 = -1208775776 end
[2758]thread_id2 = -1219265632 end
[2758]end
zsh: exit 10    ./mt
%

줬̾NPTLư̡줾̡ΥåidʧФƤ뤬pidϤɤ2758Ƕ̡

LinuxThreadsȡ

% export LD_ASSUME_KERNEL=2.4.19
% getconf GNU_LIBPTHREAD_VERSION
linuxthreads-0.10
LinuxThreadsˤʤä
% ldd ./mt
        libpthread.so.0 => /lib/i686/libpthread.so.0 (0x0069d000)
        libc.so.6 => /lib/i686/libc.so.6 (0x00ae9000)
        /lib/ld-linux.so.2 (0x00339000)
/lib/tls/ʲshared library/lib/i686/ʲΤΤ֤äƥ󥯤
% ./mt
[2854]start
[2854]thread_id1=16386
[2854]thread_id2=32771
[2856][16386]0
[2857][32771]0
[2856][16386]1
[2857][32771]1
[2856][16386]2
[2857][32771]2
[2856][16386]3
[2857][32771]3
[2856][16386]4
[2857][32771]4
[2856][16386]5
[2857][32771]5
[2856][16386]6
[2857][32771]6
[2856][16386]7
[2857][32771]7
[2856][16386]8
[2857][32771]8
[2856][16386]9
[2857][32771]9
[2854]thread_id1 = 16386 end
[2854]thread_id2 = 32771 end
[2854]end
zsh: exit 10    ./mt
%
åid̤ʤС줾Υåɤpid̡åidκ֥롼餫˰㤦

Ȥ櫓ǡ2.6kernelǤLinuxThreadsȤȤϤǤ2.6kernelǤϥ塼ʤɤ㤦Τǡ٤ưΤΤ2.4ϤȰˤʤ櫓ǤϤʤLinuxThreads˰¸Хʥ¹ԤˤϽʬǽΥ٥ޡϼäƤʤɤ⡢LinuxThreadsNPTL®ͳʤΤǡǽͳLinuxThreaadsȤȤʤȻפ

ܤpthreads(7)

scsiХΥꥹˡ

٥󶡤ѤΥޥɤѰդƤȤˤϤäȤäμ

ŪLinuxΰŪscsiǥХξ
# echo "scsi add-single-device 0 0 1 0" > /proc/scsi/scsi
rescanȤtargetǧΤˤ롣οϤ줾졢host bus target(id) lun

Solarisξ
# drvconfig

SPARCokץץȤξ
ok probe-scsiޤ
ok probe-scsi-all

VMware ESXservice consoleξ
# esxcfg-rescan [vmhbaΥǥХ̾]

Debian GNU/LinuxΥåץǡȤproxyͳǹԤ

줫餪ŻDebian GNU/Linux򤿤ȤȤˤʤꤽޤϥåץǡȤˡ餤ΤʤȤ͡äƤȤǤäĴ٤Ƥߤ

ʬȤ󥿡ͥåȤãǤʤʤɡľܳ˽ФʤȤ˷ҤäƤ硢ȤꤢľproxyDzȤǤʤϺapt-getޥɤǥåץǡȤproxyλˡϤʲ2Τ褦

  • Ķѿhttp_proxy(ɬפˤäftp_proxy)
  • /etc/apt/apt.conf
  Acquire {
     http {
        Proxy "http://proxy:8080";;
     };
     ftp {
        Proxy "http://proxy:8080";;
     };
  }

㳰ȤȤǤߤ

ȤsquidʤapacheʤproxyΥå奵ФǤäƤס

̲ΤǤ̵ǰ