<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>icez network &#187; cdn</title>
	<atom:link href="http://www.icez.net/blog/tags/cdn/feed" rel="self" type="application/rss+xml" />
	<link>http://www.icez.net/blog</link>
	<description>Technical Blog by icez network</description>
	<lastBuildDate>Mon, 30 Jan 2012 17:31:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>0107 &#124; upic.me traffic by country</title>
		<link>http://www.icez.net/blog/798/upic-me-traffic-by-country</link>
		<comments>http://www.icez.net/blog/798/upic-me-traffic-by-country#comments</comments>
		<pubDate>Thu, 26 Aug 2010 20:10:32 +0000</pubDate>
		<dc:creator>icez</dc:creator>
				<category><![CDATA[IP Network]]></category>
		<category><![CDATA[cdn]]></category>
		<category><![CDATA[upicme]]></category>

		<guid isPermaLink="false">http://www.icez.net/blog/?p=798</guid>
		<description><![CDATA[ปล่อยให้มันเก็บสถิติมาวันนึงเต็มๆ ตอนนี้ได้ผลออกมาแล้วครับ ข้อมูลจาก node th-inter ตัวที่ 1 &#8220;ตัวเดียว&#8221; ครับ ประมาณ 1/2 ของการใช้งานจากต่างประเทศ ยกเว้นประเทศสิงคโปร์ และอเมริกา ที่ส่วนใหญ่จะไปเข้า local node ก่อนอื่น&#8230; กราฟสวยๆ ดูดีเนาะ 555+ การใช้งานส่วนใหญ่มาจากฝั่งเอเชียนี่เองครับ จีน ไต้หวัน ญี่ปุ่น เกาหลี ฮ่องกง เวียดนาม ติด top 10 กันถ้วนหน้าเลยกับเว็บ upic.me (แหม่&#8230; ดีใจ 555) ส่วน US ที่ติดมาสืบเนื่องจาก node us มันก็มาดึงข้อมูลจาก node นี้ไปอีกทีแหละครับ ฮาๆ มาดูข้อมูลดิบกันบ้าง จำนวนการเรียกใช้งานทั้งหมด 3,742,108 ครั้ง ในเวลา 22 ชั่วโมงโดยประมาณ แยกเป็นประเทศได้ตามนี้ (หน่วยเป็น byte [...]]]></description>
			<content:encoded><![CDATA[<p>ปล่อยให้มันเก็บสถิติมาวันนึงเต็มๆ<br />
ตอนนี้ได้ผลออกมาแล้วครับ</p>
<p>ข้อมูลจาก node th-inter ตัวที่ 1 &#8220;ตัวเดียว&#8221; ครับ ประมาณ 1/2 ของการใช้งานจากต่างประเทศ<br />
ยกเว้นประเทศสิงคโปร์ และอเมริกา ที่ส่วนใหญ่จะไปเข้า local node</p>
<p>ก่อนอื่น&#8230; กราฟสวยๆ</p>
<p align="center"><a href="http://upic.me/show/15986815" target="_blank"><img border="0" src="http://upic.me/i/69/87q7c.png"></a></p>
<p>ดูดีเนาะ 555+<br />
การใช้งานส่วนใหญ่มาจากฝั่งเอเชียนี่เองครับ จีน ไต้หวัน ญี่ปุ่น เกาหลี ฮ่องกง เวียดนาม<br />
ติด top 10 กันถ้วนหน้าเลยกับเว็บ upic.me (แหม่&#8230; ดีใจ 555)</p>
<p>ส่วน US ที่ติดมาสืบเนื่องจาก node us มันก็มาดึงข้อมูลจาก node นี้ไปอีกทีแหละครับ ฮาๆ</p>
<p><span id="more-798"></span></p>
<p>มาดูข้อมูลดิบกันบ้าง</p>
<p>จำนวนการเรียกใช้งานทั้งหมด 3,742,108 ครั้ง ในเวลา 22 ชั่วโมงโดยประมาณ<br />
แยกเป็นประเทศได้ตามนี้ (หน่วยเป็น byte นะครับ)</p>
<p>China => 202,095,141,780<br />
Taiwan => 30,763,908,755<br />
Japan => 14,640,094,095<br />
Australia => 7,493,311,135<br />
Korea => 7,468,662,887<br />
Hong Kong => 6,542,781,622<br />
Norway => 4,919,033,297<br />
Vietnam => 3,853,647,397<br />
United States => 3,124,140,435<br />
Indonesia => 1,951,024,078<br />
Lao People&#8217;s Democratic Republic => 1,766,248,579<br />
Philippines => 1,704,711,565<br />
Singapore => 1,337,961,045<br />
Sweden => 1,107,215,911<br />
Saudi Arabia => 999,220,699<br />
Egypt => 868,521,618<br />
New Zealand => 723,835,429<br />
Netherlands => 632,524,618<br />
Switzerland => 617,493,578<br />
Spain => 526,749,286<br />
India => 514,174,899<br />
Romania => 441,918,501<br />
Denmark => 426,992,184<br />
Russian Federation => 421,435,931<br />
Satellite Provider => 361,535,996<br />
Brazil => 349,569,983<br />
Macao => 320,394,255<br />
Poland => 309,159,056<br />
Peru => 285,441,537<br />
Mexico => 280,519,642<br />
Belgium => 271,067,356<br />
Finland => 228,320,020<br />
Cambodia => 218,235,864<br />
Israel => 207,022,815<br />
Qatar => 201,281,637<br />
Ireland => 182,970,473<br />
Turkey => 181,759,920<br />
Chile => 173,441,405<br />
Iran => 171,209,368<br />
Portugal => 156,470,473<br />
Mongolia => 151,870,726<br />
Austria => 140,058,698<br />
Argentina => 134,664,927<br />
Hungary => 110,891,007<br />
Bulgaria => 107,699,820<br />
Colombia => 106,465,842<br />
Venezuela => 105,622,605<br />
Morocco => 87,054,948<br />
Kuwait => 66,969,144<br />
Brunei Darussalam => 66,926,526<br />
Greece => 65,023,869<br />
Myanmar => 64,619,894<br />
Latvia => 63,662,660<br />
Germany => 54,857,294<br />
Kazakhstan => 54,557,312<br />
Iceland => 50,645,677<br />
United Kingdom => 50,472,042<br />
Pakistan => 49,128,446<br />
Sri Lanka => 47,442,564<br />
Anonymous Proxy => 44,293,355<br />
South Africa => 40,663,825<br />
Tunisia => 39,690,111<br />
Croatia => 38,689,539<br />
Slovenia => 37,174,011<br />
Costa Rica => 35,742,173<br />
Slovakia => 34,062,566<br />
Oman => 33,970,500<br />
Panama => 30,140,865<br />
Ecuador => 28,924,437<br />
Syrian Arab Republic => 27,284,402<br />
Serbia => 27,167,138<br />
Bhutan => 26,489,490<br />
Sudan => 25,870,512<br />
Jordan => 25,649,128<br />
Mauritius => 25,299,294<br />
Puerto Rico => 24,150,921<br />
Algeria => 21,960,035<br />
Lithuania => 21,290,085<br />
Palestinian Territory => 20,965,637<br />
Bahrain => 20,053,995<br />
Libyan Arab Jamahiriya => 19,502,854<br />
Bolivia => 19,148,809<br />
France => 19,042,514<br />
Estonia => 18,837,829<br />
Dominican Republic => 16,682,118<br />
Yemen => 15,454,628<br />
Iraq => 15,210,516<br />
Paraguay => 15,003,142<br />
Azerbaijan => 14,008,267<br />
Angola => 13,663,817<br />
Bangladesh => 13,235,630<br />
Madagascar => 13,095,413<br />
Guatemala => 12,847,665<br />
Cyprus => 12,464,925<br />
Luxembourg => 11,510,883<br />
Nepal => 11,459,579<br />
Trinidad and Tobago => 11,336,978<br />
Guam => 10,297,892<br />
Malta => 10,271,033<br />
El Salvador => 9,751,282<br />
Maldives => 9,657,324<br />
Faroe Islands => 9,549,256<br />
Nigeria => 9,429,125<br />
N/A => 9,086,745<br />
Northern Mariana Islands => 8,964,550<br />
Cote d&#8217;Ivoire => 8,395,061<br />
Albania => 7,060,391<br />
Georgia => 6,486,080<br />
Uruguay => 5,978,795<br />
Tanzania => 5,792,166<br />
Macedonia => 5,462,526<br />
Jamaica => 5,446,743<br />
Cayman Islands => 5,300,771<br />
Virgin Islands => 5,047,478<br />
Ukraine => 4,682,547<br />
Moldova => 4,588,322<br />
Bosnia and Herzegovina => 4,265,196<br />
Italy => 3,669,517<br />
Greenland => 3,634,035<br />
Congo => 3,537,780<br />
Lebanon => 3,513,405<br />
Chad => 3,050,376<br />
Ghana => 2,974,198<br />
Senegal => 2,702,979<br />
Mozambique => 2,453,999<br />
Nicaragua => 2,411,013<br />
Belarus => 2,358,961<br />
Kenya => 2,189,134<br />
Honduras => 2,178,059<br />
Anguilla => 2,069,787<br />
Gabon => 1,959,629<br />
Guyana => 1,716,600<br />
Kyrgyzstan => 1,650,110<br />
Rwanda => 1,630,538<br />
Satellite Provider => 1,614,305<br />
Mauritania => 1,564,111<br />
Cameroon => 1,562,752<br />
Tajikistan => 1,351,951<br />
French Polynesia => 1,286,239<br />
Bahamas => 1,272,910<br />
Bermuda => 1,168,327<br />
Namibia => 1,122,896<br />
Equatorial Guinea => 968,711<br />
Ethiopia => 964,567<br />
Samoa => 928,088<br />
Czech Republic => 901,837<br />
Uzbekistan => 838,534<br />
Liechtenstein => 780,715<br />
Suriname => 763,885<br />
Satellite Provider => 761,500<br />
New Caledonia => 723,001<br />
Aruba => 689,709<br />
Jersey => 631,052<br />
Djibouti => 611,903<br />
Seychelles => 598,085<br />
Uganda => 577,081<br />
Mali => 551,049<br />
Zimbabwe => 520,859<br />
Burkina Faso => 484,435<br />
Fiji => 481,484<br />
Armenia => 465,542<br />
Aland Islands => 431,218<br />
Botswana => 425,821<br />
Saint Vincent and the Grenadines => 324,732<br />
Asia/Pacific Region => 304,056<br />
Cook Islands => 237,992<br />
Papua New Guinea => 209,561<br />
Barbados => 156,931<br />
Belize => 137,707<br />
Gibraltar => 132,739<br />
Grenada => 110,107<br />
Satellite Provider => 104,744<br />
Reunion => 85,409<br />
Montenegro => 82,144<br />
Saint Kitts and Nevis => 70,953<br />
Antigua and Barbuda => 21,244<br />
Saint Lucia => 12,181<br />
Monaco => 11,461</p>
]]></content:encoded>
			<wfw:commentRss>http://www.icez.net/blog/798/upic-me-traffic-by-country/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>0100 &#124; บริการ Public DNS ช่วยให้เข้าเว็บได้เร็วขึ้นจริงหรือ?</title>
		<link>http://www.icez.net/blog/686/did-public-dns-make-web-browsing-faster</link>
		<comments>http://www.icez.net/blog/686/did-public-dns-make-web-browsing-faster#comments</comments>
		<pubDate>Wed, 16 Jun 2010 13:31:27 +0000</pubDate>
		<dc:creator>icez</dc:creator>
				<category><![CDATA[IP Network]]></category>
		<category><![CDATA[cdn]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[internet]]></category>

		<guid isPermaLink="false">http://www.icez.net/blog/?p=686</guid>
		<description><![CDATA[บทความนี้เรียบเรียงมาจากต้นฉบับตามนี้ครับ http://www.neowin.net/news/public-dns-providers-do-they-actually-improve-your-experience . บริการ Public DNS จำพวก OpenDNS และ Google Public DNS ได้รับความสนใจอย่างมากเนื่องด้วยการโฆษณาว่าสามารถเพิ่มความเร็วในการเข้าชมเว็บไซต์ได้มากขึ้นเพียงแค่เปลี่ยนการตั้งค่า DNS resolver บนเครื่องคอมพิวเตอร์ของคุณเท่านั้น สาเหตุหนึ่งก็เนื่องมาจาก ISP หลายๆ รายไม่ได้ลงทุนในการทำโครงสร้าง DNS ให้ดี ซึ่งทำให้ความเร็วในการตอบสนองช้าโดยเฉพาะช่วงเวลาเร่งด่วน จึงได้มีบริการ Public DNS ที่สร้างเพื่อรองรับปริมาณกาการใช้งาน DNS มหาศาลเหล่านี้&#8230; แต่มันดีขึ้นจริงๆ หรือ? ก่อนอื่น เราต้องเข้าใจก่อนว่า ISP ที่เราใช้บริการอยู่ จะมี DNS resolver ที่ติดตั้งอยู่ภายในเครือข่ายเดียวกับที่เราต่อเน็ตเข้าไป ส่วนการใช้บริการจากภายนอกอย่างเช่น OpenDNS หรือ Google DNS service นั้นจะเป็นการเชื่อมต่อออกภายนอกเครือข่าย ซึ่งทำให้การติดต่อ DNS เหล่านั้นต้องเดินทางไกลขึ้นเพื่อที่จะไปให้ถึง Server (โดยเฉพาะการใช้งานจากประเทศไทย ที่ไม่ว่า Google DNS หรือ [...]]]></description>
			<content:encoded><![CDATA[<p>บทความนี้เรียบเรียงมาจากต้นฉบับตามนี้ครับ<br />
<a href="http://www.neowin.net/news/public-dns-providers-do-they-actually-improve-your-experience">http://www.neowin.net/news/public-dns-providers-do-they-actually-improve-your-experience</a></p>
<p>.</p>
<p>บริการ Public DNS จำพวก <a href="http://www.blognone.com/node/2625">OpenDNS</a> และ <a href="http://www.blognone.com/node/14139/">Google Public DNS</a> ได้รับความสนใจอย่างมากเนื่องด้วยการโฆษณาว่าสามารถเพิ่มความเร็วในการเข้าชมเว็บไซต์ได้มากขึ้นเพียงแค่เปลี่ยนการตั้งค่า DNS resolver บนเครื่องคอมพิวเตอร์ของคุณเท่านั้น สาเหตุหนึ่งก็เนื่องมาจาก ISP หลายๆ รายไม่ได้ลงทุนในการทำโครงสร้าง DNS ให้ดี ซึ่งทำให้ความเร็วในการตอบสนองช้าโดยเฉพาะช่วงเวลาเร่งด่วน จึงได้มีบริการ Public DNS ที่สร้างเพื่อรองรับปริมาณกาการใช้งาน DNS มหาศาลเหล่านี้&#8230; แต่มันดีขึ้นจริงๆ หรือ?</p>
<p>ก่อนอื่น เราต้องเข้าใจก่อนว่า ISP ที่เราใช้บริการอยู่ จะมี DNS resolver ที่ติดตั้งอยู่ภายในเครือข่ายเดียวกับที่เราต่อเน็ตเข้าไป ส่วนการใช้บริการจากภายนอกอย่างเช่น OpenDNS หรือ Google DNS service นั้นจะเป็นการเชื่อมต่อออกภายนอกเครือข่าย ซึ่งทำให้การติดต่อ DNS เหล่านั้นต้องเดินทางไกลขึ้นเพื่อที่จะไปให้ถึง Server (โดยเฉพาะการใช้งานจากประเทศไทย ที่ไม่ว่า Google DNS หรือ OpenDNS ล้วนแล้วแต่อยู่ต่างประเทศทั้งสิ้น : เพิ่มเติมโดยผู้แปล) และอย่าลืมว่า การเดินทางที่ไกลขึ้น เท่ากับว่าต้องใช้เวลามากขึ้นกว่าการรับส่งข้อมูลจะสมบูรณ์</p>
<p>* เพิ่มเติม: การใช้งาน Google DNS ในประเทศไทย จะติดต่อไปยัง server ของ Google ที่สิงคโปร์ ส่วน OpenDNS นั้นต้องติดต่อไปไกลถึงอเมริกาเลยทีเดียว</p>
<p>แล้ว DNS มีผลต่อการเข้าชมเว็บไซต์มากขนาดไหน? คำตอบคือ &#8220;น้อยมาก&#8221; เพราะการเข้าชมเว็บไซต์แต่ละครั้ง ใน &#8220;ครั้งแรก&#8221; ก่อนการเชื่อมต่อ เครื่องคอมพิวเตอร์จะสอบถามข้อมูล IP ของเว็บไซต์ไปยัง DNS resolver ตามที่ได้ระบุไว้ จากนั้นจึง &#8220;เก็บ&#8221; ข้อมูลดังกล่าวไว้ภายในหน่วยความจำตลอดการเข้าใช้งาน หรือจนกว่าข้อมูลจะหมดอายุไปตามที่ได้ระบุใน DNS ของแต่ละ domain เอง (ในค่า TTL) ดังนั้นถึงแม้ว่าการที่เราใช้ DNS resolver ที่เร็วกว่า ก็ไม่ได้หมายความว่าเราจะสามารถโหลดข้อมูลเว็บไซต์ได้เร็วกว่าแต่อย่างใด ในทางปฏิบัติจริงๆ แล้ว มันสามารถช่วยได้เพียงเล็กน้อย &#8230; ซึ่งวัดกันในหน่วย มิลลิวินาที (1/1000 วินาที) ด้วยซ้ำไป</p>
<p>แล้วทีนี้? ปัจจุบันเนื่องจากปริมาณข้อมูลที่ถูกสร้างจากผู้ใช้ (user-generated content) มีมากขึ้นเรื่อยๆ ประกอบกับการขยายตัวของบริการซอฟต์แวร์ (software-as-a-service) ทำให้หลายๆ บริษัทมองมาที่ระบบ CDN (Content Delivery Networks) ที่ช่วยกระจายข้อมูลให้ผู้ใช้งาน โดยหลักการง่ายๆ ก็คือ ระบบ CDN จะกระจายข้อมูลเหมือนๆ กันลงไปที่แต่ละ node ทั่วโลก แล้วเมื่อผู้ใช้ต้องการเรียกใช้งาน ระบบ CDN ก็จะส่งข้อมูลไปให้จาก node ที่อยู่ &#8220;ใกล้ผู้ใช้&#8221; มากที่สุด ทำให้ผู้ใช้สามารถเรียกข้อมูลได้เร็วขึ้นมาก รวมถึงการลดปริมาณการใช้งาน bandwidth ของเจ้าของเว็บไซต์อีกด้วย</p>
<p>แล้ว DNS มาเกี่ยวอะไรด้วย? วิธีตรวจสอบที่อยู่ว่า ผู้ใช้ร้องขอการใช้งานจากส่วนไหนของโลกของ CDN ส่วนใหญ่ จะใช้วิธีตรวจสอบจากที่มาของการสอบถามข้อมูล IP ผ่าน DNS resolver &#8230; ซึ่งการสอบถาม IP นี้ browser จะสอบถามไปยัง DNS resolver ตามที่ตั้งค่าไว้ จากนั้น DNS resolver ดังกล่าวจึงไปร้องขอข้อมูล IP จาก Nameserver ที่รับการใช้งานของ domain นั้นๆ อีกที (เรียกว่า Authoritive NS) แล้ว Nameserver ก็จะตรวจสอบที่มาของการร้องขอข้อมูลนั้น แล้วส่ง IP ที่อยู่พื้นที่ใกล้เคียงที่สุดไปให้</p>
<p>ปัญหามันเกิดขึ้นเมื่อ&#8230; คุณไม่ได้ใช้ DNS resolver ของ ISP ที่อยู่ใกล้เคียงคุณมากที่สุด นั่นจะทำให้คุณได้รับ IP ของ CDN ที่อยู่ใกล้เคียง DNS resolver แทน อย่างเช่นหากคุณใช้บริการอย่าง OpenDNS ไปร้องขอ IP ของเว็บไซต์ &#8230; คุณจะได้รับ IP ของประเทศอเมริกากลับมา ทำให้การใช้งานเป็นไปอย่างล่าช้ามากกว่าเดิมมาก ซึ่งเป็นผลให้คุณเข้าถึงข้อมูลที่อยู่บนบริการ CDN ได้ช้าลงมากๆ ด้วย และอย่าลืมว่า DNS request ใช้ปริมาณข้อมูลเพียงไม่กี่ byte เท่านั้น แต่การรับส่งข้อมูลของบริการ CDN นั้นต่างกันอย่างมหาศาล เนื่องจากข้อมูลส่วนใหญ่ของ CDN จะเป็นรูปภาพและวีดีโอ ซึ่งขนาดใหญ่กว่ากันมากขึ้นอย่างสังเกตได้ชัดเจนมากๆ เลยทีเดียว</p>
<p>ถึงแม้ว่า OpenDNS จะมีบริการเสริมอย่างเช่นการกรองข้อมูล และป้องกันฟิชชิ่ง (phishing) ด้วยก็ตาม แต่ถ้าเป้าหมายหลักของคุณคือการทำให้การเข้าเว็บเร็วขึ้น ดังนั้นควรเลี่ยงบริการ public DNS เหล่านี้ โดยเฉพาะหากเว็บไซต์ที่คุณเข้าใช้บริการบ่อยๆ มีการใช้ CDN ด้วยอย่างเช่น Facebook และ Youtube</p>
<p>.</p>
<p>.</p>
<p>ด้านล่างนี่ผลการทดสอบครับ<br />
ต้นทางทดสอบจาก CAT-IDC กสท.บางรักครับ</p>
<p>Google Public DNS<br />
Answer = 58.27.22.0/24 => Malaysia<br />
Time = 42ms</p>
<blockquote><p>;; QUESTION SECTION:<br />
;static.ak.fbcdn.net.           IN      A</p>
<p>;; ANSWER SECTION:<br />
static.ak.fbcdn.net.    5226    IN      CNAME   static.ak.facebook.com.edgesuite.net.<br />
static.ak.facebook.com.edgesuite.net. 19130 IN CNAME a749.g.akamai.net.<br />
a749.g.akamai.net.      14      IN      A       58.27.22.26<br />
a749.g.akamai.net.      14      IN      A       58.27.22.91<br />
a749.g.akamai.net.      14      IN      A       58.27.22.65<br />
a749.g.akamai.net.      14      IN      A       58.27.22.9<br />
a749.g.akamai.net.      14      IN      A       58.27.22.32<br />
a749.g.akamai.net.      14      IN      A       58.27.22.42</p>
<p>;; Query time: 42 msec<br />
;; SERVER: 8.8.8.8#53(8.8.8.8)<br />
;; WHEN: Wed Jun 16 19:59:15 2010<br />
;; MSG SIZE  rcvd: 208</p></blockquote>
<p>OpenDNS<br />
Answer = 208.50.77.0/24 => USA<br />
Time = 236ms</p>
<blockquote><p>;; QUESTION SECTION:<br />
;static.ak.fbcdn.net.           IN      A</p>
<p>;; ANSWER SECTION:<br />
static.ak.fbcdn.net.    6302    IN      CNAME   static.ak.facebook.com.edgesuite.net.<br />
static.ak.facebook.com.edgesuite.net. 20706 IN CNAME a749.g.akamai.net.<br />
a749.g.akamai.net.      10      IN      A       208.50.77.113<br />
a749.g.akamai.net.      10      IN      A       208.50.77.72<br />
a749.g.akamai.net.      10      IN      A       208.50.77.81<br />
a749.g.akamai.net.      10      IN      A       208.50.77.96</p>
<p>;; Query time: 236 msec<br />
;; SERVER: 208.67.222.222#53(208.67.222.222)<br />
;; WHEN: Wed Jun 16 19:59:33 2010<br />
;; MSG SIZE  rcvd: 176</p></blockquote>
<p>THZHosting Public DNS (node ที่ csloxinfo cbw idc)<br />
Answer = 203.146.247.0/24 => Thailand (CSLoxinfo)<br />
Time = 4ms</p>
<blockquote><p>;; QUESTION SECTION:<br />
;static.ak.fbcdn.net.           IN      A</p>
<p>;; ANSWER SECTION:<br />
static.ak.fbcdn.net.    7121    IN      CNAME   static.ak.facebook.com.edgesuite.net.<br />
static.ak.facebook.com.edgesuite.net. 21522 IN CNAME a749.g.akamai.net.<br />
a749.g.akamai.net.      20      IN      A       203.146.247.38<br />
a749.g.akamai.net.      20      IN      A       203.146.247.37</p>
<p>;; Query time: 4 msec<br />
;; SERVER: 203.146.215.116#53(203.146.215.116)<br />
;; WHEN: Wed Jun 16 19:59:58 2010<br />
;; MSG SIZE  rcvd: 306
</p></blockquote>
<p>CAT ISP DNS Server<br />
Answer = 61.19.12.0/24 => Thailand (CAT IDC)<br />
Time = 0ms</p>
<blockquote><p>;; QUESTION SECTION:<br />
;static.ak.fbcdn.net.           IN      A</p>
<p>;; ANSWER SECTION:<br />
static.ak.fbcdn.net.    3800    IN      CNAME   static.ak.facebook.com.edgesuite.net.<br />
static.ak.facebook.com.edgesuite.net. 18200 IN CNAME a749.g.akamai.net.<br />
a749.g.akamai.net.      20      IN      A       61.19.12.41<br />
a749.g.akamai.net.      20      IN      A       61.19.12.72</p>
<p>;; Query time: 0 msec<br />
;; SERVER: 61.19.245.245#53(61.19.245.245)<br />
;; WHEN: Wed Jun 16 20:27:49 2010<br />
;; MSG SIZE  rcvd: 150</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.icez.net/blog/686/did-public-dns-make-web-browsing-faster/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>0096 &#124; เบื้องหลังความแรงของ upic.me</title>
		<link>http://www.icez.net/blog/546/upic-me-server-facility</link>
		<comments>http://www.icez.net/blog/546/upic-me-server-facility#comments</comments>
		<pubDate>Fri, 19 Feb 2010 13:29:21 +0000</pubDate>
		<dc:creator>icez</dc:creator>
				<category><![CDATA[IP Network]]></category>
		<category><![CDATA[Web Server]]></category>
		<category><![CDATA[bandwidth]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[cdn]]></category>
		<category><![CDATA[upicme]]></category>

		<guid isPermaLink="false">http://www.icez.net/blog/?p=546</guid>
		<description><![CDATA[อธิบายสั้นๆ ง่ายๆ ด้วยสองรูปนี้ ว่าแต่&#8230; แรงจริงเรอะ (ฮาาาาา)]]></description>
			<content:encoded><![CDATA[<p align="center">อธิบายสั้นๆ ง่ายๆ ด้วยสองรูปนี้</p>
<p align="center"><a href="http://upic.me/i/df/8l9kc.jpg" target="_blank" rel="lightbox[546]"><img border="0" src="http://upic.me/tw/i/df/8l9kc.jpg"></a> <a href="http://upic.me/i/i3/0uakc.jpg" target="_blank" rel="lightbox[546]"><img border="0" src="http://upic.me/tw/i/i3/0uakc.jpg"></a></p>
<p align="center">ว่าแต่&#8230; แรงจริงเรอะ (ฮาาาาา)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.icez.net/blog/546/upic-me-server-facility/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>0088 &#124; LUSCA CDN installation</title>
		<link>http://www.icez.net/blog/477/lusca-cdn-installation</link>
		<comments>http://www.icez.net/blog/477/lusca-cdn-installation#comments</comments>
		<pubDate>Thu, 14 Jan 2010 10:31:50 +0000</pubDate>
		<dc:creator>icez</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[cdn]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[lusca]]></category>

		<guid isPermaLink="false">http://www.icez.net/blog/?p=477</guid>
		<description><![CDATA[จดไว้กันลืมครับ ไม่ต้องใส่ใจมากมาย http://code.google.com/p/lusca-cache/downloads/list ./configure --prefix=/usr/local/lusca --with-maxfd=32768 --with-aio --with-pthreads --disable-ident-lookups --enable-snmp --enable-storeio=&#34;aufs&#34; --enable-removal-policies=&#34;heap lru&#34; --disable-wccp &#38;&#38; make &#38;&#38; make install ln -s /usr/local/lusca/etc /etc/lusca ln -s /usr/local/lusca/var/logs /var/log/lusca mkdir /usr/local/lusca/var/cache chown nobody /usr/local/lusca/var/cache /usr/local/lusca/var/logs ln -s /usr/local/lusca/sbin/squid /usr/sbin/squid ln -s /usr/local/lusca/bin/squidclient /usr/bin/squidclient cron 4 * * * * /usr/sbin/squid -k rotate config acl all src all [...]]]></description>
			<content:encoded><![CDATA[<p>จดไว้กันลืมครับ ไม่ต้องใส่ใจมากมาย</p>
<p><a href="http://code.google.com/p/lusca-cache/downloads/list">http://code.google.com/p/lusca-cache/downloads/list</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lusca <span style="color: #660033;">--with-maxfd</span>=<span style="color: #000000;">32768</span> <span style="color: #660033;">--with-aio</span> <span style="color: #660033;">--with-pthreads</span> <span style="color: #660033;">--disable-ident-lookups</span> <span style="color: #660033;">--enable-snmp</span> <span style="color: #660033;">--enable-storeio</span>=<span style="color: #ff0000;">&quot;aufs&quot;</span> <span style="color: #660033;">--enable-removal-policies</span>=<span style="color: #ff0000;">&quot;heap lru&quot;</span> <span style="color: #660033;">--disable-wccp</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lusca<span style="color: #000000; font-weight: bold;">/</span>etc <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>lusca
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lusca<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>logs <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>lusca
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lusca<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache
<span style="color: #c20cb9; font-weight: bold;">chown</span> nobody <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lusca<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lusca<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>logs
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lusca<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>squid <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>squid
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lusca<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>squidclient <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>squidclient</pre></div></div>

<p>cron</p>

<div class="wp_syntax"><div class="code"><pre class="cron" style="font-family:monospace;">4 * * * * /usr/sbin/squid -k rotate</pre></div></div>

<p>config</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">acl <span style="color: #0000ff;">all</span> src <span style="color: #0000ff;">all</span>
acl manager proto cache_object
acl localhost src 127.0.0.1/<span style="color: #ff0000;">32</span>
acl CONNECT method CONNECT
http_access <span style="color: #00007f;">allow</span> manager localhost
http_access <span style="color: #00007f;">deny</span> manager
http_access <span style="color: #00007f;">deny</span> CONNECT
acl upic_host dst 124.109.2.175 124.109.2.176
acl upic_port <span style="color: #00007f;">port</span> <span style="color: #ff0000;">80</span>
http_access <span style="color: #00007f;">allow</span> upic_host upic_port
http_access <span style="color: #00007f;">deny</span> <span style="color: #0000ff;">all</span>
icp_access <span style="color: #00007f;">deny</span> <span style="color: #0000ff;">all</span>
http_port <span style="color: #ff0000;">80</span> accel vhost
cache_peer 124.109.2.176 parent <span style="color: #ff0000;">80</span> <span style="color: #ff0000;">0</span> weight=<span style="color: #ff0000;">5</span> no-query round-robin
cache_peer 124.109.2.175 parent <span style="color: #ff0000;">80</span> <span style="color: #ff0000;">0</span> weight=<span style="color: #ff0000;">5</span> no-query round-robin
cache_mem <span style="color: #ff0000;">32</span> MB
maximum_object_size_in_memory <span style="color: #ff0000;">16</span> KB
memory_replacement_policy heap GDSF
cache_replacement_policy heap LFUDA
cache_dir aufs /usr/local/lusca/var/cache <span style="color: #ff0000;">8192</span> <span style="color: #ff0000;">16</span> <span style="color: #ff0000;">256</span>
<span style="color: #00007f;">logformat</span> combined %&gt;a %ui %un [%tl] <span style="color: #7f007f;">&quot;%rm %ru HTTP/%rv&quot;</span> %Hs %&lt;st <span style="color: #7f007f;">&quot;%{Referer}&gt;h&quot;</span> <span style="color: #7f007f;">&quot;%{User-Agent}&gt;h&quot;</span> %Ss:%Sh
access_log /usr/local/lusca/var/logs/access.log combined
cache_store_log <span style="color: #0000ff;">none</span>
logfile_rotate <span style="color: #ff0000;">24</span>
refresh_pattern ^ftp:           <span style="color: #ff0000;">1440</span>    <span style="color: #ff0000;">20</span>%     <span style="color: #ff0000;">10080</span>
refresh_pattern ^gopher:        <span style="color: #ff0000;">1440</span>    <span style="color: #ff0000;">0</span>%      <span style="color: #ff0000;">1440</span>
refresh_pattern -i (/cgi-bin/|\?) <span style="color: #ff0000;">0</span>     <span style="color: #ff0000;">0</span>%      <span style="color: #ff0000;">0</span>
refresh_pattern .               <span style="color: #ff0000;">0</span>       <span style="color: #ff0000;">20</span>%     <span style="color: #ff0000;">4320</span>
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[<span style="color: #ff0000;">0</span>-<span style="color: #ff0000;">9</span>]
upgrade_http0.9 <span style="color: #00007f;">deny</span> shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding <span style="color: #00007f;">allow</span> apache
cache_effective_user nobody
server_persistent_connections <span style="color: #0000ff;">off</span>
acl nullreferer referer_regex ^$
cache <span style="color: #00007f;">deny</span> nullreferer
visible_hostname cdn.upic.me
snmp_port <span style="color: #ff0000;">3401</span>
acl snmppublic snmp_community public
snmp_access <span style="color: #00007f;">allow</span> snmppublic localhost
snmp_access <span style="color: #00007f;">deny</span> <span style="color: #0000ff;">all</span>
never_direct <span style="color: #00007f;">allow</span> <span style="color: #0000ff;">all</span>
coredump_dir /usr/local/lusca/var/cache
pid_filename /var/run/lusca.pid</pre></div></div>

<p>/etc/init.d/lusca</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># squid         This shell script takes care of starting and stopping</span>
<span style="color: #666666; font-style: italic;">#               Squid Internet Object Cache</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># chkconfig: - 90 25</span>
<span style="color: #666666; font-style: italic;"># description: Squid - Internet Object Cache. Internet object caching is \</span>
<span style="color: #666666; font-style: italic;">#       a way to store requested Internet objects (i.e., data available \</span>
<span style="color: #666666; font-style: italic;">#       via the HTTP, FTP, and gopher protocols) on a system closer to the \</span>
<span style="color: #666666; font-style: italic;">#       requesting site than to the source. Web browsers can then use the \</span>
<span style="color: #666666; font-style: italic;">#       local Squid cache as a proxy HTTP server, reducing access time as \</span>
<span style="color: #666666; font-style: italic;">#       well as bandwidth consumption.</span>
<span style="color: #666666; font-style: italic;"># pidfile: /var/run/squid.pid</span>
<span style="color: #666666; font-style: italic;"># config: /etc/squid/squid.conf</span>
&nbsp;
<span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin
<span style="color: #7a0874; font-weight: bold;">export</span> PATH
&nbsp;
<span style="color: #666666; font-style: italic;"># Source function library.</span>
. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.d<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>functions
&nbsp;
<span style="color: #666666; font-style: italic;"># Source networking configuration.</span>
. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sysconfig<span style="color: #000000; font-weight: bold;">/</span>network
&nbsp;
<span style="color: #666666; font-style: italic;"># don't raise an error if the config file is incomplete</span>
<span style="color: #666666; font-style: italic;"># set defaults instead:</span>
<span style="color: #007800;">SQUID_OPTS</span>=<span style="color: #800000;">${SQUID_OPTS:-&quot;-D&quot;}</span>
<span style="color: #007800;">SQUID_PIDFILE_TIMEOUT</span>=<span style="color: #800000;">${SQUID_PIDFILE_TIMEOUT:-20}</span>
<span style="color: #007800;">SQUID_SHUTDOWN_TIMEOUT</span>=<span style="color: #800000;">${SQUID_SHUTDOWN_TIMEOUT:-100}</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># determine the name of the squid binary</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>squid <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #007800;">SQUID</span>=squid
&nbsp;
<span style="color: #007800;">prog</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$SQUID</span>&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># determine which one is the cache_swap directory</span>
<span style="color: #007800;">CACHE_SWAP</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/#.*//g'</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>lusca<span style="color: #000000; font-weight: bold;">/</span>squid.conf <span style="color: #000000; font-weight: bold;">|</span> \
        <span style="color: #c20cb9; font-weight: bold;">grep</span> cache_dir <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $3 }'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$CACHE_SWAP</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #007800;">CACHE_SWAP</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lusca<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #007800;">RETVAL</span>=<span style="color: #000000;">0</span>
&nbsp;
start<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #7a0874; font-weight: bold;">ulimit</span> <span style="color: #660033;">-HSn</span> <span style="color: #000000;">32768</span>
        <span style="color: #666666; font-style: italic;">#check if the squid conf file is present</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>lusca<span style="color: #000000; font-weight: bold;">/</span>squid.conf <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Configuration file /etc/lusca/squid.conf missing&quot;</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
            <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">6</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
        <span style="color: #666666; font-style: italic;"># don't raise an error if the config file is incomplete.</span>
        <span style="color: #666666; font-style: italic;"># set defaults instead:</span>
        <span style="color: #007800;">SQUID_OPTS</span>=<span style="color: #800000;">${SQUID_OPTS:-&quot;-D&quot;}</span>
        <span style="color: #007800;">SQUID_PIDFILE_TIMEOUT</span>=<span style="color: #800000;">${SQUID_PIDFILE_TIMEOUT:-20}</span>
        <span style="color: #007800;">SQUID_SHUTDOWN_TIMEOUT</span>=<span style="color: #800000;">${SQUID_SHUTDOWN_TIMEOUT:-100}</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$SQUID</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Insufficient privilege&quot;</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
                <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">4</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">for</span> adir <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$CACHE_SWAP</span>; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$adir</span><span style="color: #000000; font-weight: bold;">/</span>00 <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
             <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;init_cache_dir <span style="color: #007800;">$adir</span>... &quot;</span>
             <span style="color: #007800;">$SQUID</span> <span style="color: #660033;">-z</span> <span style="color: #660033;">-F</span> <span style="color: #660033;">-D</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>lusca<span style="color: #000000; font-weight: bold;">/</span>squid.out <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">done</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> $<span style="color: #ff0000;">&quot;Starting <span style="color: #007800;">$prog</span>: &quot;</span>
    <span style="color: #007800;">$SQUID</span> <span style="color: #007800;">$SQUID_OPTS</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>lusca<span style="color: #000000; font-weight: bold;">/</span>squid.out <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
    <span style="color: #007800;">RETVAL</span>=<span style="color: #007800;">$?</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$RETVAL</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
       <span style="color: #007800;">timeout</span>=<span style="color: #000000;">0</span>;
       <span style="color: #000000; font-weight: bold;">while</span> : ; <span style="color: #000000; font-weight: bold;">do</span>
          <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>lusca.pid <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">break</span>
          <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$timeout</span> <span style="color: #660033;">-ge</span> <span style="color: #007800;">$SQUID_PIDFILE_TIMEOUT</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
             <span style="color: #007800;">RETVAL</span>=<span style="color: #000000;">1</span>
             <span style="color: #7a0874; font-weight: bold;">break</span>
          <span style="color: #000000; font-weight: bold;">fi</span>
          <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;.&quot;</span>
          <span style="color: #007800;">timeout</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>timeout+<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
       <span style="color: #000000; font-weight: bold;">done</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$RETVAL</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lock<span style="color: #000000; font-weight: bold;">/</span>subsys<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SQUID</span>
    <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$RETVAL</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> echo_success
    <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$RETVAL</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> echo_failure
    <span style="color: #7a0874; font-weight: bold;">echo</span>
    <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #007800;">$RETVAL</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
stop<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># don't raise an error if the config file is incomplete.</span>
    <span style="color: #666666; font-style: italic;"># set defaults instead:</span>
    <span style="color: #007800;">SQUID_SHUTDOWN_TIMEOUT</span>=<span style="color: #800000;">${SQUID_SHUTDOWN_TIMEOUT:-100}</span>
&nbsp;
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span>  $<span style="color: #ff0000;">&quot;Stopping <span style="color: #007800;">$prog</span>: &quot;</span>
    <span style="color: #007800;">$SQUID</span> <span style="color: #660033;">-k</span> check <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>lusca<span style="color: #000000; font-weight: bold;">/</span>squid.out <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
    <span style="color: #007800;">RETVAL</span>=<span style="color: #007800;">$?</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$RETVAL</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">$SQUID</span> <span style="color: #660033;">-k</span> shutdown <span style="color: #000000; font-weight: bold;">&amp;</span>
        <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lock<span style="color: #000000; font-weight: bold;">/</span>subsys<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$SQUID</span>
        <span style="color: #007800;">timeout</span>=<span style="color: #000000;">0</span>
        <span style="color: #000000; font-weight: bold;">while</span> : ; <span style="color: #000000; font-weight: bold;">do</span>
                <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>lusca.pid <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">break</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$timeout</span> <span style="color: #660033;">-ge</span> <span style="color: #007800;">$SQUID_SHUTDOWN_TIMEOUT</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                    <span style="color: #7a0874; font-weight: bold;">echo</span>
                    <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">1</span>
                <span style="color: #000000; font-weight: bold;">fi</span>
                <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;.&quot;</span>
                <span style="color: #007800;">timeout</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>timeout+<span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">done</span>
        echo_success
        <span style="color: #7a0874; font-weight: bold;">echo</span>
    <span style="color: #000000; font-weight: bold;">else</span>
        echo_failure
        <span style="color: #7a0874; font-weight: bold;">echo</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #007800;">$RETVAL</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
reload<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #666666; font-style: italic;">#    . /etc/sysconfig/squid</span>
    <span style="color: #666666; font-style: italic;"># don't raise an error if the config file is incomplete.</span>
    <span style="color: #666666; font-style: italic;"># set defaults instead:</span>
    <span style="color: #007800;">SQUID_OPTS</span>=<span style="color: #800000;">${SQUID_OPTS:-&quot;-D&quot;}</span>
&nbsp;
    <span style="color: #007800;">$SQUID</span> <span style="color: #007800;">$SQUID_OPTS</span> <span style="color: #660033;">-k</span> reconfigure
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
restart<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    stop
    start
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
condrestart<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lock<span style="color: #000000; font-weight: bold;">/</span>subsys<span style="color: #000000; font-weight: bold;">/</span>squid <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> restart <span style="color: #000000; font-weight: bold;">||</span> :
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
rhstatus<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    status <span style="color: #007800;">$SQUID</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #007800;">$SQUID</span> <span style="color: #660033;">-k</span> check
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
probe<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">0</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    start
    <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    stop
    <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
reload<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    reload
    <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
restart<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    restart
    <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
condrestart<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    condrestart
    <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
status<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    rhstatus
    <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
probe<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
    <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #ff0000;">&quot;Usage: $0 {start|stop|status|reload|restart|condrestart}&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">2</span>
<span style="color: #000000; font-weight: bold;">esac</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$?</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.icez.net/blog/477/lusca-cdn-installation/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>0083 &#124; GeoDNS for BIND 9.2+</title>
		<link>http://www.icez.net/blog/373/geodns-for-bind-9-2</link>
		<comments>http://www.icez.net/blog/373/geodns-for-bind-9-2#comments</comments>
		<pubDate>Wed, 04 Nov 2009 10:44:17 +0000</pubDate>
		<dc:creator>icez</dc:creator>
				<category><![CDATA[IP Network]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[cdn]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[geodns]]></category>

		<guid isPermaLink="false">http://www.icez.net/blog/?p=373</guid>
		<description><![CDATA[เอาไว้ทำ CDN ได้ครับ ให้ dns lookup ออกมาตามประเทศ shell script (จำที่มาไม่ได้ ขออภัยด้วยครับ) #!/bin/bash cd /tmp /bin/rm -f GeoIPCountryCSV.zip wget -T 5 -t 1 http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip unzip GeoIPCountryCSV.zip &#124;&#124; exit 1 &#160; echo -n &#34;Creating CNM (Country,Net/Mask) CSV file...&#34; awk -F \&#34; 'function s(c,b,e,l,m,n) {l = log(e-b+1)/log(2); m = 2^32-2^int(l); n = and(m,e); if (n == and(m,b)) {printf [...]]]></description>
			<content:encoded><![CDATA[<p>เอาไว้ทำ CDN ได้ครับ ให้ dns lookup ออกมาตามประเทศ</p>
<p>shell script (จำที่มาไม่ได้ ขออภัยด้วยครับ)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp
<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> GeoIPCountryCSV.zip
<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-T</span> <span style="color: #000000;">5</span> <span style="color: #660033;">-t</span> <span style="color: #000000;">1</span> http:<span style="color: #000000; font-weight: bold;">//</span>geolite.maxmind.com<span style="color: #000000; font-weight: bold;">/</span>download<span style="color: #000000; font-weight: bold;">/</span>geoip<span style="color: #000000; font-weight: bold;">/</span>database<span style="color: #000000; font-weight: bold;">/</span>GeoIPCountryCSV.zip
<span style="color: #c20cb9; font-weight: bold;">unzip</span> GeoIPCountryCSV.zip <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Creating CNM (Country,Net/Mask) CSV file...&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span> <span style="color: #000000; font-weight: bold;">\&quot;</span> <span style="color: #ff0000;">'function s(c,b,e,l,m,n) {l = log(e-b+1)/log(2); m = 2^32-2^int(l); n = and(m,e); if (n == and(m,b)) {printf &quot;%s,%u.%u.%u.%u/%u\n&quot;,c,b/2^24%256,b/2^16%256,b/2^8%256,b%256,32-l} else {s(c,b,n-1); s(c,n,e)}} s($10,$6,$8)'</span> GeoIPCountryWhois.csv <span style="color: #000000; font-weight: bold;">&gt;</span> cnm.csv
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> GeoIPCountryWhois.csv
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;DONE<span style="color: #000099; font-weight: bold;">\n</span>Generating BIND GeoIP.acl file...&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">for</span> c <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span> , <span style="color: #ff0000;">'{print $1}'</span> cnm.csv <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> -u<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;acl <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">$c</span><span style="color: #000099; font-weight: bold;">\&quot;</span> {&quot;</span>
  <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;^<span style="color: #007800;">$c</span>,&quot;</span> cnm.csv <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span> , <span style="color: #ff0000;">'{print &quot;\t&quot;$2&quot;;&quot;}'</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;};<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>named.GeoIP.acl
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> cnm.csv
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;DONE&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>named reload
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p>แล้วไปแก้ named.conf</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">include</span> <span style="color: #7f007f;">&quot;/etc/named.GeoIP.acl&quot;</span>;
view <span style="color: #7f007f;">&quot;thailand&quot;</span> {
    match-clients { TH; };
        match-clients { TH; };
        zone <span style="color: #7f007f;">&quot;upic.me&quot;</span> {
                type master;
                file <span style="color: #7f007f;">&quot;master/th.db.upic.me&quot;</span>;
        };
}
view <span style="color: #7f007f;">&quot;inter&quot;</span> {
        match-clients { any; };
        zone <span style="color: #7f007f;">&quot;upic.me&quot;</span> {
                type master;
                file <span style="color: #7f007f;">&quot;master/all.db.upic.me&quot;</span>;
        };
};</pre></div></div>

<p>อยากได้ประเทศไหนก็ลองดู code ในไฟล์ /etc/named.GeoIP.acl ละกันครับ<br />
ส่วน&#8230; script ด้านบน<br />
เซฟแล้วเอาใส่ใน cron ด้วยเลยจะดีมาก รันสัปดาห์ละครั้ง</p>
]]></content:encoded>
			<wfw:commentRss>http://www.icez.net/blog/373/geodns-for-bind-9-2/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.icez.net @ 2012-02-10 16:57:34 -->
