<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title><![CDATA[David Liao's Blog :: 痞客邦 PIXNET ::]]></title>
    <link>https://david50.pixnet.net/blog</link>
    <description><![CDATA[<!-- 跑馬燈文字 Start -->
<script language="JavaScript1.2">              
<!--             
//Secify scroller contents              
var line=new Array()              
line[1]="一個平凡的人"              
line[2]="希望記錄些不平凡的事!"

//Specify font size for scoller              
var ts_fontsize="15px"              
              
//--Don't edit below this line             
             
var longestmessage=1             
for (i=1;i<line.length;i++){             
if (line[i].length>line[longestmessage].length)             
longestmessage=i             
}             
             
//Auto set scroller width             
var tscroller_width=line[longestmessage].length*3            
             
lines=line.length-1 //--Number of lines             
             
//if IE 4+ or NS6             
if (document.all||document.getElementById){             
document.write('<left> <form name="bannerform">')             
document.write('<input type="text" name="banner" size="30"' )                  
document.write('  style="background-color:#66bbff; color:#FFFFFF; font-weight:bold; font-family: tahoma; font-size: '+ts_fontsize+'; border: medium none" onfocus="blur()">')             
document.write('</form>')             
}             
             
temp=""             
nextchar=-1;             
nextline=1;             
cursor="\\"             
function animate(){             
if (temp==line[nextline] & temp.length==line[nextline].length & nextline!=lines){             
nextline++;             
nextchar=-1;             
document.bannerform.banner.value=temp;             
temp="";             
setTimeout("nextstep()",2000)}             
else if (nextline==lines & temp==line[nextline] & temp.length==line[nextline].length){             
nextline=1;             
nextchar=-1;             
document.bannerform.banner.value=temp;             
temp="";             
setTimeout("nextstep()",2000)}             
else{             
nextstep()}}             
             
function nextstep(){             
             
if (cursor=="\\"){             
cursor="||"}             
else if (cursor=="||"){             
cursor="//"}             
else if (cursor=="//"){             
cursor="--"}             
else if (cursor=="--"){             
cursor="\\"}                         
             
nextchar++;             
temp+=line[nextline].charAt(nextchar);             
document.bannerform.banner.value=temp+cursor             
setTimeout("animate()",100)}             
             
//if IE 4+ or NS6             
if (document.all||document.getElementById)             
window.onload=animate             
// -->             
</script> 
<!-- 跑馬燈文字 END -->

<!-- Site Tag Tracker Start -->
<script type="text/javascript" src="http://shots.snap.com/ss/1af0e6a334016130bb976378e31c032a/snap_shots.js"></script>
<!-- Site Tag Tracker END -->

<!-- Google Analytics Start -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-4529007-2";
urchinTracker();
</script>
<!-- Google Analytics END -->]]></description>
    <pubDate>Thu, 07 Sep 2017 00:09:27 +0800</pubDate>
    <lastBuildDate>Thu, 07 Sep 2017 00:09:27 +0800</lastBuildDate>
    <managingEditor>david50@not-valid.com (小必)</managingEditor>
    <copyright>Copyright 2003-2025 小必,Pixnet Digital Media Coporation. All rights reserved.</copyright>
    <generator>PIXNET Media Digital Coporation</generator>
    <language>zh</language>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>3600</ttl>
    <itunes:explicit>no</itunes:explicit><itunes:summary> line[longestmessage].length) longestmessage=i } //Auto set scroller width var tscroller_width=line[longestmessage].length*3 lines=line.length-1 //--Number of lines //if IE 4+ or NS6 if (document.all||document.getElementById){ document.write(' ') document.write('') document.write('') } temp="" nextchar=-1; nextline=1; cursor="\\" function animate(){ if (temp==line[nextline] &amp; temp.length==line[nextline].length &amp; nextline!=lines){ nextline++; nextchar=-1; document.bannerform.banner.value=temp; temp=""; setTimeout("nextstep()",2000)} else if (nextline==lines &amp; temp==line[nextline] &amp; temp.length==line[nextline].length){ nextline=1; nextchar=-1; document.bannerform.banner.value=temp; temp=""; setTimeout("nextstep()",2000)} else{ nextstep()}} function nextstep(){ if (cursor=="\\"){ cursor="||"} else if (cursor=="||"){ cursor="//"} else if (cursor=="//"){ cursor="--"} else if (cursor=="--"){ cursor="\\"} nextchar++; temp+=line[nextline].charAt(nextchar); document.bannerform.banner.value=temp+cursor setTimeout("animate()",100)} //if IE 4+ or NS6 if (document.all||document.getElementById) window.onload=animate // -- _uacct = "UA-4529007-2"; urchinTracker(); </itunes:summary><itunes:subtitle> line[longestmessage].length) longestmessage=i } //Auto set scroller width var tscroller_width=line[longestmessage].length*3 lines=line.length-1 //--Number of lines //if IE 4+ or NS6 if (document.all||document.getElementById){ document.write(' ') document</itunes:subtitle><itunes:owner><itunes:email>david50@not-valid.com</itunes:email></itunes:owner><item>
      <title><![CDATA[[旅遊]沖繩4天3夜4G Wi-Fi分享器及7淘卡使用心得]]></title>
      <link>https://david50.pixnet.net/blog/post/45291765</link>
      <guid>https://david50.pixnet.net/blog/post/45291765</guid>
      <description><![CDATA[上次去美國時其實3G網路都還不是很普及，也還沒有這麼多上網的商品可以選擇，就直接和電信公司辦了漫遊的服務，價格要8百多超過量後再依使用量收費（收費無上限），10天9夜回來差不多也用了一千多的費用。這次去日本出發前做功課時才發現，現在出國上網的選擇多了這麼多，除了可以使用電信公司的漫遊外，還可以購買本國或國外的上網卡，還有4G Wi-Fi分享器可以租借，而且各家的產品還可分用量和天數來收費，想要找個合用的產品還真不是這麼容易呢！不過在幾經考量後選擇了WIFIHERO的4G Wi-Fi分享器和7淘卡，其實原本是打算租個2台分享器就搞定了，分享器價格上比較便宜，又沒有換卡的問題，但太座說如果有問題不就都不行上網了，想想也有道理，所以就租了一台分享器，再買了張7淘卡。分享器以天計費，每天89元，首次申請第一天還免費，最少要租4天，重點是沒有流量限制，算下來才兩百多元，真的挺划算的，使用上也很方便，把機器開機就好，機器不需要做任何設定，連SIM卡都沒有拔，只要在Wi-Fi連接時連接機器後方的SSID輸入密碼就可以使用了，不過缺點是包包裡就必需帶著這台分享器，訊號上都很不錯，只有到了萬座毛的海邊時進到店內吃飯時分享器上出現了圈外無法上網的問題，到了室外後將分享器重新開機後又可以正常使用了，至於續航力方面其實挺不錯的，每天在外面將近12小時，分享器的電池還是滿格，當時還怕分享器沒電而帶了個行動電源，現在想想真是想太多了 :P7淘卡使用8天有3G的流量，超過3G後會降速，因為沒有用完所以也不知降速後速度行不行 :P，優點是換上卡設定完後就可以使用，包包內也不需再留個分享器的位置，缺點是設定其實沒這麼簡單（花了一點時間），還有要拔SIM卡，會有遺失的風險（像我這次就遺失了@@），訊號方面其實也都還不錯，依據太座的描述這4天3夜中，有在Aeon賣場時和大國藥妝店時有訊號不好的情況，出了室外又恢復正常了，整體使用情形也都還不錯，只是以我的用量來說這樣的價格略高了一點，下次去希望可以找到更適合的上網方式囉！]]></description>
      <content:encoded><![CDATA[<div>上次去美國時其實3G網路都還不是很普及，也還沒有這麼多上網的商品可以選擇，就直接和電信公司辦了漫遊的服務，價格要8百多超過量後再依使用量收費（收費無上限），10天9夜回來差不多也用了一千多的費用。</div><div><br></div>這次去日本出發前做功課時才發現，現在出國上網的選擇多了這麼多，除了可以使用電信公司的漫遊外，還可以購買本國或國外的上網卡，還有4G Wi-Fi分享器可以租借，而且各家的產品還可分用量和天數來收費，想要找個合用的產品還真不是這麼容易呢！<div>不過在幾經考量後選擇了WIFIHERO的4G Wi-Fi分享器和7淘卡，其實原本是打算租個2台分享器就搞定了，分享器價格上比較便宜，又沒有換卡的問題，但太座說如果有問題不就都不行上網了，想想也有道理，所以就租了一台分享器，再買了張7淘卡。</div><div><br></div><div>分享器以天計費，每天89元，首次申請第一天還免費，最少要租4天，重點是沒有流量限制，算下來才兩百多元，真的挺划算的，使用上也很方便，把機器開機就好，機器不需要做任何設定，連SIM卡都沒有拔，只要在Wi-Fi連接時連接機器後方的SSID輸入密碼就可以使用了，不過缺點是包包裡就必需帶著這台分享器，訊號上都很不錯，只有到了萬座毛的海邊時進到店內吃飯時分享器上出現了圈外無法上網的問題，到了室外後將分享器重新開機後又可以正常使用了，至於續航力方面其實挺不錯的，每天在外面將近12小時，分享器的電池還是滿格，當時還怕分享器沒電而帶了個行動電源，現在想想真是想太多了 :P</div><div><br></div><div>7淘卡使用8天有3G的流量，超過3G後會降速，因為沒有用完所以也不知降速後速度行不行 :P，優點是換上卡設定完後就可以使用，包包內也不需再留個分享器的位置，缺點是設定其實沒這麼簡單（花了一點時間），還有要拔SIM卡，會有遺失的風險（像我這次就遺失了@@），訊號方面其實也都還不錯，依據太座的描述這4天3夜中，有在Aeon賣場時和大國藥妝店時有訊號不好的情況，出了室外又恢復正常了，整體使用情形也都還不錯，只是以我的用量來說這樣的價格略高了一點，下次去希望可以找到更適合的上網方式囉！</div>  <div class="more"><a href="https://david50.pixnet.net/blog/post/45291765">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45291765"></div>]]></content:encoded>
      <pubDate>Thu, 07 Sep 2017 00:09:27 +0800</pubDate>
      <category><![CDATA[心情隨筆]]></category>
      <comments>https://david50.pixnet.net/blog/post/45291765#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Linux -  dd convert and copy a file]]></title>
      <link>https://david50.pixnet.net/blog/post/45430053</link>
      <guid>https://david50.pixnet.net/blog/post/45430053</guid>
      <description><![CDATA[dd 在manual裡的解釋是convert and copy a file

語法：dd if=輸入檔案 of=輸出檔案 選項


	dd選項參數
	
		
			參數
			說明
		
		
			if
			指定輸入檔案
		
		
			of
			指定輸出檔案
		
		
			ibs
			指定每次讀取之大小(預設為512byte)
		
		
			obs
			指定每次寫入之大小(預設為512byte)
		
		
			bs
			同時指定ibs和obs之大小(預設為512byte)
		
		
			cbs
			指定每次轉換之大小
		
		
			count
			僅轉換ibs所指定的block數(N)
		
		
			seek
			於開始始略過N個obs所指定的block數(N=指定的數字)
		
		
			skip
			於開始始略過N個ibs所指定的block數(N=指定的數字)
		
		
			conv=ascii
			將EBCDIC碼轉換成ASCII碼
		
		
			conv=ebcdic
			將ASCII碼轉換成EBCDIC碼
		
		
			conv=ibm
			將ASCII碼轉換成alternate EBCDIC碼
		
		
			conv=lcase
			把大寫字母轉換為小寫
		
		
			conv=ucase
			把小寫字母轉換為大寫
		
		
			conv=nocreat
			不建立輸出檔案
		
		
			conv=noerror
			讀取發生錯誤仍繼續讀取
		
		
			conv=notrunc
			輸出時不做裁剪
		
		
			conv=sync
			將每個輸入的block都和ibs大小一樣（若不足由NULs填滿）
		
	


&nbsp;

最常使用的大概就是光碟或硬碟的複製

ubuntu@ubuntu ~ $ sudo dd if=/dev/sda1 of=/dev/sdb1  #將第一顆硬碟的第一個磁區複製到第二顆硬碟的第一個磁碟。

若硬碟有壞軌可加上noerror參數

ubuntu@ubuntu ~ $ sudo dd if=/dev/sda1 of=/dev/sdb1 bs=4M conv=noerror,notrunc #將第一顆硬碟的第一個磁區複製到第二顆硬碟的第一個磁碟，將讀取和寫入之block值設定為4M，並在讀取錯誤時繼續讀取，輸出時不做裁剪。

利用dd製作ISO檔

ubuntu@ubuntu ~ $ sudo dd if=/dev/cdrom of=/tmp/ubuntu1604.iso  ＃讀取cdrom並將檔案存成/tmp/ubuntu1604.sio

小寫字母轉換為大寫字母

ubuntu@ubuntu ~ $ dd if=original.txt of=dd_s_to_b.txt conv=ucase   #將original.txt輸出為dd_s_to_b.txt並將所有字母大寫轉換為小寫
輸入 0+1 個紀錄
輸出 0+1 個紀錄
510 bytes copied, 0.000214348 s, 2.4 MB/s
ubuntu@ubuntu ~ $ cat dd_s_to_b.txt&nbsp;　　　　　　　　　　　　　　　　　　＃查看dd_s_to_b.txt內容
ONCE ON A DARK WINTER'S DAY, WHEN THE YELLOW FOG HUNG SO THICK AND HEAVY IN THE STREETS OF LONDON THAT THE LAMPS WERE LIGHTED AND THE SHOP WINDOWS BLAZED WITH GAS AS THEY DO AT NIGHT, AN ODD-LOOKING LITTLE GIRL SAT IN A CAB WITH HER FATHER AND WAS DRIVEN RATHER SLOWLY THROUGH THE BIG THOROUGHFARES.

SHE SAT WITH HER FEET TUCKED UNDER HER, AND LEANED AGAINST HER FATHER, WHO HELD HER IN HIS ARM, AS SHE STARED OUT OF THE WINDOW AT THE PASSING PEOPLE WITH A QUEER OLD-FASHIONED THOUGHTFULNESS IN HER BIG EYES.

大寫字母轉換為小寫字母

ubuntu@ubuntu ~ $ dd if=original.txt of=dd_b_to_s.txt conv=lcase　　#將original.txt輸出為dd_b_to_s.txt並將所有字母小寫轉換為大寫
輸入 0+1 個紀錄
輸出 0+1 個紀錄
510 bytes copied, 0.000173607 s, 2.9 MB/s
ubuntu@ubuntu ~ $ cat dd__to_l.txt&nbsp;　　　　　　　　　　　　　　　　　　　＃查看dd_l_to_u.txt內容
once on a dark winter's day, when the yellow fog hung so thick and heavy in the streets of london that the lamps were lighted and the shop windows blazed with gas as they do at night, an odd-looking little girl sat in a cab with her father and was driven rather slowly through the big thoroughfares.

she sat with her feet tucked under her, and leaned against her father, who held her in his arm, as she stared out of the window at the passing people with a queer old-fashioned thoughtfulness in her big eyes.


&nbsp;

&nbsp;
]]></description>
      <content:encoded><![CDATA[<p>dd 在manual裡的解釋是convert and copy a file</p>

<p>語法：dd if=輸入檔案 of=輸出檔案 選項</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<caption>dd選項參數</caption>
	<tbody>
		<tr>
			<td style="text-align: center;">參數</td>
			<td>說明</td>
		</tr>
		<tr>
			<td style="text-align: center;">if</td>
			<td>指定輸入檔案</td>
		</tr>
		<tr>
			<td style="text-align: center;">of</td>
			<td>指定輸出檔案</td>
		</tr>
		<tr>
			<td style="text-align: center;">ibs</td>
			<td>指定每次讀取之大小(預設為512byte)</td>
		</tr>
		<tr>
			<td style="text-align: center;">obs</td>
			<td>指定每次寫入之大小(預設為512byte)</td>
		</tr>
		<tr>
			<td style="text-align: center;">bs</td>
			<td>同時指定ibs和obs之大小(預設為512byte)</td>
		</tr>
		<tr>
			<td style="text-align: center;">cbs</td>
			<td>指定每次轉換之大小</td>
		</tr>
		<tr>
			<td style="text-align: center;">count</td>
			<td>僅轉換ibs所指定的block數(N)</td>
		</tr>
		<tr>
			<td style="text-align: center;">seek</td>
			<td>於開始始略過N個obs所指定的block數(N=指定的數字)</td>
		</tr>
		<tr>
			<td style="text-align: center;">skip</td>
			<td>於開始始略過N個ibs所指定的block數(N=指定的數字)</td>
		</tr>
		<tr>
			<td style="text-align: center;">conv=ascii</td>
			<td>將EBCDIC碼轉換成ASCII碼</td>
		</tr>
		<tr>
			<td style="text-align: center;">conv=ebcdic</td>
			<td>將ASCII碼轉換成EBCDIC碼</td>
		</tr>
		<tr>
			<td style="text-align: center;">conv=ibm</td>
			<td>將ASCII碼轉換成alternate EBCDIC碼</td>
		</tr>
		<tr>
			<td style="text-align: center;">conv=lcase</td>
			<td>把大寫字母轉換為小寫</td>
		</tr>
		<tr>
			<td style="text-align: center;">conv=ucase</td>
			<td>把小寫字母轉換為大寫</td>
		</tr>
		<tr>
			<td style="text-align: center;">conv=nocreat</td>
			<td>不建立輸出檔案</td>
		</tr>
		<tr>
			<td style="text-align: center;">conv=noerror</td>
			<td>讀取發生錯誤仍繼續讀取</td>
		</tr>
		<tr>
			<td style="text-align: center;">conv=notrunc</td>
			<td>輸出時不做裁剪</td>
		</tr>
		<tr>
			<td style="text-align: center;">conv=sync</td>
			<td>將每個輸入的block都和ibs大小一樣（若不足由NULs填滿）</td>
		</tr>
	</tbody>
</table>

<p>&nbsp;</p>

<p>最常使用的大概就是光碟或硬碟的複製</p>

<pre class="notranslate" style="margin: 0px 0px 20px; padding: 6px 10px; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); line-height: 19px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; letter-spacing: normal;">ubuntu@ubuntu ~ $ sudo dd if=/dev/sda1 of=/dev/sdb1  #將第一顆硬碟的第一個磁區複製到第二顆硬碟的第一個磁碟。</pre>

<p>若硬碟有壞軌可加上noerror參數</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu ~ $ sudo dd if=/dev/sda1 of=/dev/sdb1 bs=4M conv=noerror,notrunc #將第一顆硬碟的第一個磁區複製到第二顆硬碟的第一個磁碟，將讀取和寫入之block值設定為4M，並在讀取錯誤時繼續讀取，輸出時不做裁剪。</pre>

<p>利用dd製作ISO檔</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu ~ $ sudo dd if=/dev/cdrom of=/tmp/ubuntu1604.iso  ＃讀取cdrom並將檔案存成/tmp/ubuntu1604.sio</pre>

<p>小寫字母轉換為大寫字母</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu ~ $ dd if=original.txt of=dd_s_to_b.txt conv=ucase   #將original.txt輸出為dd_s_to_b.txt並將所有字母大寫轉換為小寫
輸入 0+1 個紀錄
輸出 0+1 個紀錄
510 bytes copied, 0.000214348 s, 2.4 MB/s
ubuntu@ubuntu ~ $ cat dd_s_to_b.txt&nbsp;　　　　　　　　　　　　　　　　　　＃查看dd_s_to_b.txt內容
ONCE ON A DARK WINTER'S DAY, WHEN THE YELLOW FOG HUNG SO THICK AND HEAVY IN THE STREETS OF LONDON THAT THE LAMPS WERE LIGHTED AND THE SHOP WINDOWS BLAZED WITH GAS AS THEY DO AT NIGHT, AN ODD-LOOKING LITTLE GIRL SAT IN A CAB WITH HER FATHER AND WAS DRIVEN RATHER SLOWLY THROUGH THE BIG THOROUGHFARES.

SHE SAT WITH HER FEET TUCKED UNDER HER, AND LEANED AGAINST HER FATHER, WHO HELD HER IN HIS ARM, AS SHE STARED OUT OF THE WINDOW AT THE PASSING PEOPLE WITH A QUEER OLD-FASHIONED THOUGHTFULNESS IN HER BIG EYES.</pre>

<p>大寫字母轉換為小寫字母</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu ~ $ dd if=original.txt of=dd_b_to_s.txt conv=lcase　　#將original.txt輸出為dd_b_to_s.txt並將所有字母小寫轉換為大寫
輸入 0+1 個紀錄
輸出 0+1 個紀錄
510 bytes copied, 0.000173607 s, 2.9 MB/s
ubuntu@ubuntu ~ $ cat dd__to_l.txt&nbsp;　　　　　　　　　　　　　　　　　　　＃查看dd_l_to_u.txt內容
once on a dark winter's day, when the yellow fog hung so thick and heavy in the streets of london that the lamps were lighted and the shop windows blazed with gas as they do at night, an odd-looking little girl sat in a cab with her father and was driven rather slowly through the big thoroughfares.

she sat with her feet tucked under her, and leaned against her father, who held her in his arm, as she stared out of the window at the passing people with a queer old-fashioned thoughtfulness in her big eyes.
</pre>

<p>&nbsp;</p>

<p>&nbsp;</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45430053">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45430053"></div>]]></content:encoded>
      <pubDate>Wed, 31 May 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[Linux]]></category>
      <comments>https://david50.pixnet.net/blog/post/45430053#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Cisco基本指令-VTP]]></title>
      <link>https://david50.pixnet.net/blog/post/45274308</link>
      <guid>https://david50.pixnet.net/blog/post/45274308</guid>
      <description><![CDATA[VTP是一種讓多台Switch可自動同步VLAN設定的通訊協定，目的是要管理整個網路環境的VLAN，維持一致性，我們可以新增、刪除、重新命名VLAN，然後將設定同步到VTP網域中其他Switch。


VTP是Cisco的專利，所以網路中的Switch是使用Cisco的Switch才能使用VTP的功能。

VTP Mode
Server Mode：可新增、刪除、修改VLAN，並同步更新到網域內的VTP Client，設定檔存放於NVRam。
Client Mode：只能被動接收、轉送VTP Server的VLAN Database，Client Mode無法對VLAN進行修改，設定檔不存放於NVRam。
Transparent Mode：Transparent Mode可新增、刪除、修改VLAN，但其結果只會記錄在本機的VLAN Database中，不會同步到VTP Domain的其他設備，但如接收到VTP Server的異動資訊時，會將資料轉送給其他Switch，設定檔存放於NVRam。


VTP是使用Trunk Port傳輸資料，所以Switch必需要設定Trunk Port才可傳送VTP資料。

設定VTP Domain及VTP Password

VTPServer(config)#vtp domain vtplab.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定VTP domain
Changing VTP domain name from NULL to vtplab.com
VTPServer(config)#vtp password vtppassword&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定VTP password
Setting device VLAN database password to vtppassword
VTPServer(config)#end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#切換回enable模式
VTPServer#show vtp status&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#查看VTP狀態
VTP Version &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 2
Configuration Revision &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 3
Maximum VLANs supported locally : 255
Number of existing VLANs &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 5
VTP Operating Mode &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: Server&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#預設是Server Mode
VTP Domain Name &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: vtplab.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#已加入VTP Doamin
VTP Pruning Mode &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: Disabled
VTP V2 Mode &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: Disabled
VTP Traps Generation &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: Disabled
MD5 digest &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 0x7C 0xF7 0x91 0x96 0xD1 0xC4 0xF1 0xEA&nbsp;
Configuration last modified by 0.0.0.0 at 3-1-93 00:12:28
Local updater ID is 0.0.0.0 (no valid interface found)


VTP Server 與 VTP Client 要互相溝通，前題是 VTP Domain 與 VTP Password 必需相同。

設定VTP Client加入VTP Domain

VTPClient1(config)#vtp domain vtplab.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定VTP domain
Domain name already set to vtplab.com.
VTPClient1(config)#vtp password vtppassword
Setting device VLAN database password to vtppassword&nbsp;&nbsp;#設定VTP password
VTPClient1(config)#vtp mode client&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定為Client mode
Setting device to VTP CLIENT mode.

VTPClient2(config)#vtp domain vtplab.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定VTP domain
Domain name already set to vtplab.com.
VTPClient2(config)#vtp password vtppassword
Setting device VLAN database password to vtppassword #設定VTP password
VTPClient2(config)#vtp mode client&nbsp;&nbsp;                 #設定為Client mode
Setting device to VTP CLIENT mode.

VTPClient3(config)#vtp domain vtplab.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定VTP domain
Domain name already set to vtplab.com.
VTPClient3(config)#vtp password vtppassword
Setting device VLAN database password to vtppassword #設定VTP password
VTPClient3(config)#vtp mode client&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定為Client mode
Setting device to VTP CLIENT mode.

VTPTransparent(config)#vtp mode transparent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定為Transparent mode
Setting device to VTP TRANSPARENT mode.

 VTP設定完成後Server端會將VLAN Database同步至Client端，但在設定為Transparent mode的Switch只會將收到的資料轉送，而不寫入自己的VLAN Database中。


在Server端建立VLAN
VTPServer(config)#vlan 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #建立VLAN 10
VTPServer(config-vlan)#vlan 30&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #建立VLAN 30
VTPServer(config-vlan)#vlan 50&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #建立VLAN 50
VTPServer(config-vlan)#end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #切換至enable模式
%SYS-5-CONFIG_I: Configured from console by console

VTPServer#show vlan brief&nbsp;                            #查看Server端VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22
10 &nbsp; VLAN0010 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
30 &nbsp; VLAN0030 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
50 &nbsp; VLAN0050 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #VLAN已建立
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active&nbsp;

VTPClient1#show vlan brief&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #查看Client1 VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22
10 &nbsp; VLAN0010 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
30 &nbsp; VLAN0030 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
50 &nbsp; VLAN0050 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #VLAN已同步 &nbsp;
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active

VTPClient2#show vlan brief&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #查看Client2 VLAN狀態
VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22, Fa0/23
10 &nbsp; VLAN0010 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
30 &nbsp; VLAN0030 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
50 &nbsp; VLAN0050 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #VLAN已同步 &nbsp; &nbsp; &nbsp;
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active

VTPTransparent#show vlan brief&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #查看Transparent mode Switch VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22
20 &nbsp; VLAN0020 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
40 &nbsp; VLAN0040 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
60 &nbsp; VLAN0060 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #VLAN未被同步

VTPClient3#show vlan brief&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #查看Client3 VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22, Fa0/23
10 &nbsp; VLAN0010 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
30 &nbsp; VLAN0030 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
50 &nbsp; VLAN0050 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;#VLAN已同步
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp;&nbsp;

VTPTransparent(config)#vlan 20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #建立VLAN 20
VTPTransparent(config)#vlan 40&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #建立VLAN 40
VTPTransparent(config)#vlan 60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #建立VLAN 60
VTPTransparent(config)#end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#切換至enable模式
%SYS-5-CONFIG_I: Configured from console by console

VTPTransparent#show vlan brief&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #查看VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22
20 &nbsp; VLAN0020 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
40 &nbsp; VLAN0040 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
60 &nbsp; VLAN0060 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #Transparent mode Switch 可自行設定VLAN

VTPClient1(config)#vlan 70&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #建立VLAN 70
VTP VLAN configuration not allowed when device is in CLIENT mode.&nbsp; #Client mode無法自己行設定VLAN



VTP僅能同步VLAN，VLAN中所指定的Port無法一起同步，還是得自行指定。

show vtp status 欄位說明

VTP Version &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 2   #可支緩最高的VTP版本（不是目前執行的版本），如顯示是2的話，即支緩1-2版。
Configuration Revision &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: 0   #VLAN Database的版本流水號，更新VLAN Database後此流水號就會加1。
Maximum VLANs supported locally : 255 #本機最大支緩的VLAN數目。
Number of existing VLANs &nbsp; &nbsp; &nbsp; &nbsp;: 8   #本機現在VLAN總數。
VTP Operating Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Transparent #本機VTP Mode
VTP Domain Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : vtplab.com  #VTP Domain
VTP Pruning Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Disabled    #VTP Pruning Mode是否啟用
VTP V2 Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Enabled     #VTP V2是否啟用
VTP Traps Generation &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Disabled    #VTP Traps是否啟用
MD5 digest &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: 0xA4 0x2A 0x63 0x88 0x8D 0xE3 0x05 0x51&nbsp;
Configuration last modified by 0.0.0.0 at 3-1-93 00:23:13

]]></description>
      <content:encoded><![CDATA[<p><span>VTP</span>是一種讓多台<span>Switch</span>可自動同步<span>VLAN</span>設定的通訊協定，目的是要管理整個網路環境的<span>VLAN</span>，維持一致性，我們可以新增、刪除、重新命名<span>VLAN</span>，然後將設定同步到<span>VTP</span>網域中其他<span>Switch</span>。</p>

<p><img alt="Tips.jpg" height="18" src="https://pic.pimg.tw/david50/1504073059-1489956438_n.jpg" title="Tips.jpg" width="25"><br>
<span>VTP</span>是<span>Cisco</span>的專利，所以網路中的<span>Switch</span>是使用<span>Cisco</span>的<span>Switch</span>才能使用<span>VTP</span>的功能。</p>

<p><span><strong>VTP Mode</strong><br>
<strong>Server Mode</strong></span>：可新增、刪除、修改<span>VLAN</span>，並同步更新到網域內的<span>VTP Client</span>，設定檔存放於<span>NVRam</span>。<br>
<strong><span>Client Mode</span></strong>：只能被動接收、轉送<span>VTP Server</span>的<span>VLAN Database</span>，<span>Client Mode</span>無法對<span>VLAN</span>進行修改，設定檔不存放於<span>NVRam</span>。<br>
<strong><span>Transparent Mode</span></strong>：<span>Transparent Mode</span>可新增、刪除、修改<span>VLAN</span>，但其結果只會記錄在本機的VLAN Database中，不會同步到<span>VTP Domain</span>的其他設備，但如接收到<span>VTP Server</span>的異動資訊時，會將資料轉送給其他<span>Switch</span>，設定檔存放於<span>NVRam</span>。</p>

<p><img alt="Tips.jpg" height="18" src="https://pic.pimg.tw/david50/1504073059-1489956438_n.jpg" title="Tips.jpg" width="25"><br>
<span>VTP</span>是使用<span>Trunk Port</span>傳輸資料，所以<span>Switch</span>必需要設定<span>Trunk Port</span>才可傳送<span>VTP</span>資料。</p>

<p><strong><span><span style="font-family:新細明體,serif">設定<span>VTP Domain</span>及<span>VTP Password</span></span></span></strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><span style="color:#FCA544">VTPServer</span>(config)#vtp domain vtplab.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定VTP domain
Changing VTP domain name from NULL to vtplab.com
VTPServer(config)#vtp password vtppassword&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定VTP password
Setting device VLAN database password to vtppassword
VTPServer(config)#end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#切換回enable模式
VTPServer#show vtp status&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#查看VTP狀態
VTP Version &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 2
Configuration Revision &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 3
Maximum VLANs supported locally : 255
Number of existing VLANs &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 5
VTP Operating Mode &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: Server&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#預設是Server Mode
VTP Domain Name &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: vtplab.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#已加入VTP Doamin
VTP Pruning Mode &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: Disabled
VTP V2 Mode &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: Disabled
VTP Traps Generation &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: Disabled
MD5 digest &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 0x7C 0xF7 0x91 0x96 0xD1 0xC4 0xF1 0xEA&nbsp;
Configuration last modified by 0.0.0.0 at 3-1-93 00:12:28
Local updater ID is 0.0.0.0 (no valid interface found)</pre>

<pre style="margin-bottom:15.0pt;line-height:14.25pt;background:#F8F8F8;white-space:pre-wrap;word-wrap:break-word;border-radius:3px;font-variant-ligatures:normal;font-variant-caps:normal;orphans:2;text-align:start;widows:2;-webkit-text-stroke-width:0px;text-decoration-style:initial;word-spacing:0px;"><img alt="Tips.jpg" height="18" src="https://pic.pimg.tw/david50/1504073059-1489956438_n.jpg" title="Tips.jpg" width="25">
<span>VTP Server </span>與<span> VTP Client </span>要互相溝通，前題是<span> VTP Domain </span>與<span> VTP Password </span>必需相同。</pre>

<p><strong><span><span style="font-family:新細明體,serif">設定<span>VTP Client</span>加入<span>VTP Domain</span></span></span></strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">VTPClient1(config)#vtp domain vtplab.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定VTP domain
Domain name already set to vtplab.com.
VTPClient1(config)#vtp password vtppassword
Setting device VLAN database password to vtppassword&nbsp;&nbsp;#設定VTP password
VTPClient1(config)#vtp mode client&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定為Client mode
Setting device to VTP CLIENT mode.

VTPClient2(config)#vtp domain vtplab.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定VTP domain
Domain name already set to vtplab.com.
VTPClient2(config)#vtp password vtppassword
Setting device VLAN database password to vtppassword #設定VTP password
VTPClient2(config)#vtp mode client&nbsp;&nbsp;                 #設定為Client mode
Setting device to VTP CLIENT mode.

VTPClient3(config)#vtp domain vtplab.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定VTP domain
Domain name already set to vtplab.com.
VTPClient3(config)#vtp password vtppassword
Setting device VLAN database password to vtppassword #設定VTP password
VTPClient3(config)#vtp mode client&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定為Client mode
Setting device to VTP CLIENT mode.

VTPTransparent(config)#vtp mode transparent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#設定為Transparent mode
Setting device to VTP TRANSPARENT mode.</pre>

<pre style="margin-bottom:15.0pt;line-height:14.25pt;background:#F8F8F8;white-space:pre-wrap;word-wrap:break-word;border-radius:3px;font-variant-ligatures:normal;font-variant-caps:normal;orphans:2;text-align:start;widows:2;-webkit-text-stroke-width:0px;text-decoration-style:initial;word-spacing:0px;"> VTP<span style="background-color:rgb(255, 255, 255); font-family:sans-serif,arial,verdana,trebuchet ms">設定完成後</span><span style="background-color:rgb(255, 255, 255); font-family:sans-serif,arial,verdana,trebuchet ms">Server</span><span style="background-color:rgb(255, 255, 255); font-family:sans-serif,arial,verdana,trebuchet ms">端會將</span><span style="background-color:rgb(255, 255, 255); font-family:sans-serif,arial,verdana,trebuchet ms">VLAN Database</span><span style="background-color:rgb(255, 255, 255); font-family:sans-serif,arial,verdana,trebuchet ms">同步至</span><span style="background-color:rgb(255, 255, 255); font-family:sans-serif,arial,verdana,trebuchet ms">Client</span><span style="background-color:rgb(255, 255, 255); font-family:sans-serif,arial,verdana,trebuchet ms">端，但在設定為</span><span style="background-color:rgb(255, 255, 255); font-family:sans-serif,arial,verdana,trebuchet ms">Transparent mode</span><span style="background-color:rgb(255, 255, 255); font-family:sans-serif,arial,verdana,trebuchet ms">的</span><span style="background-color:rgb(255, 255, 255); font-family:sans-serif,arial,verdana,trebuchet ms">Switch只會將收到的資料轉送，而不寫入自己的VLAN Database中。</span></pre>

<div style="border:dashed #CCCCCC 1.0pt;padding:5.0pt 8.0pt 5.0pt 8.0pt;background:#F8F8F8;">
<pre style="margin-bottom:15.0pt;line-height:14.25pt;background:#F8F8F8;border:none;padding:0cm;white-space:pre-wrap;word-wrap:break-word;border-radius:3px;font-variant-ligatures:normal;font-variant-caps:normal;orphans:2;text-align:start;widows:2;-webkit-text-stroke-width:0px;text-decoration-style:initial;word-spacing:0px;"><span style="font-family:consolas"><span style="font-size:10.0pt">在Server端建立VLAN
VTPServer</span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">(config)#vlan 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">建立</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">VLAN 10
VTPServer(config-vlan)#vlan 30&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">建立</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">VLAN 30
VTPServer(config-vlan)#vlan 50&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">建立</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">VLAN 50
VTPServer(config-vlan)#end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">切換至</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">enable</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">模式</span></span></span>
<span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">%SYS-5-CONFIG_I: Configured from console by console

VTPServer#show vlan brief&nbsp;                            #查看Server端VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22
</span></span></span></span><span><span style="color:red"><span style="font-family:consolas"><span style="font-size:10.0pt">10 &nbsp; VLAN0010 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
30 &nbsp; VLAN0030 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
50 &nbsp; VLAN0050 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active</span></span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt"> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #VLAN</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">已建立</span></span></span>
<span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active&nbsp;

</span></span></span></span><span><span style="color:#FCA544"><span style="font-family:consolas"><span style="font-size:10.0pt">VTPClient1</span></span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">#show vlan brief&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">查看</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">Client1 VLAN</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">狀態</span></span></span>
<span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">
VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22
</span></span></span></span><span><span style="color:red"><span style="font-family:consolas"><span style="font-size:10.0pt">10 &nbsp; VLAN0010 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
30 &nbsp; VLAN0030 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
50 &nbsp; VLAN0050 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active</span></span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #VLAN</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">已同步</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt"> &nbsp;
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active

</span></span></span></span><span><span style="color:#FCA544"><span style="font-family:consolas"><span style="font-size:10.0pt">VTPClient2</span></span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">#show vlan brief&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">查看</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">Client2 VLAN</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">狀態</span></span></span>
<span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22, Fa0/23
</span></span></span></span><span><span style="color:red"><span style="font-family:consolas"><span style="font-size:10.0pt">10 &nbsp; VLAN0010 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
30 &nbsp; VLAN0030 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
50 &nbsp; VLAN0050 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active</span></span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #VLAN</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">已同步</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt"> &nbsp; &nbsp; &nbsp;
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active

</span></span></span></span><span><span style="color:#FCA544"><span style="font-family:consolas"><span style="font-size:10.0pt">VTPTransparent</span></span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">#show vlan brief&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">查看</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">Transparent mode Switch VLAN</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">狀態</span></span></span>
<span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">
VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22
20 &nbsp; VLAN0020 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
40 &nbsp; VLAN0040 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
60 &nbsp; VLAN0060 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #VLAN</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">未被同步</span></span></span>
<span><span style="color:#FCA544"><span style="font-family:consolas"><span style="font-size:10.0pt">
VTPClient3</span></span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">#show vlan brief&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">查看</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">Client3 VLAN</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">狀態</span></span></span>
<span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">
VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22, Fa0/23
</span></span></span></span><span><span style="color:red"><span style="font-family:consolas"><span style="font-size:10.0pt">10 &nbsp; VLAN0010 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
30 &nbsp; VLAN0030 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
50 &nbsp; VLAN0050 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">&nbsp;#VLAN</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">已同步</span></span></span>
<span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp;&nbsp;

</span></span></span></span><span><span style="color:#FCA544"><span style="font-family:consolas"><span style="font-size:10.0pt">VTPTransparent</span></span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">(config)#vlan 20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">建立</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">VLAN 20
VTPTransparent(config)#vlan 40&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">建立</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">VLAN 40
VTPTransparent(config)#vlan 60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">建立</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">VLAN 60
VTPTransparent(config)#end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">切換至</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">enable</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">模式</span></span></span>
<span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">%SYS-5-CONFIG_I: Configured from console by console

VTPTransparent#show vlan brief&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">查看</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">VLAN</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">狀態</span></span></span>
<span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">
VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22
20 &nbsp; VLAN0020 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
40 &nbsp; VLAN0040 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
60 &nbsp; VLAN0060 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #Transparent mode Switch </span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">可自行設定</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">VLAN

</span></span></span></span><span><span style="color:#FCA544"><span style="font-family:consolas"><span style="font-size:10.0pt">VTPClient1</span></span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">(config)#vlan 70&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">建立</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">VLAN 70
VTP </span></span></span></span><span><span style="color:red"><span style="font-family:consolas"><span style="font-size:10.0pt">VLAN configuration not allowed</span></span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt"> when device is in CLIENT mode.&nbsp; #Client mode</span></span></span></span><span><span style="color:#333333"><span style="font-size:10.0pt">無法自己行設定</span></span></span><span><span style="color:#333333"><span style="font-family:consolas"><span style="font-size:10.0pt">VLAN</span></span></span></span></pre>
</div>

<p><img alt="Tips.jpg" height="18" src="https://pic.pimg.tw/david50/1504073059-1489956438_n.jpg" title="Tips.jpg" width="25"><br>
VTP僅能同步VLAN，VLAN中所指定的Port無法一起同步，還是得自行指定。</p>

<p><strong><span><span style="font-family:新細明體,serif">show vtp status </span></span></strong><strong><span><span style="font-family:新細明體,serif">欄位說明</span></span></strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">VTP Version &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 2   #可支緩最高的<span>VTP</span>版本（不是目前執行的版本），如顯示是2的話，即支緩<span>1-2</span>版。
Configuration Revision &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: 0   #<span>VLAN Database</span>的版本流水號，更新<span>VLAN Database後</span>此流水號就會加<span>1</span>。
Maximum VLANs supported locally : 255 #本機最大支緩的<span>VLAN</span>數目。
Number of existing VLANs &nbsp; &nbsp; &nbsp; &nbsp;: 8   #本機現在<span>VLAN</span>總數。
VTP Operating Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Transparent #本機VTP Mode
VTP Domain Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : vtplab.com  #VTP Domain
VTP Pruning Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Disabled    #VTP Pruning Mode是否啟用
VTP V2 Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Enabled     #VTP V2是否啟用
VTP Traps Generation &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Disabled    #VTP Traps是否啟用
MD5 digest &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: 0xA4 0x2A 0x63 0x88 0x8D 0xE3 0x05 0x51&nbsp;
Configuration last modified by 0.0.0.0 at 3-1-93 00:23:13
</pre>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45274308">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45274308"></div>]]></content:encoded>
      <pubDate>Mon, 29 May 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45274308#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Cisco基本指令-分割子介面(Sub-Interface)]]></title>
      <link>https://david50.pixnet.net/blog/post/45271917</link>
      <guid>https://david50.pixnet.net/blog/post/45271917</guid>
      <description><![CDATA[Switch切完VLAN後使得每個VLAN無法相互連線，若想要在每個VLAN的設備還可以相互連線還需要用使用到Router做路由的動作，因每個VLAN都屬於不同的網段，所以在Router上就需要分割子介面，才可讓所有的VLAN可以相互連線囉！



vlan 10 網段為 192.168.10.0/24
vlan 20 網段為 192.168.20.0/24
vlan 30 網段為 192.168.30.0/24
vlan 40 網段為 192.168.40.0/24
router &nbsp;網段為 192.168.100.0/24

新增子介面

Router(config)#interface fastEthernet 0/0.10                      #在fastEthernet 0/0介面新增號碼10之子介面(子介面的號碼不需和VLAN ID相同)
%LINK-5-CHANGED: Interface FastEthernet0/0.10, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.10, changed state to up
Router(config-subif)#encapsulation dot1Q 10                       #使用802.1q協定並加上Vlan 10標籤
Router(config-subif)#ip address 192.168.10.254 255.255.255.0      #設定IP及MASK
Router(config-subif)#no shutdown                                  #啟動子介面
Router(config-subif)#end                                          #切換回enable模式
%SYS-5-CONFIG_I: Configured from console by console

Router#show ip interface brief&nbsp;                                   #查看介面狀態
Interface &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IP-Address &nbsp; &nbsp; &nbsp;OK? Method Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Protocol
&nbsp;
FastEthernet0/0 &nbsp; &nbsp; &nbsp; &nbsp;192.168.100.254 YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up
&nbsp;
FastEthernet0/0.10 &nbsp; &nbsp; 192.168.10.254 &nbsp;YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up     #新增的子介面已建立起來了
&nbsp;
FastEthernet0/1 &nbsp; &nbsp; &nbsp; &nbsp;unassigned &nbsp; &nbsp; &nbsp;YES unset &nbsp;administratively down down
&nbsp;
Vlan1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unassigned &nbsp; &nbsp; &nbsp;YES unset &nbsp;administratively down down

Router#configure terminal&nbsp;                                       #進入全域模式
Enter configuration commands, one per line. &nbsp;End with CNTL/Z.
Router(config)#interface fastEthernet 0/0.20                     #在fastEthernet 0/0介面新增號碼20之子介面
%LINK-5-CHANGED: Interface FastEthernet0/0.20, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.20, changed state to up

Router(config-subif)#encapsulation dot1Q 20                      #使用802.1q協定並加上Vlan 20標籤
Router(config-subif)#ip address 192.168.20.254 255.255.255.0
Router(config-subif)#no shutdown&nbsp;
Router(config-subif)#exit
Router(config)#interface fastEthernet 0/0.30
%LINK-5-CHANGED: Interface FastEthernet0/0.30, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.30, changed state to up

Router(config-subif)#encapsulation dot1Q 30
Router(config-subif)#ip address 192.168.30.254 255.255.255.0
Router(config-subif)#no shutdown&nbsp;
Router(config-subif)#exit
Router(config)#interface fastEthernet 0/0.40
%LINK-5-CHANGED: Interface FastEthernet0/0.40, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.40, changed state to up

Router(config-subif)#encapsulation dot1Q 40
Router(config-subif)#ip address 192.168.40.254 255.255.255.0
Router(config-subif)#no shutdown&nbsp;
Router(config-subif)#end                                          #切換回enable模式
%SYS-5-CONFIG_I: Configured from console by console

Router#show ip interface brief&nbsp;
Interface &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IP-Address &nbsp; &nbsp; &nbsp;OK? Method Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Protocol
&nbsp;
FastEthernet0/0 &nbsp; &nbsp; &nbsp; &nbsp;192.168.100.254 YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up
&nbsp;
FastEthernet0/0.10 &nbsp; &nbsp; 192.168.10.254 &nbsp;YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up
&nbsp;
FastEthernet0/0.20 &nbsp; &nbsp; 192.168.20.254 &nbsp;YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up
&nbsp;
FastEthernet0/0.30 &nbsp; &nbsp; 192.168.30.254 &nbsp;YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up
&nbsp;
FastEthernet0/0.40 &nbsp; &nbsp; 192.168.40.254 &nbsp;YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up      #子介面及IP均設定完成
&nbsp;
FastEthernet0/1 &nbsp; &nbsp; &nbsp; &nbsp;unassigned &nbsp; &nbsp; &nbsp;YES unset &nbsp;administratively down down
&nbsp;
Vlan1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unassigned &nbsp; &nbsp; &nbsp;YES unset &nbsp;administratively down down

測試連線狀態

C:\&gt;ipconfig                                          #查看本機IP

FastEthernet0 Connection:(default port)

&nbsp; &nbsp;Link-local IPv6 Address.........: FE80::201:63FF:FE66:9E5A
&nbsp; &nbsp;IP Address......................: 192.168.10.1
&nbsp; &nbsp;Subnet Mask.....................: 255.255.255.0
&nbsp; &nbsp;Default Gateway.................: 192.168.10.254

C:\&gt;ping 192.168.20.1                               #與VLAN 20做連線測試

Pinging 192.168.20.1 with 32 bytes of data:

Reply from 192.168.20.1: bytes=32 time=0ms TTL=127
Reply from 192.168.20.1: bytes=32 time=0ms TTL=127
Reply from 192.168.20.1: bytes=32 time=0ms TTL=127
Reply from 192.168.20.1: bytes=32 time=1ms TTL=127

Ping statistics for 192.168.20.1:
&nbsp; &nbsp; Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
&nbsp; &nbsp; Minimum = 0ms, Maximum = 1ms, Average = 0ms

C:\&gt;ping 192.168.30.1                              #與VLAN 30做連線測試

Pinging 192.168.30.1 with 32 bytes of data:

Reply from 192.168.30.1: bytes=32 time=0ms TTL=127
Reply from 192.168.30.1: bytes=32 time=0ms TTL=127
Reply from 192.168.30.1: bytes=32 time=0ms TTL=127
Reply from 192.168.30.1: bytes=32 time=1ms TTL=127

Ping statistics for 192.168.30.1:
&nbsp; &nbsp; Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
&nbsp; &nbsp; Minimum = 0ms, Maximum = 1ms, Average = 0ms

C:\&gt;ping 192.168.40.1                             #與VLAN 40做連線測試

Pinging 192.168.40.1 with 32 bytes of data:

Reply from 192.168.40.1: bytes=32 time=0ms TTL=127
Reply from 192.168.40.1: bytes=32 time=0ms TTL=127
Reply from 192.168.40.1: bytes=32 time=0ms TTL=127
Reply from 192.168.40.1: bytes=32 time=1ms TTL=127

Ping statistics for 192.168.40.1:
&nbsp; &nbsp; Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
&nbsp; &nbsp; Minimum = 0ms, Maximum = 1ms, Average = 0ms

觀念補充1:&nbsp;&nbsp; &nbsp;每一個VLAN都是屬於一個Broadcast domain，也就是說不同VLAN彼此屬於不同網段
觀念補充2:&nbsp;&nbsp; &nbsp;對L2 Switch而言, 同網段的IP可以自己送，但是不同網段必須要透過Router來轉送
觀念補充3:&nbsp;&nbsp; &nbsp;VLAN 1預設的情況下屬於Native VLAN,，也就是說，VLAN 1在預設的情況下是不帶Tag的，而不帶Tag的VLAN可以直接透過實體介面來轉送, 如fa0/0
觀念補充4:&nbsp;&nbsp; &nbsp;Trunk上可以同時傳送不同VLAN的資訊
觀念補充5:&nbsp;&nbsp; &nbsp;encapsulation doc1Q vlan-ID指令是用來為sub-interface加上識別VLAN ID所使用的Tag
觀念補充6:&nbsp;&nbsp; &nbsp;所有不同網段的目的位址, 需要透過同網段位址來詢問，因此Router上需要針對不同VLAN切出sub-interface，以便轉換不同VLAN(網段)間的位址
觀念補充7:&nbsp;&nbsp; &nbsp;一個完整的ICMP(ping)包含兩個部份, Request跟Ack, 也就是說，在終端網路裝置上必須設定gateway位置，才能夠將接收來自不同網段的ICMP封包送回去
]]></description>
      <content:encoded><![CDATA[<p>Switch切完VLAN後使得每個VLAN無法相互連線，若想要在每個VLAN的設備還可以相互連線還需要用使用到Router做路由的動作，因每個VLAN都屬於不同的網段，所以在Router上就需要分割子介面，才可讓所有的VLAN可以相互連線囉！</p>

<p><img alt="vlan route.png" src="https://pic.pimg.tw/david50/1504057835-1191346224.png?v=1504057859" title="vlan route.png"></p>

<p>vlan 10 網段為 192.168.10.0/24<br>
vlan 20 網段為 192.168.20.0/24<br>
vlan 30 網段為 192.168.30.0/24<br>
vlan 40 網段為 192.168.40.0/24<br>
router &nbsp;網段為 192.168.100.0/24</p>

<p><strong>新增子介面</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Router(config)#interface fastEthernet 0/0.10                      #在fastEthernet 0/0介面新增號碼10之子介面(子介面的號碼不需和VLAN ID相同)
%LINK-5-CHANGED: Interface FastEthernet0/0.10, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.10, changed state to up
Router(<span style="color:#FF0000">config-subif</span>)#encapsulation dot1Q 10                       #使用802.1q協定並加上Vlan 10標籤
Router(config-subif)#ip address 192.168.10.254 255.255.255.0      #設定IP及MASK
Router(config-subif)#no shutdown                                  #啟動子介面
Router(config-subif)#end                                          #切換回enable模式
%SYS-5-CONFIG_I: Configured from console by console

Router#show ip interface brief&nbsp;                                   #查看介面狀態
Interface &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IP-Address &nbsp; &nbsp; &nbsp;OK? Method Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Protocol
&nbsp;
FastEthernet0/0 &nbsp; &nbsp; &nbsp; &nbsp;192.168.100.254 YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up
&nbsp;
<span style="color:#FF0000">FastEthernet0/0.10 &nbsp; &nbsp; 192.168.10.254 &nbsp;YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up     </span><span style="color:#000000">#新增的子介面已建立起來了</span>
&nbsp;
FastEthernet0/1 &nbsp; &nbsp; &nbsp; &nbsp;unassigned &nbsp; &nbsp; &nbsp;YES unset &nbsp;administratively down down
&nbsp;
Vlan1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unassigned &nbsp; &nbsp; &nbsp;YES unset &nbsp;administratively down down

Router#configure terminal&nbsp;                                       #進入全域模式
Enter configuration commands, one per line. &nbsp;End with CNTL/Z.
Router(config)#interface fastEthernet 0/0.20                     #在fastEthernet 0/0介面新增號碼20之子介面
%LINK-5-CHANGED: Interface FastEthernet0/0.20, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.20, changed state to up

Router(<span style="color:#FF0000">config-subif</span>)#encapsulation dot1Q 20                      #使用802.1q協定並加上Vlan 20標籤
Router(config-subif)#ip address 192.168.20.254 255.255.255.0
Router(config-subif)#no shutdown&nbsp;
Router(config-subif)#exit
Router(config)#interface fastEthernet 0/0.30
%LINK-5-CHANGED: Interface FastEthernet0/0.30, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.30, changed state to up

Router(config-subif)#encapsulation dot1Q 30
Router(config-subif)#ip address 192.168.30.254 255.255.255.0
Router(config-subif)#no shutdown&nbsp;
Router(config-subif)#exit
Router(config)#interface fastEthernet 0/0.40
%LINK-5-CHANGED: Interface FastEthernet0/0.40, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.40, changed state to up

Router(config-subif)#encapsulation dot1Q 40
Router(config-subif)#ip address 192.168.40.254 255.255.255.0
Router(config-subif)#no shutdown&nbsp;
Router(config-subif)#end                                          #切換回enable模式
%SYS-5-CONFIG_I: Configured from console by console

Router#show ip interface brief&nbsp;
Interface &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IP-Address &nbsp; &nbsp; &nbsp;OK? Method Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Protocol
&nbsp;
FastEthernet0/0 &nbsp; &nbsp; &nbsp; &nbsp;192.168.100.254 YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up
&nbsp;
<span style="color:#FF0000">FastEthernet0/0.10 &nbsp; &nbsp; 192.168.10.254 &nbsp;YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up
&nbsp;
FastEthernet0/0.20 &nbsp; &nbsp; 192.168.20.254 &nbsp;YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up
&nbsp;
FastEthernet0/0.30 &nbsp; &nbsp; 192.168.30.254 &nbsp;YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up
&nbsp;
FastEthernet0/0.40 &nbsp; &nbsp; 192.168.40.254 &nbsp;YES manual up &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;up      </span><span style="color:#000000">#子介面及IP均設定完成</span>
&nbsp;
FastEthernet0/1 &nbsp; &nbsp; &nbsp; &nbsp;unassigned &nbsp; &nbsp; &nbsp;YES unset &nbsp;administratively down down
&nbsp;
Vlan1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unassigned &nbsp; &nbsp; &nbsp;YES unset &nbsp;administratively down down</pre>

<p>測試連線狀態</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">C:\&gt;ipconfig                                          #查看本機IP

FastEthernet0 Connection:(default port)

&nbsp; &nbsp;Link-local IPv6 Address.........: FE80::201:63FF:FE66:9E5A
&nbsp; &nbsp;IP Address......................: 192.168.10.1
&nbsp; &nbsp;Subnet Mask.....................: 255.255.255.0
&nbsp; &nbsp;Default Gateway.................: 192.168.10.254

C:\&gt;ping 192.168.20.1                               #與VLAN 20做連線測試

Pinging 192.168.20.1 with 32 bytes of data:

Reply from 192.168.20.1: bytes=32 time=0ms TTL=127
Reply from 192.168.20.1: bytes=32 time=0ms TTL=127
Reply from 192.168.20.1: bytes=32 time=0ms TTL=127
Reply from 192.168.20.1: bytes=32 time=1ms TTL=127

Ping statistics for 192.168.20.1:
&nbsp; &nbsp; Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
&nbsp; &nbsp; Minimum = 0ms, Maximum = 1ms, Average = 0ms

C:\&gt;ping 192.168.30.1                              #與VLAN 30做連線測試

Pinging 192.168.30.1 with 32 bytes of data:

Reply from 192.168.30.1: bytes=32 time=0ms TTL=127
Reply from 192.168.30.1: bytes=32 time=0ms TTL=127
Reply from 192.168.30.1: bytes=32 time=0ms TTL=127
Reply from 192.168.30.1: bytes=32 time=1ms TTL=127

Ping statistics for 192.168.30.1:
&nbsp; &nbsp; Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
&nbsp; &nbsp; Minimum = 0ms, Maximum = 1ms, Average = 0ms

C:\&gt;ping 192.168.40.1                             #與VLAN 40做連線測試

Pinging 192.168.40.1 with 32 bytes of data:

Reply from 192.168.40.1: bytes=32 time=0ms TTL=127
Reply from 192.168.40.1: bytes=32 time=0ms TTL=127
Reply from 192.168.40.1: bytes=32 time=0ms TTL=127
Reply from 192.168.40.1: bytes=32 time=1ms TTL=127

Ping statistics for 192.168.40.1:
&nbsp; &nbsp; Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
&nbsp; &nbsp; Minimum = 0ms, Maximum = 1ms, Average = 0ms</pre>

<p>觀念補充1:&nbsp;&nbsp; &nbsp;每一個VLAN都是屬於一個Broadcast domain，也就是說不同VLAN彼此屬於不同網段<br>
觀念補充2:&nbsp;&nbsp; &nbsp;對L2 Switch而言, 同網段的IP可以自己送，但是不同網段必須要透過Router來轉送<br>
觀念補充3:&nbsp;&nbsp; &nbsp;VLAN 1預設的情況下屬於Native VLAN,，也就是說，VLAN 1在預設的情況下是不帶Tag的，而不帶Tag的VLAN可以直接透過實體介面來轉送, 如fa0/0<br>
觀念補充4:&nbsp;&nbsp; &nbsp;Trunk上可以同時傳送不同VLAN的資訊<br>
觀念補充5:&nbsp;&nbsp; &nbsp;encapsulation doc1Q vlan-ID指令是用來為sub-interface加上識別VLAN ID所使用的Tag<br>
觀念補充6:&nbsp;&nbsp; &nbsp;所有不同網段的目的位址, 需要透過同網段位址來詢問，因此Router上需要針對不同VLAN切出sub-interface，以便轉換不同VLAN(網段)間的位址<br>
觀念補充7:&nbsp;&nbsp; &nbsp;一個完整的ICMP(ping)包含兩個部份, Request跟Ack, 也就是說，在終端網路裝置上必須設定gateway位置，才能夠將接收來自不同網段的ICMP封包送回去</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45271917">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45271917"></div>]]></content:encoded>
      <pubDate>Fri, 26 May 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45271917#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Linux-Access Control List(ACL)]]></title>
      <link>https://david50.pixnet.net/blog/post/45269868</link>
      <guid>https://david50.pixnet.net/blog/post/45269868</guid>
      <description><![CDATA[ACL(Access Control List)：主要的目的是在Linux系統提供傳統的檔案及目錄存取權限之外，另外開放更細部權限設定功能。

啟用ACL:
由於Linux POSIX ACL 預設是關閉，因此需要透過檔案系統的啟用才能用此功能

ubuntu@ubuntu:~$ vim /etc/fstab                                  #編輯/etc/fstab
LABEL=cloudimg-rootfs &nbsp; /home &nbsp; &nbsp; &nbsp; &nbsp;ext4 &nbsp; defaults,acl &nbsp;0 0    #於defaults後加入acl 
ubuntu@ubuntu:~$ sudo mount -o remount /home                     #重新掛載
ubuntu@ubuntu:~$ cat /etc/mtab                                   #查看ACL是否已啟用
/dev/sda1 / ext4 rw,acl 0 0                                      #ACL已啟用


取得存取控制清單ACL資訊: getfacl

ubuntu@ubuntu:~$ touch acltest                        #建立個測試檔
ubuntu@ubuntu:~$ ls -l acltest                        #查看預設權限 
-rw-rw-r-- 1 ubuntu ubuntu 24 May 28 15:19 acltest
ubuntu@ubuntu:~$ getfacl acltest                      #查看ACL權限
# file: acltest                                       #檔案名稱
# owner: ubuntu                                       #檔案擁有者
# group: ubuntu                                       #檔案擁有群組
user::rw-                                             #擁有者權限
group::rw-                                            #擁有群組權限
other::r--                                            #其他使用者權限


設定存取控制清單ACL資訊: setfacl


	setfacl參數
	
		
			參數
			說明
		
		
			-m
			新增或修改ACL規則。
		
		
			-x
			移除現有的ACL規則。
		
		
			-d
			設定預設的ACL規則，僅可針對目錄進行操作。
		
		
			-b
			移除所有ACL規則。
		
	


&nbsp;

增加使用者權限：setfacl -m u:使用者:權限 檔名

ubuntu@ubuntu:~$ setfacl -m u:acltest:rw acltest       #讓acltest使用者可讀寫acltest檔案
ubuntu@ubuntu:~$ ls -l acltest                         #查看acltest檔案權限
-rw-rw-r--+ 1 ubuntu ubuntu 24 May 28 15:19 acltest    #在原本權限後增加了+號
ubuntu@ubuntu:~$ getfacl acltest
# file: acltest
# owner: ubuntu
# group: ubuntu
user::rw-
user:acltest:rw-                                       #增加了acltest使用者的權限
group::r--
mask::rw-
other::r--


設定ACL Mask：setfacl -m m:權限 檔案／目錄

ubuntu@ubuntu:~$ setfacl -m m:r acltest           #設定ACL Mask
ubuntu@ubuntu:~$ getfacl acltest                  #查看ACL權限
# file: acltest
# owner: ubuntu
# group: ubuntu
user::rw-
user:acltest:rw- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#effective:r--   #ACL Mask生效了
group::r--
mask::r--                                        #設定的ACL Mask權限
other::r--
ubuntu@ubuntu:~$ su acltest                      #切換為acltest
Password:&nbsp;
acltest@ubuntu:/home/ubuntu$ echo test &gt; acltest&nbsp;#嘗試寫入檔案
bash: acltest: Permission denied                 #因ACL Mask生效，所以無法寫入


設定目錄ACL權限

ubuntu@ubuntu:~$ mkdir acl_dir1                                 #建立acl_dir1目錄
ubuntu@ubuntu:~$ setfacl -m u:acltest:rwx acl_dir1              #建立ACL規則，讓acltest使用者可讀.寫.進入acl＿dir1目錄
ubuntu@ubuntu:~$ getfacl acl_dir1                               #查看ACL權限
# file: acl_dir1
# owner: ubuntu
# group: ubuntu
user::rwx
user:acltest:rwx
group::rwx
mask::rwx
other::r-x
ubuntu@ubuntu:~$ su acltest                                     #切換為acltest
Password:&nbsp;
acltest@ubuntu:/home/ubuntu$ touch acl_dir1/filetest            #以acltest使用者建立檔案
acltest@ubuntu:/home/ubuntu$ ls -l acl_dir/filetest
drwxrwxr-x &nbsp;1 acltest &nbsp; &nbsp;acltest &nbsp; &nbsp;4096 May 28 15:26 filetest  #擁有者和擁有群組為acltest
acltest@ubuntu:/home/ubuntu$ getfacl acl_dir1/filetest          #查看ACL權限
# file: filetest
# owner: acltest
# group: acltest                                                #擁有者和擁有群組為acltest
user::rwx
group::rwx
other::r-x
acltest@ubuntu:/home/ubuntu$ mkdir acl_dir1/dirtest             #以acltest使用者建立目錄
acltest@ubuntu:/home/ubuntu$ ls -ld acl_dir/dirtest
drwxrwxr-x 2 acltest acltest 4096 May 28 15:26 dirtest
acltest@ubuntu:/home/ubuntu$ getfacl acl_dir1/dirtest
# file: dirtest
# owner: acltest
# group: acltest                                               #擁有者和擁有群組為acltest
user::rwx
group::rwx
other::r-x                                                     #目錄ACL權限設定完成
acltest@ubuntu:/home/ubuntu$ exit                              #切換使用者回ubuntu
ubuntu@ubuntu:~$ mkdir acl_dir/subtest/                        #在acl_dir目錄下再建立個subtest檔案
ubuntu@ubuntu:~$ su acltest                                    #切換為acltest
Password:&nbsp;
acltest@ubuntu:/home/ubuntu$ ls -l acl_dir1/subtest            #查看檔案權限
-rw-rw-r-- &nbsp;1 ubuntu ubuntu &nbsp; &nbsp;0 Aug 28 15:21 subtest          #擁有者和擁有群組為ubuntu
acltest@ubuntu:/home/ubuntu$ echo test &gt; acl_dir1/subtest      #嘗試寫入檔案
bash: subtest: Permission denied                               #因未設定Default ACL所以無法寫入


設定Default ACL：setfacl -d -m 使用者/群組：權限 目錄
Default ACL主要針對目錄內所產生的檔案進行預設權限設定，因此只能套用在目錄中。

ubuntu@ubuntu:~$ setfacl -d -m u:acltest:rwx acl_dir1  #建立Default ACL規則，讓acltest使用者可讀.寫.進入acl＿dir1目錄
ubuntu@ubuntu:~$ getfacl acl_dir1                      #查看ACL權限
# file: acl_dir1
# owner: ubuntu
# group: ubuntu
user::rwx
user:acltest:rwx
group::rwx
mask::rwx
other::r-x
default:user::rwx
default:user:acltest:rwx
default:group::rwx
default:mask::rwx
default:other::r-x                                       #Default ACL設定完成
ubuntu@ubuntu:~$ touch acl_dir1/dfacltest                #在acl_dir1目錄下建立檔案
ubuntu@ubuntu:~$ ls -l  acl_dir1/dfacltest               #查看在acl_dir1目錄下建立的檔案
-rw-rw-r--+ 1 ubuntu ubuntu &nbsp; &nbsp;0 May 29 11:04 dfacltest  #建立的檔案已有ACL權限
ubuntu@ubuntu:~$ getfacl acl_dir1/dfacltest              #查看ACL權限
# file: dfacltest
# owner: ubuntu
# group: ubuntu
user::rw-
user:acltest:rwx &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#effective:rw-
group::rwx &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#effective:rw-
mask::rw-
other::r--
ubuntu@ubuntu:~$ su acltest                              #切換為acltest
Password:&nbsp;
acltest@ubuntu:/home/ubuntu$ echo "write dfacltest" &gt; acl_dir1/dfacltest&nbsp;#嘗試寫入檔案
acltest@ubuntu:/home/ubuntu$ cat acl_dir1/dfacltest&nbsp;     #驗證是檔案是否寫入
write dfacltest                                          #因有目錄設定Default ACL，可寫入檔案


移除ACL權限：setfacl -x 使用者／群組 檔案／目錄

ubuntu@ubuntu:~$ getfacl acltest&nbsp;                  #查看ACL權限
# file: acltest
# owner: ubuntu
# group: ubuntu
user::rw-
user:acltest:rw- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#effective:r--
group::r--
mask::r--
other::r--
ubuntu@ubuntu:~$ setfacl -x u:acltest acltest      #移除ACL權限
ubuntu@ubuntu:~$ getfacl acltest                   #再次查看ACL權限
# file: acltest
# owner: ubuntu
# group: ubuntu
user::rw-
group::r--
mask::r--
other::r--                                         #acltest之ACL權限已被移除


移除所有ACL權限：setfacl -b 檔案／目錄

ubuntu@ubuntu:~$ getfacl acltest&nbsp;     #查看ACL權限
# file: acltest
# owner: acltest
# group: acltest
user::rw-
user:ubuntu:rw-
group::rw-
group:ubuntu:rw-
mask::rwx
other::r--
ubuntu@ubuntu:~$ setfacl -b acltest&nbsp; #刪除所有ACL權限
ubuntu@ubuntu:~$ getfacl acltest&nbsp;    #再次查看ACL權限
# file: acltest
# owner: acltest
# group: acltest
user::rw-
group::rw-
other::r--                           #檔案已變為預設權限

]]></description>
      <content:encoded><![CDATA[<p>ACL(Access Control List)：主要的目的是在Linux系統提供傳統的檔案及目錄存取權限之外，另外開放更細部權限設定功能。</p>

<p><strong>啟用ACL:</strong><br>
由於Linux POSIX ACL 預設是關閉，因此需要透過檔案系統的啟用才能用此功能</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ vim /etc/fstab                                  #編輯/etc/fstab
LABEL=cloudimg-rootfs &nbsp; /home &nbsp; &nbsp; &nbsp; &nbsp;ext4 &nbsp; defaults,<span style="color:#FF0000">acl</span> &nbsp;0 0    #於defaults後加入acl 
ubuntu@ubuntu:~$ sudo mount -o remount /home                     #重新掛載
ubuntu@ubuntu:~$ cat /etc/mtab                                   #查看ACL是否已啟用
/dev/sda1 / ext4 rw,<span style="color:#FF0000">acl</span> 0 0                                      #ACL已啟用
</pre>

<p><strong>取得存取控制清單ACL資訊: getfacl</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ touch acltest                        #建立個測試檔
ubuntu@ubuntu:~$ ls -l acltest                        #查看預設權限 
-rw-rw-r-- 1 ubuntu ubuntu 24 May 28 15:19 acltest
ubuntu@ubuntu:~$ getfacl acltest                      #查看ACL權限
# file: acltest                                       #檔案名稱
# owner: ubuntu                                       #檔案擁有者
# group: ubuntu                                       #檔案擁有群組
user::rw-                                             #擁有者權限
group::rw-                                            #擁有群組權限
other::r--                                            #其他使用者權限
</pre>

<p><strong>設定存取控制清單ACL資訊: setfacl</strong></p>

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<caption>setfacl參數</caption>
	<tbody>
		<tr>
			<td style="text-align: center;">參數</td>
			<td style="text-align: center;">說明</td>
		</tr>
		<tr>
			<td style="text-align: center;">-m</td>
			<td>新增或修改ACL規則。</td>
		</tr>
		<tr>
			<td style="text-align: center;">-x</td>
			<td>移除現有的ACL規則。</td>
		</tr>
		<tr>
			<td style="text-align: center;">-d</td>
			<td>設定預設的ACL規則，僅可針對目錄進行操作。</td>
		</tr>
		<tr>
			<td style="text-align: center;">-b</td>
			<td>移除所有ACL規則。</td>
		</tr>
	</tbody>
</table>

<p>&nbsp;</p>

<p><strong>增加使用者權限：setfacl -m u:使用者:權限 檔名</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ setfacl -m u:acltest:rw acltest       #讓acltest使用者可讀寫acltest檔案
ubuntu@ubuntu:~$ ls -l acltest                         #查看acltest檔案權限
-rw-rw-r--<span style="color:#FF0000">+</span> 1 ubuntu ubuntu 24 May 28 15:19 acltest    #在原本權限後增加了+號
ubuntu@ubuntu:~$ getfacl acltest
# file: acltest
# owner: ubuntu
# group: ubuntu
user::rw-
<span style="color:#FF0000">user:acltest:rw-</span>                                       #增加了acltest使用者的權限
group::r--
mask::rw-
other::r--
</pre>

<p><strong>設定ACL Mask：setfacl -m m:權限 檔案／目錄</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ setfacl -m m:r acltest           #設定ACL Mask
ubuntu@ubuntu:~$ getfacl acltest                  #查看ACL權限
# file: acltest
# owner: ubuntu
# group: ubuntu
user::rw-
user:acltest:rw- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#FF0000">#effective:r--   </span>#ACL Mask生效了
group::r--
<span style="color:#FF0000">mask::r--                                        </span><span style="color:#000000">#設定的ACL Mask權限</span>
other::r--
ubuntu@ubuntu:~$ su acltest                      #切換為acltest
Password:&nbsp;
acltest@ubuntu:/home/ubuntu$ echo test &gt; acltest&nbsp;#嘗試寫入檔案
bash: acltest: Permission denied                 #因ACL Mask生效，所以無法寫入
</pre>

<p><strong>設定目錄ACL權限</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ mkdir acl_dir1                                 #建立acl_dir1目錄
ubuntu@ubuntu:~$ setfacl -m u:acltest:rwx acl_dir1              #建立ACL規則，讓acltest使用者可讀.寫.進入acl＿dir1目錄
ubuntu@ubuntu:~$ getfacl acl_dir1                               #查看ACL權限
# file: acl_dir1
# owner: ubuntu
# group: ubuntu
user::rwx
<span style="color:#FF0000">user:acltest:rwx</span>
group::rwx
mask::rwx
other::r-x
ubuntu@ubuntu:~$ su acltest                                     #切換為acltest
Password:&nbsp;
acltest@ubuntu:/home/ubuntu$ touch acl_dir1/filetest            #以acltest使用者建立檔案
acltest@ubuntu:/home/ubuntu$ ls -l acl_dir/filetest
drwxrwxr-x &nbsp;1 <span style="color:#FF0000">acltest</span> &nbsp; &nbsp;<span style="color:#FF0000">acltest</span> &nbsp; &nbsp;4096 May 28 15:26 filetest  #擁有者和擁有群組為acltest
acltest@ubuntu:/home/ubuntu$ getfacl acl_dir1/filetest          #查看ACL權限
# file: filetest
# <span style="color:#FF0000">owner: acltest</span>
# <span style="color:#FF0000">group: acltest                                                </span>#擁有者和擁有群組為acltest
user::rwx
group::rwx
other::r-x
acltest@ubuntu:/home/ubuntu$ mkdir acl_dir1/dirtest             #以acltest使用者建立目錄
acltest@ubuntu:/home/ubuntu$ ls -ld acl_dir/dirtest
drwxrwxr-x 2 acltest acltest 4096 May 28 15:26 dirtest
acltest@ubuntu:/home/ubuntu$ getfacl acl_dir1/dirtest
# file: dirtest
# <span style="color:#FF0000">owner: acltest</span>
# <span style="color:#FF0000">group: acltest                                               </span>#擁有者和擁有群組為acltest
user::rwx
group::rwx
other::r-x                                                     #目錄ACL權限設定完成
acltest@ubuntu:/home/ubuntu$ exit                              #切換使用者回ubuntu
ubuntu@ubuntu:~$ mkdir acl_dir/subtest/                        #在acl_dir目錄下再建立個subtest檔案
ubuntu@ubuntu:~$ su acltest                                    #切換為acltest
Password:&nbsp;
acltest@ubuntu:/home/ubuntu$ ls -l acl_dir1/subtest            #查看檔案權限
-rw-rw-r-- &nbsp;1 <span style="color:#FF0000">ubuntu</span> <span style="color:#FF0000">ubuntu</span> &nbsp; &nbsp;0 Aug 28 15:21 subtest          #擁有者和擁有群組為ubuntu
acltest@ubuntu:/home/ubuntu$ echo test &gt; acl_dir1/subtest      #嘗試寫入檔案
bash: subtest: Permission denied                               #因未設定Default ACL所以無法寫入
</pre>

<p><strong>設定Default ACL：setfacl -d -m 使用者/群組：權限 目錄</strong><br>
Default ACL主要針對目錄內所產生的檔案進行預設權限設定，因此只能套用在目錄中。</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ setfacl -d -m u:acltest:rwx acl_dir1  #建立Default ACL規則，讓acltest使用者可讀.寫.進入acl＿dir1目錄
ubuntu@ubuntu:~$ getfacl acl_dir1                      #查看ACL權限
# file: acl_dir1
# owner: ubuntu
# group: ubuntu
user::rwx
user:acltest:rwx
group::rwx
mask::rwx
other::r-x
<span style="color:#FF0000">default:user::rwx
default:user:acltest:rwx
default:group::rwx
default:mask::rwx
default:other::r-x</span>                                       #Default ACL設定完成
ubuntu@ubuntu:~$ touch acl_dir1/dfacltest                #在acl_dir1目錄下建立檔案
ubuntu@ubuntu:~$ ls -l  acl_dir1/dfacltest               #查看在acl_dir1目錄下建立的檔案
-rw-rw-r--<span style="color:#FF0000">+</span> 1 ubuntu ubuntu &nbsp; &nbsp;0 May 29 11:04 dfacltest  #建立的檔案已有ACL權限
ubuntu@ubuntu:~$ getfacl acl_dir1/dfacltest              #查看ACL權限
# file: dfacltest
# owner: ubuntu
# group: ubuntu
user::rw-
<span style="color:#FF0000">user:acltest:rwx &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#effective:rw-
group::rwx &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#effective:rw-</span>
mask::rw-
other::r--
ubuntu@ubuntu:~$ su acltest                              #切換為acltest
Password:&nbsp;
acltest@ubuntu:/home/ubuntu$ echo "write dfacltest" &gt; acl_dir1/dfacltest&nbsp;#嘗試寫入檔案
acltest@ubuntu:/home/ubuntu$ cat acl_dir1/dfacltest&nbsp;     #驗證是檔案是否寫入
write dfacltest                                          #因有目錄設定Default ACL，可寫入檔案
</pre>

<p><strong>移除ACL權限：setfacl -x 使用者／群組 檔案／目錄</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ getfacl acltest&nbsp;                  #查看ACL權限
# file: acltest
# owner: ubuntu
# group: ubuntu
user::rw-
<span style="color:#FF0000">user:acltest:rw- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#effective:r--</span>
group::r--
mask::r--
other::r--
ubuntu@ubuntu:~$ setfacl -x u:acltest acltest      #移除ACL權限
ubuntu@ubuntu:~$ getfacl acltest                   #再次查看ACL權限
# file: acltest
# owner: ubuntu
# group: ubuntu
user::rw-
group::r--
mask::r--
other::r--                                         #acltest之ACL權限已被移除
</pre>

<p><strong>移除所有ACL權限：setfacl -b 檔案／目錄</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ getfacl acltest&nbsp;     #查看ACL權限
# file: acltest
# owner: acltest
# group: acltest
user::rw-
<span style="color:#FF0000">user:ubuntu:rw-</span>
group::rw-
<span style="color:#FF0000">group:ubuntu:rw-</span>
<span style="color:#FF0000">mask::rwx</span>
other::r--
ubuntu@ubuntu:~$ setfacl -b acltest&nbsp; #刪除所有ACL權限
ubuntu@ubuntu:~$ getfacl acltest&nbsp;    #再次查看ACL權限
# file: acltest
# owner: acltest
# group: acltest
user::rw-
group::rw-
other::r--                           #檔案已變為預設權限
</pre>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45269868">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45269868"></div>]]></content:encoded>
      <pubDate>Wed, 24 May 2017 15:39:00 +0800</pubDate>
      <category><![CDATA[Linux]]></category>
      <comments>https://david50.pixnet.net/blog/post/45269868#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Cisco基本指令-VLAN]]></title>
      <link>https://david50.pixnet.net/blog/post/45244986</link>
      <guid>https://david50.pixnet.net/blog/post/45244986</guid>
      <description><![CDATA[VLAN(Virtual Local Area Network)虛擬區域網路，是以邏輯連線取代區域網路所定義的實體連線，VLAN提供了邏輯分割區域網路的方法來切割LAN，也可控制LAN的大小，讓管理時更加有彈性。

Access Port &amp; Trunk Port
每個Switch Port有兩種運作模式，一種是Access Mode，另一種是Trunk Mode，當設定為Access Mode時該Port只能指派給一個VLAN，也只允許所屬VLAN的封包通過，如果是Trunk Port，則允許任何VLAN封包通過（在預設情況下）。

查看VLAN狀態：show vlan brief

Switch#show vlan brief&nbsp;                #先查看目前VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22, Fa0/23, Fa0/24
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp;&nbsp;


建立VLAN

Switch(config)#vlan 2             #建立編號2的VLAN
Switch(config-vlan)#name newvlan  #將VLAN 2取名為newvlan(非必要)
Switch(config-vlan)#end           #切換回enable模式
%SYS-5-CONFIG_I: Configured from console by console
Switch#show vlan brief&nbsp;           #查看VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22, Fa0/23, Fa0/24
2 &nbsp; &nbsp;newvlan &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;#VLAN編號為2，名稱為剛設定的newvlan

將Port指定至VLAN中：switchport access

Switch(config)#interface range fastEthernet 0/11-20  #使用interface range一次設定fastEthernet 0/11-20
Switch(config-if-range)#switchport access vlan 2     #將Port指定為VLAN 2
Switch(config-if-range)#end                          #切換至enable模式
%SYS-5-CONFIG_I: Configured from console by console
Switch#show vlan brief&nbsp;                              #查看VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/21, Fa0/22
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/23, Fa0/24
2 &nbsp; &nbsp;newvlan &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/11, Fa0/12, Fa0/13, Fa0/14
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/15, Fa0/16, Fa0/17, Fa0/18
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/19, Fa0/20         #fastEthernet 0/11-20已指定至VLAN 2
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active&nbsp;


設定Port Mode： switchport mode

Switch(config)#interface fastEthernet 0/24           #進入FastEthernet0/24介面設定
Switch(config-if)#switchport mode trunk&nbsp;             #將Port設定為Trunk Mode
Switch(config-if)#end                                #切換至enable模式
%SYS-5-CONFIG_I: Configured from console by console
Switch#show vlan brief&nbsp;                              #查看VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/21, Fa0/22
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/23                         #Fa0/24消失了
2 &nbsp; &nbsp;newvlan &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/11, Fa0/12, Fa0/13, Fa0/14
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/15, Fa0/16, Fa0/17, Fa0/18
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/19, Fa0/20
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;


查看trunk狀態

Switch#show interfaces trunk&nbsp;
Port &nbsp; &nbsp; &nbsp; &nbsp;Mode &nbsp; &nbsp; &nbsp; &nbsp; Encapsulation &nbsp;Status &nbsp; &nbsp; &nbsp; &nbsp;Native vlan
Fa0/24 &nbsp; &nbsp; &nbsp;on &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 802.1q &nbsp; &nbsp; &nbsp; &nbsp; trunking &nbsp; &nbsp; &nbsp;1

Port &nbsp; &nbsp; &nbsp; &nbsp;Vlans allowed on trunk
Fa0/24 &nbsp; &nbsp; &nbsp;1-1005

Port &nbsp; &nbsp; &nbsp; &nbsp;Vlans allowed and active in management domain
Fa0/24 &nbsp; &nbsp; &nbsp;1,2

Port &nbsp; &nbsp; &nbsp; &nbsp;Vlans in spanning tree forwarding state and not pruned
Fa0/24 &nbsp; &nbsp; &nbsp;1,2



在上圖的網路中，即使PC0.PC1的IP和PC2.PC3是在同一個網段中，因為分屬於不同VLAN所以無法互通。

C:\Users&gt;ipconfig                               #查看目前PC0之IP設定

FastEthernet0 Connection:(default port)

&nbsp; &nbsp;Link-local IPv6 Address.........: FE80::20B:BEFF:FED1:9803
&nbsp; &nbsp;IP Address......................: 192.168.0.1
&nbsp; &nbsp;Subnet Mask.....................: 255.255.255.0
&nbsp; &nbsp;Default Gateway.................: 0.0.0.0

C:\Users&gt;ping 192.168.0.2                      #ping PC1 192.168.0.2

Pinging 192.168.0.2 with 32 bytes of data:

Reply from 192.168.0.2: bytes=32 time=0ms TTL=128
Reply from 192.168.0.2: bytes=32 time=0ms TTL=128
Reply from 192.168.0.2: bytes=32 time=0ms TTL=128
Reply from 192.168.0.2: bytes=32 time=0ms TTL=128

Ping statistics for 192.168.0.2:
&nbsp; &nbsp; Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
&nbsp; &nbsp; Minimum = 0ms, Maximum = 0ms, Average = 0ms
可正常連線
C:\Users&gt;ping 192.168.0.3                     #ping PC2 192.168.0.3

Pinging 192.168.0.3 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.0.3:
&nbsp; &nbsp; Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
即使同網段但因不同VLAN，所以無法線
C:\Users&gt;ping 192.168.0.4 　　　　　　　　　　　#ping PC3 192.168.0.4

Pinging 192.168.0.4 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.0.4:
&nbsp; &nbsp; Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
即使同網段但因不同VLAN，所以無法線

]]></description>
      <content:encoded><![CDATA[<p>VLAN(Virtual Local Area Network)虛擬區域網路，是以邏輯連線取代區域網路所定義的實體連線，VLAN提供了邏輯分割區域網路的方法來切割LAN，也可控制LAN的大小，讓管理時更加有彈性。</p>

<p>Access Port &amp; Trunk Port<br>
每個Switch Port有兩種運作模式，一種是Access Mode，另一種是Trunk Mode，當設定為Access Mode時該Port只能指派給一個VLAN，也只允許所屬VLAN的封包通過，如果是Trunk Port，則允許任何VLAN封包通過（在預設情況下）。</p>

<p><strong>查看VLAN狀態：show vlan brief</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Switch#show vlan brief&nbsp;                #先查看目前VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22, Fa0/23, Fa0/24
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp;&nbsp;
</pre>

<p><strong>建立VLAN</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Switch(config)#vlan 2             #建立編號2的VLAN
Switch(config-vlan)#name newvlan  #將VLAN 2取名為newvlan(非必要)
Switch(config-vlan)#end           #切換回enable模式
%SYS-5-CONFIG_I: Configured from console by console
Switch#show vlan brief&nbsp;           #查看VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/11, Fa0/12
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/13, Fa0/14, Fa0/15, Fa0/16
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/17, Fa0/18, Fa0/19, Fa0/20
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/21, Fa0/22, Fa0/23, Fa0/24
<span style="color:#FF0000">2</span> &nbsp; &nbsp;<span style="color:#FF0000">newvlan</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;#VLAN編號為2，名稱為剛設定的newvlan</pre>

<p><strong>將Port指定至VLAN中：switchport access</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Switch(config)#interface range fastEthernet 0/11-20  #使用interface range一次設定fastEthernet 0/11-20
Switch(config-if-range)#switchport access vlan 2     #將Port指定為VLAN 2
Switch(config-if-range)#end                          #切換至enable模式
%SYS-5-CONFIG_I: Configured from console by console
Switch#show vlan brief&nbsp;                              #查看VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/21, Fa0/22
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/23, Fa0/24
<span style="color:#FF0000">2</span> &nbsp; &nbsp;newvlan &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;<span style="color:#FF0000">Fa0/11, Fa0/12, Fa0/13, Fa0/14
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/15, Fa0/16, Fa0/17, Fa0/18
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/19, Fa0/20         </span><span style="color:#000000">#</span>fastEthernet 0/11-20已指定至VLAN 2
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active&nbsp;
</pre>

<p><strong>設定Port Mode： switchport mode</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Switch(config)#interface fastEthernet 0/24           #進入FastEthernet0/24介面設定
Switch(config-if)#switchport mode trunk&nbsp;             #將Port設定為Trunk Mode
Switch(config-if)#end                                #切換至enable模式
%SYS-5-CONFIG_I: Configured from console by console
Switch#show vlan brief&nbsp;                              #查看VLAN狀態

VLAN Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Status &nbsp; &nbsp;Ports
---- -------------------------------- --------- -------------------------------
1 &nbsp; &nbsp;default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/1, Fa0/2, Fa0/3, Fa0/4
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/5, Fa0/6, Fa0/7, Fa0/8
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/9, Fa0/10, Fa0/21, Fa0/22
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/23                         #Fa0/24消失了
2 &nbsp; &nbsp;newvlan &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;Fa0/11, Fa0/12, Fa0/13, Fa0/14
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/15, Fa0/16, Fa0/17, Fa0/18
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fa0/19, Fa0/20
1002 fddi-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1003 token-ring-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active &nbsp; &nbsp;
1004 fddinet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
1005 trnet-default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;active &nbsp; &nbsp;
</pre>

<p><strong>查看trunk狀態</strong></p>

<pre class="notranslate" style="margin: 0px 0px 20px; padding: 6px 10px; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); line-height: 19px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; letter-spacing: normal;">Switch#show interfaces trunk&nbsp;
Port &nbsp; &nbsp; &nbsp; &nbsp;Mode &nbsp; &nbsp; &nbsp; &nbsp; Encapsulation &nbsp;Status &nbsp; &nbsp; &nbsp; &nbsp;Native vlan
<span style="color:#FF0000">Fa0/24</span> &nbsp; &nbsp; &nbsp;on &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 802.1q &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000">trunking</span> &nbsp; &nbsp; &nbsp;1

Port &nbsp; &nbsp; &nbsp; &nbsp;Vlans allowed on trunk
Fa0/24 &nbsp; &nbsp; &nbsp;1-1005

Port &nbsp; &nbsp; &nbsp; &nbsp;Vlans allowed and active in management domain
Fa0/24 &nbsp; &nbsp; &nbsp;1,<span style="color:#FF0000">2</span>

Port &nbsp; &nbsp; &nbsp; &nbsp;Vlans in spanning tree forwarding state and not pruned
Fa0/24 &nbsp; &nbsp; &nbsp;1,<span style="color:#FF0000">2</span></pre>

<p><img alt="vlan.JPG" src="https://pic.pimg.tw/david50/1503128105-1298139124_n.jpg?v=1503128124" title="vlan.JPG"></p>

<p>在上圖的網路中，即使PC0.PC1的IP和PC2.PC3是在同一個網段中，因為分屬於不同VLAN所以無法互通。</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">C:\Users&gt;ipconfig                               #查看目前PC0之IP設定

FastEthernet0 Connection:(default port)

&nbsp; &nbsp;Link-local IPv6 Address.........: FE80::20B:BEFF:FED1:9803
&nbsp; &nbsp;IP Address......................: <span style="color:#FF0000">192.168.0.1</span>
&nbsp; &nbsp;Subnet Mask.....................: 255.255.255.0
&nbsp; &nbsp;Default Gateway.................: 0.0.0.0

C:\Users&gt;ping 192.168.0.2                      #ping PC1 192.168.0.2

Pinging 192.168.0.2 with 32 bytes of data:

Reply from 192.168.0.2: bytes=32 time=0ms TTL=128
Reply from 192.168.0.2: bytes=32 time=0ms TTL=128
Reply from 192.168.0.2: bytes=32 time=0ms TTL=128
Reply from 192.168.0.2: bytes=32 time=0ms TTL=128

Ping statistics for 192.168.0.2:
&nbsp; &nbsp; Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
&nbsp; &nbsp; Minimum = 0ms, Maximum = 0ms, Average = 0ms
可正常連線
C:\Users&gt;ping 192.168.0.3                     #ping PC2 192.168.0.3

Pinging 192.168.0.3 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.0.3:
&nbsp; &nbsp; Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
即使同網段但因不同VLAN，所以無法線
C:\Users&gt;ping 192.168.0.4 　　　　　　　　　　　#ping PC3 192.168.0.4

Pinging 192.168.0.4 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.0.4:
&nbsp; &nbsp; Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
即使同網段但因不同VLAN，所以無法線
</pre>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45244986">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45244986"></div>]]></content:encoded>
      <pubDate>Fri, 19 May 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45244986#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Linux協助管理指令]]></title>
      <link>https://david50.pixnet.net/blog/post/45242241</link>
      <guid>https://david50.pixnet.net/blog/post/45242241</guid>
      <description><![CDATA[Linux中有許多指令是方便管理者快速管理系統的小工具，也可將這些指令在運用在script中以增加管理者的方便性。

echo
echo是個很常用的指令，可將輸入的文字顯示在營幕上也可利用"&gt;"或"&gt;&gt;"將輸入的文字寫入檔案，也可叫出變數內容。
將輸入的文字顯示在營幕

ubuntu@ubuntu:~$ echo Hi Welcome
Hi Welcome

輸入的文字寫入檔案

ubuntu@ubuntu:~$ echo abc &gt;echotest.txt   #將abc導入echotest.txt
ubuntu@ubuntu:~$ ls
echotest.txt                              #echotest.txt被建立了
ubuntu@ubuntu:~$ cat echotest.txt&nbsp;        #顯示echotest.txt檔案內容
abc

回傳變數內容

ubuntu@ubuntu:~$ echo $HOSTNAME  #回傳主機名稱變數值
ubuntu

特殊字元
某些特殊字元無法在command line中顯示，可使用ANSI-C規格的特殊字元"\"來表示


	特殊字元
	
		
			特殊字元
			說明
		
		
			\\
			單純顯示\符號
		
		
			\'
			單純顯示'符號
		
		
			\"
			單純顯示"符號
		
		
			\a
			警示聲(Be)
		
		
			\b
			backspace鍵
		
		
			\n
			饋行
		
		
			\t
			水平定位點，同tab
		
		
			\v
			垂直定位點
		
	


希望回傳特殊字元的結果時需加上-e參數才會將\視為特特殊字元處理

ubuntu@ubuntu:~$ echo "line1\nline2\nline3"
line1\nline2\nline3              #未加-e不會饋行
ubuntu@ubuntu:~$ echo -e "line1\nline2\nline3"
line1
line2
line3                            #加上-e後\n被解讀為饋行


alias 別名
Linux的shell有別名的功能，可以針對常用指令自訂別名，將常用的指令設定別名後可簡化指令。

ubuntu@ubuntu:~$ alias                                 #alias不加任何指令可以顯示目前已設定好的別名
alias ls='ls --color=auto'
ubuntu@ubuntu:~$ alias ifc='ifconfig -a'               #將ifconfig -a設定別名為ifc
ubuntu@ubuntu:~$ ifc                                   #執行ifc後的結果和執行ifconfig -a一樣
eth0 &nbsp; &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 44:15:1a:6d:00:05 &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.0.2 &nbsp;Bcast:192.168.0.254 &nbsp;Mask:255.255.255.255
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet6 addr: fe80::4415:1aff:fe6d:5/64 Scope:Link
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UP BROADCAST RUNNING MULTICAST &nbsp;MTU:1460 &nbsp;Metric:1
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX packets:295308 errors:0 dropped:0 overruns:0 frame:1
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TX packets:288002 errors:0 dropped:0 overruns:0 carrier:0
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collisions:0 txqueuelen:1000&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX bytes:259944983 (259.9 MB) &nbsp;TX bytes:44758045 (44.7 MB)

lo &nbsp; &nbsp; &nbsp; &nbsp;Link encap:Local Loopback &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:127.0.0.1 &nbsp;Mask:255.0.0.0
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet6 addr: ::1/128 Scope:Host
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UP LOOPBACK RUNNING &nbsp;MTU:65536 &nbsp;Metric:1
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX packets:19 errors:0 dropped:0 overruns:0 frame:0
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collisions:0 txqueuelen:1&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX bytes:1850 (1.8 KB) &nbsp;TX bytes:1850 (1.8 KB)
ubuntu@ubuntu:~$ unalias                              #刪除別名
ubuntu@ubuntu:~$ ifc
No command 'ifc' found, but there are 16 similar ones
ifc: command not found                                #無法找到該指令


alias所定義的別名，只會在目前工作階段保留，若關閉終端機或登出，所定義的別名就會消失，在ubuntu若要永久定義別名可將別名寫入"~/.bash_aliases"檔中(在CentOS或Fedora則是在~/.bashrc檔中)，在ubuntu中預設是沒有.bash_aliases這個檔的,需要自己建立，建立檔案會需要再重新登入一次才會所設定的別名才會生效。

ubuntu@ubuntu:~$ vim .bash_aliases                    #使用編輯軟體編輯.bash_aliases
alias ifc='ifconfig -a'
alias dfh='df -h'
存當後離開，ubuntu需重新登入
ubuntu@ubuntu:~$ dfh                                  #使用新設定的別名執行
Filesystem &nbsp; &nbsp; &nbsp;Size &nbsp;Used Avail Use% Mounted on
udev &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;283M &nbsp;4.0K &nbsp;283M &nbsp; 1% /dev
tmpfs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;59M &nbsp;284K &nbsp; 59M &nbsp; 1% /run
/dev/sda1 &nbsp; &nbsp; &nbsp; 9.9G &nbsp;2.9G &nbsp;6.5G &nbsp;31% /
none &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4.0K &nbsp; &nbsp; 0 &nbsp;4.0K &nbsp; 0% /sys/fs/cgroup
none &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5.0M &nbsp; &nbsp; 0 &nbsp;5.0M &nbsp; 0% /run/lock
none &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;295M &nbsp; &nbsp; 0 &nbsp;295M &nbsp; 0% /run/shm
none &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100M &nbsp; &nbsp; 0 &nbsp;100M &nbsp; 0% /run/user


統計檔案行數與字數 wc
wc指令(word count)可統計檔案內有多少行(newline)、英文字(word)及位元組(byte)

ubuntu@ubuntu:~$ wc /var/log/dmesg           #計算/var/log/dmesg之行數、英文字數及byte數
&nbsp; 400 &nbsp;3424 27270 /var/log/dmesg             #檔案內有400行 3424個英文字 27270byte
ubuntu@ubuntu:~$ wc -l /var/log/dmesg        #計算/var/log/dmesg之行數
400 /var/log/dmesg                           #檔案內有400行
ubuntu@ubuntu:~$ wc -w /var/log/dmesg        #計算/var/log/dmesg之byte數
3424 /var/log/dmesg                          #檔案內有3424個英文字
ubuntu@ubuntu:~$ wc -c /var/log/dmesg        #計算/var/log/dmesg之英文字數
27270 /var/log/dmesg                         #檔案內有27270byte


取代與刪除字元 tr
語法：tr 欲被置換或刪除之字元 欲罝換之字元
tr可以取代或刪除文件中的字串

ubuntu@ubuntu:~$ cat /etc/passwd                       #先查看正常/etc/passwd檔案內容
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
ubuntu:x:1000:1000:Ubuntu:/home/ubuntu:/bin/bash
ubuntu@ubuntu:~$ cat /etc/passwd |tr "\:" "\/"         #使用tr將:改為tab
root &nbsp; &nbsp;x &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; root &nbsp; &nbsp;/root &nbsp;         /bin/bash
daemon &nbsp;x &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; daemon &nbsp;/usr/sbin &nbsp; &nbsp; &nbsp; /usr/sbin/nologin
ubuntu &nbsp;x &nbsp; &nbsp; &nbsp; 1000 &nbsp; &nbsp;1000 &nbsp; &nbsp;Ubuntu &nbsp;/home/ubuntu &nbsp; &nbsp;/bin/bash
ubuntu@ubuntu:~$ cat /etc/passwd |tr "\:" "\/"|tr -d x #使用tr將:改為tab，再將"ｘ"的刪除
root &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; root &nbsp; &nbsp;/root &nbsp;         /bin/bash
daemon &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; daemon &nbsp;/usr/sbin &nbsp; &nbsp; &nbsp; /usr/sbin/nologin
ubuntu &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1000 &nbsp; &nbsp;1000 &nbsp; &nbsp;Ubuntu &nbsp;/home/ubuntu &nbsp; &nbsp;/bin/bash



	tr定義
	
		
			參數
			說明
		
		
			[:alnum:]
			所有大小寫字母與數字
		
		
			[:alpha:]
			所有大小寫字母
		
		
			[:blank:]
			空白
		
		
			[:digit:]
			所有數字
		
		
			[:lower:]
			所有小寫字母
		
		
			[:upper:]
			所有大寫字母
		
	


ubuntu@ubuntu:~$ cat /etc/passwd |tr [:lower:] [:upper:]    #先查看正常/etc/passwd檔案內所有小寫字母換成大寫字母
ROOT:X:0:0:ROOT:/ROOT:/BIN/BASH
DAEMON:X:1:1:DAEMON:/USR/SBIN:/USR/SBIN/NOLOGIN
UBUNTU:X:1000:1000:UBUNTU:/HOME/UBUNTU:/BIN/BASH


產生序列數字 seq
語法：seq 開始數字 結束數字


	seq參數
	
		
			參說
			說明
		
		
			-f
			使用printf格式定義格式
		
		
			-w
			將所有輸出使用相同位元顯示(即補0)
		
		
			-s
			在輸出的數字加上指定字串
		
	


ubunua@ubuntu:~$ seq 1 5     #產生1至5的數字
1
2
3
4
5
ubuntu@ubuntu:~$ seq 2 2 12   #由2開始加2至12
2
4
6
8
10
12
ubuntu@ubuntu:~$ seq -w 6 10  #將每個數字都使用相同的位元數
06
07
08
09
10
ubuntu@ubuntu:~$ seq -s - 1 2 10  #在每個數字間加入"-"
1-3-5-7-9
ubuntu@ubuntu:~$ seq -f seq -f "%1g" 6 10&nbsp; #使用printf格式輸出數字6-10
6
7
8
9
10


文字檔內容排序 sort
sort可用來將文字檔內的每一列做排序，並將排序的結果在營幕上顯示。

ubuntu@ubuntu:~$ cat&nbsp;/etc/passwd                #先查看未排序的/etc/passwd檔的內容
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
ubuntu@ubuntu:~$ sort&nbsp;/etc/passwd               #排序/etc/passwd檔的內容
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
games:x:5:60:games:/usr/games:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin


sort預設會以第一個字元的ASCII碼比較，若相同再比較第二個字元,以此類推，若要依數值大小排序可以使用-g參數。

ubuntu@ubuntu:~$ cat sorttest&nbsp;      #使用cat查看原始檔案內容
32468
21655
7317
19566
1247
ubuntu@ubuntu:~$ sort sorttest&nbsp;    #使用sort排序檔案
1247
19566
21655
32468
7317
ubuntu@ubuntu:~$ sort -g sorttest&nbsp; #使用sort -g排序檔案
1247
7317
19566
21655
32468

過慮重覆 uniq
uniq可將檔案中相鄰且重覆的多行資料合併為一行，使資料有唯一性。

ubuntu@ubuntu:~$ cat uniqtest&nbsp;   #查詢原使檔案內容
1
1
4
7
3
7
9
6
3
4
0
9
7
3
2
1
7
4
3
5
7
ubuntu@ubuntu:~$ uniq uniqtest&nbsp; #使用uniq將連續重復的資料合併
1
4
7
3
7
9
6
3
4
0
9
7
3
2
1
7
4
3
5
7
ubuntudavid00050@ubuntu:~$ sort uniqtest |uniq  #排序後再由uniq合併連續重復的資料
0
1
2
3
4
5
6
7
9


擷取每行特定欄位 cut


	cut參數
	
		
			參數
			說明
		
		
			-c
			指定擷取特定位元
		
		
			-d
			自定分隔符號
		
		
			-f
			指定欄位數(分隔符號為tab)
		
	


ubuntu@ubuntu:~$ ls -l |cut -c 1-10          #列出檔案清單後擷取1-10字元
total 16
drwxr-xr-x
-rw-rw-r--
-rw-rw-r--
-rw-rw-r--
ubuntu@ubuntu:~$ cut -f 2 /etc/services      #擷取/etc/services第2個欄位
20/tcp
42/tcp
50/tcp
50/udp
65/tcp
ubuntu@ubuntu:~$ cut -d':' -f 1 /etc/passwd   #自訂分隔符號為":"，並擷取第1欄位
root
daemon
bin


比較檔案 diff
語法：diff 第一個檔案 第二個檔案
diff可比較2個檔案是否相同，若相同則不會出現訊息，若不同則會把不同的地方以"&gt;"號列出

ubuntu@ubuntu:~$ diff test test1          #比較test和test1是否不同
ubuntu@ubuntu:~$&nbsp;                         #因為沒有不同所以無任何訊息
ubuntu@ubuntu:~$ diff difftest difftest1  #比較difftest和difftest1是否不同
1c1
&lt; abcdefg
---
&gt; abcdefh                                #不同之行數以&gt;標示


&nbsp;


參考資料：
printf命令
&nbsp;
]]></description>
      <content:encoded><![CDATA[<p>Linux中有許多指令是方便管理者快速管理系統的小工具，也可將這些指令在運用在script中以增加管理者的方便性。</p>

<p><strong>echo</strong><br>
echo是個很常用的指令，可將輸入的文字顯示在營幕上也可利用"&gt;"或"&gt;&gt;"將輸入的文字寫入檔案，也可叫出變數內容。<br>
將輸入的文字顯示在營幕</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ echo Hi Welcome
Hi Welcome</pre>

<p>輸入的文字寫入檔案</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ echo abc &gt;echotest.txt   #將abc導入echotest.txt
ubuntu@ubuntu:~$ ls
echotest.txt                              #echotest.txt被建立了
ubuntu@ubuntu:~$ cat echotest.txt&nbsp;        #顯示echotest.txt檔案內容
abc</pre>

<p>回傳變數內容</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ echo $HOSTNAME  #回傳主機名稱變數值
ubuntu</pre>

<p><strong>特殊字元</strong><br>
某些特殊字元無法在command line中顯示，可使用ANSI-C規格的特殊字元"<strong>\</strong>"來表示</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<caption>特殊字元</caption>
	<tbody>
		<tr>
			<td style="text-align: center;">特殊字元</td>
			<td style="text-align: center;">說明</td>
		</tr>
		<tr>
			<td style="text-align: center;">\\</td>
			<td>單純顯示<strong>\</strong>符號</td>
		</tr>
		<tr>
			<td style="text-align: center;">\'</td>
			<td>單純顯示<strong>'</strong>符號</td>
		</tr>
		<tr>
			<td style="text-align: center;">\"</td>
			<td>單純顯示<strong>"</strong>符號</td>
		</tr>
		<tr>
			<td style="text-align: center;">\a</td>
			<td>警示聲(Be)</td>
		</tr>
		<tr>
			<td style="text-align: center;">\b</td>
			<td>backspace鍵</td>
		</tr>
		<tr>
			<td style="text-align: center;">\n</td>
			<td>饋行</td>
		</tr>
		<tr>
			<td style="text-align: center;">\t</td>
			<td>水平定位點，同tab</td>
		</tr>
		<tr>
			<td style="text-align: center;">\v</td>
			<td>垂直定位點</td>
		</tr>
	</tbody>
</table>

<p>希望回傳特殊字元的結果時需加上<strong>-e</strong>參數才會將\視為特特殊字元處理</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ echo "line1\nline2\nline3"
line1\nline2\nline3              #未加-e不會饋行
ubuntu@ubuntu:~$ echo -e "line1\nline2\nline3"
line1
line2
line3                            #加上-e後\n被解讀為饋行
</pre>

<p>alias 別名<br>
Linux的shell有別名的功能，可以針對常用指令自訂別名，將常用的指令設定別名後可簡化指令。</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ alias                                 #alias不加任何指令可以顯示目前已設定好的別名
alias ls='ls --color=auto'
ubuntu@ubuntu:~$ alias ifc='ifconfig -a'               #將ifconfig -a設定別名為ifc
ubuntu@ubuntu:~$ ifc                                   #執行ifc後的結果和執行ifconfig -a一樣
eth0 &nbsp; &nbsp; &nbsp;Link encap:Ethernet &nbsp;HWaddr 44:15:1a:6d:00:05 &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:192.168.0.2 &nbsp;Bcast:192.168.0.254 &nbsp;Mask:255.255.255.255
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet6 addr: fe80::4415:1aff:fe6d:5/64 Scope:Link
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UP BROADCAST RUNNING MULTICAST &nbsp;MTU:1460 &nbsp;Metric:1
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX packets:295308 errors:0 dropped:0 overruns:0 frame:1
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TX packets:288002 errors:0 dropped:0 overruns:0 carrier:0
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collisions:0 txqueuelen:1000&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX bytes:259944983 (259.9 MB) &nbsp;TX bytes:44758045 (44.7 MB)

lo &nbsp; &nbsp; &nbsp; &nbsp;Link encap:Local Loopback &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet addr:127.0.0.1 &nbsp;Mask:255.0.0.0
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inet6 addr: ::1/128 Scope:Host
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UP LOOPBACK RUNNING &nbsp;MTU:65536 &nbsp;Metric:1
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX packets:19 errors:0 dropped:0 overruns:0 frame:0
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collisions:0 txqueuelen:1&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RX bytes:1850 (1.8 KB) &nbsp;TX bytes:1850 (1.8 KB)
ubuntu@ubuntu:~$ unalias                              #刪除別名
ubuntu@ubuntu:~$ ifc
No command 'ifc' found, but there are 16 similar ones
ifc: command not found                                #無法找到該指令
</pre>

<p>alias所定義的別名，只會在目前工作階段保留，若關閉終端機或登出，所定義的別名就會消失，在ubuntu若要永久定義別名可將別名寫入"~/.bash_aliases"檔中(在CentOS或Fedora則是在~/.bashrc檔中)，在ubuntu中預設是沒有.bash_aliases這個檔的,需要自己建立，建立檔案會需要再重新登入一次才會所設定的別名才會生效。</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ vim .bash_aliases                    #使用編輯軟體編輯.bash_aliases
alias ifc='ifconfig -a'
alias dfh='df -h'
存當後離開，ubuntu需重新登入
ubuntu@ubuntu:~$ dfh                                  #使用新設定的別名執行
Filesystem &nbsp; &nbsp; &nbsp;Size &nbsp;Used Avail Use% Mounted on
udev &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;283M &nbsp;4.0K &nbsp;283M &nbsp; 1% /dev
tmpfs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;59M &nbsp;284K &nbsp; 59M &nbsp; 1% /run
/dev/sda1 &nbsp; &nbsp; &nbsp; 9.9G &nbsp;2.9G &nbsp;6.5G &nbsp;31% /
none &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4.0K &nbsp; &nbsp; 0 &nbsp;4.0K &nbsp; 0% /sys/fs/cgroup
none &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5.0M &nbsp; &nbsp; 0 &nbsp;5.0M &nbsp; 0% /run/lock
none &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;295M &nbsp; &nbsp; 0 &nbsp;295M &nbsp; 0% /run/shm
none &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;100M &nbsp; &nbsp; 0 &nbsp;100M &nbsp; 0% /run/user
</pre>

<p><strong>統計檔案行數與字數 wc</strong><br>
wc指令(word count)可統計檔案內有多少行(newline)、英文字(word)及位元組(byte)</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ wc /var/log/dmesg           #計算/var/log/dmesg之行數、英文字數及byte數
&nbsp; <span style="color:#FF0000">400 &nbsp;3424 27270</span> /var/log/dmesg             #檔案內有400行 3424個英文字 27270byte
ubuntu@ubuntu:~$ wc -l /var/log/dmesg        #計算/var/log/dmesg之行數
<span style="color:#FF0000">400</span> /var/log/dmesg                           #檔案內有400行
ubuntu@ubuntu:~$ wc -w /var/log/dmesg        #計算/var/log/dmesg之byte數
<span style="color:#FF0000">3424</span> /var/log/dmesg                          #檔案內有3424個英文字
ubuntu@ubuntu:~$ wc -c /var/log/dmesg        #計算/var/log/dmesg之英文字數
<span style="color:#FF0000">27270</span> /var/log/dmesg                         #檔案內有27270byte
</pre>

<p><strong>取代與刪除字元 tr</strong><br>
語法：tr 欲被置換或刪除之字元 欲罝換之字元<br>
tr可以取代或刪除文件中的字串</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ cat /etc/passwd                       #先查看正常/etc/passwd檔案內容
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
ubuntu:x:1000:1000:Ubuntu:/home/ubuntu:/bin/bash
ubuntu@ubuntu:~$ cat /etc/passwd |tr "\:" "\/"         #使用tr將:改為tab
root &nbsp; &nbsp;x &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; root &nbsp; &nbsp;/root &nbsp;         /bin/bash
daemon &nbsp;x &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; daemon &nbsp;/usr/sbin &nbsp; &nbsp; &nbsp; /usr/sbin/nologin
ubuntu &nbsp;x &nbsp; &nbsp; &nbsp; 1000 &nbsp; &nbsp;1000 &nbsp; &nbsp;Ubuntu &nbsp;/home/ubuntu &nbsp; &nbsp;/bin/bash
ubuntu@ubuntu:~$ cat /etc/passwd |tr "\:" "\/"|tr -d x #使用tr將:改為tab，再將"<strong>ｘ</strong>"的刪除
root &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; root &nbsp; &nbsp;/root &nbsp;         /bin/bash
daemon &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; daemon &nbsp;/usr/sbin &nbsp; &nbsp; &nbsp; /usr/sbin/nologin
ubuntu &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1000 &nbsp; &nbsp;1000 &nbsp; &nbsp;Ubuntu &nbsp;/home/ubuntu &nbsp; &nbsp;/bin/bash
</pre>

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<caption>tr定義</caption>
	<tbody>
		<tr>
			<td style="text-align: center;">參數</td>
			<td style="text-align: center;">說明</td>
		</tr>
		<tr>
			<td style="text-align: center;">[:alnum:]</td>
			<td>所有大小寫字母與數字</td>
		</tr>
		<tr>
			<td style="text-align: center;">[:alpha:]</td>
			<td>所有大小寫字母</td>
		</tr>
		<tr>
			<td style="text-align: center;">[:blank:]</td>
			<td>空白</td>
		</tr>
		<tr>
			<td style="text-align: center;">[:digit:]</td>
			<td>所有數字</td>
		</tr>
		<tr>
			<td style="text-align: center;">[:lower:]</td>
			<td>所有小寫字母</td>
		</tr>
		<tr>
			<td style="text-align: center;">[:upper:]</td>
			<td>所有大寫字母</td>
		</tr>
	</tbody>
</table>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ cat /etc/passwd |tr [:lower:] [:upper:]    #先查看正常/etc/passwd檔案內所有小寫字母換成大寫字母
ROOT:X:0:0:ROOT:/ROOT:/BIN/BASH
DAEMON:X:1:1:DAEMON:/USR/SBIN:/USR/SBIN/NOLOGIN
UBUNTU:X:1000:1000:UBUNTU:/HOME/UBUNTU:/BIN/BASH
</pre>

<p>產生序列數字 seq<br>
語法：seq 開始數字 結束數字</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<caption>seq參數</caption>
	<tbody>
		<tr>
			<td style="text-align: center;">參說</td>
			<td style="text-align: center;">說明</td>
		</tr>
		<tr>
			<td style="text-align: center;">-f</td>
			<td>使用printf格式定義格式</td>
		</tr>
		<tr>
			<td style="text-align: center;">-w</td>
			<td>將所有輸出使用相同位元顯示(即補0)</td>
		</tr>
		<tr>
			<td style="text-align: center;">-s</td>
			<td>在輸出的數字加上指定字串</td>
		</tr>
	</tbody>
</table>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubunua@ubuntu:~$ seq 1 5     #產生1至5的數字
1
2
3
4
5
ubuntu@ubuntu:~$ seq 2 2 12   #由2開始加2至12
2
4
6
8
10
12
ubuntu@ubuntu:~$ seq -w 6 10  #將每個數字都使用相同的位元數
06
07
08
09
10
ubuntu@ubuntu:~$ seq -s - 1 2 10  #在每個數字間加入"<strong>-</strong>"
1-3-5-7-9
ubuntu@ubuntu:~$ seq -f seq -f "%1g" 6 10&nbsp; #使用printf格式輸出數字6-10
6
7
8
9
10
</pre>

<p><strong>文字檔內容排序 sort</strong><br>
sort可用來將文字檔內的每一列做排序，並將排序的結果在營幕上顯示。</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ cat&nbsp;/etc/passwd                #先查看未排序的/etc/passwd檔的內容
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
ubuntu@ubuntu:~$ sort&nbsp;/etc/passwd               #排序/etc/passwd檔的內容
<span style="color:#FF0000">b</span>ackup:x:34:34:backup:/var/backups:/usr/sbin/nologin
<span style="color:#FF0000">b</span>in:x:2:2:bin:/bin:/usr/sbin/nologin
<span style="color:#FF0000">d</span>aemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
<span style="color:#FF0000">g</span>ames:x:5:60:games:/usr/games:/usr/sbin/nologin
<span style="color:#FF0000">i</span>rc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
</pre>

<p>sort預設會以第一個字元的ASCII碼比較，若相同再比較第二個字元,以此類推，若要依<strong>數值</strong>大小排序可以使用-g參數。</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ cat sorttest&nbsp;      #使用cat查看原始檔案內容
32468
21655
7317
19566
1247
ubuntu@ubuntu:~$ sort sorttest&nbsp;    #使用sort排序檔案
1247
19566
21655
32468
7317
ubuntu@ubuntu:~$ sort -g sorttest&nbsp; #使用sort -g排序檔案
1247
7317
19566
21655
32468</pre>

<p><strong>過慮重覆 uniq</strong><br>
uniq可將檔案中相鄰且重覆的多行資料合併為一行，使資料有唯一性。</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ cat uniqtest&nbsp;   #查詢原使檔案內容
1
1
4
7
3
7
9
6
3
4
0
9
7
3
2
1
7
4
3
5
7
ubuntu@ubuntu:~$ uniq uniqtest&nbsp; #使用uniq將連續重復的資料合併
1
4
7
3
7
9
6
3
4
0
9
7
3
2
1
7
4
3
5
7
ubuntudavid00050@ubuntu:~$ sort uniqtest |uniq  #排序後再由uniq合併連續重復的資料
0
1
2
3
4
5
6
7
9
</pre>

<p><strong>擷取每行特定欄位 cut</strong></p>

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<caption>cut參數</caption>
	<tbody>
		<tr>
			<td style="text-align: center;">參數</td>
			<td style="text-align: center;">說明</td>
		</tr>
		<tr>
			<td style="text-align: center;">-c</td>
			<td>指定擷取特定位元</td>
		</tr>
		<tr>
			<td style="text-align: center;">-d</td>
			<td>自定分隔符號</td>
		</tr>
		<tr>
			<td style="text-align: center;">-f</td>
			<td>指定欄位數(分隔符號為tab)</td>
		</tr>
	</tbody>
</table>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ ls -l |cut -c 1-10          #列出檔案清單後擷取1-10字元
total 16
drwxr-xr-x
-rw-rw-r--
-rw-rw-r--
-rw-rw-r--
ubuntu@ubuntu:~$ cut -f 2 /etc/services      #擷取/etc/services第2個欄位
20/tcp
42/tcp
50/tcp
50/udp
65/tcp
ubuntu@ubuntu:~$ cut -d':' -f 1 /etc/passwd   #自訂分隔符號為":"，並擷取第1欄位
root
daemon
bin
</pre>

<p>比較檔案 diff<br>
語法：diff 第一個檔案 第二個檔案<br>
diff可比較2個檔案是否相同，若相同則不會出現訊息，若不同則會把不同的地方以"<strong>&gt;</strong>"號列出</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ diff test test1          #比較test和test1是否不同
ubuntu@ubuntu:~$&nbsp;                         #因為沒有不同所以無任何訊息
ubuntu@ubuntu:~$ diff difftest difftest1  #比較difftest和difftest1是否不同
1c1
&lt; abcdefg
---
&gt; abcdefh                                #不同之行數以&gt;標示
</pre>

<p>&nbsp;</p>

<hr>
<p>參考資料：<br>
<a href="http://man.linuxde.net/printf" target="_blank">printf命令</a><br>
&nbsp;</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45242241">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45242241"></div>]]></content:encoded>
      <pubDate>Wed, 17 May 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[Linux]]></category>
      <comments>https://david50.pixnet.net/blog/post/45242241#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Cisco DHCP Relay(IP Helper)]]></title>
      <link>https://david50.pixnet.net/blog/post/45230529</link>
      <guid>https://david50.pixnet.net/blog/post/45230529</guid>
      <description><![CDATA[DHCP 是靠廣播(Broadcast)傳送的，如果 DHCP Server 與 DHCP Client 在不同一個網段，Client就無法配發到IP了，這時候可以使用 DHCP Relay (或稱為 IP Helper)，傳送DHCP Client的廣播到DHCP Server以能將IP配發到Client。



建立DHCP Pool

R1(config)#ip dhcp pool pool1                                     建立位址儲備池，並命名為pool1
R1(dhcp-config)#network 192.168.10.0 255.255.255.0                指定要分配的IP範圍
R1(dhcp-config)#default-router 192.168.10.254                     設定Pool1之預設閘道
R1(dhcp-config)#dns-server 8.8.8.8                                設定DNS
R1(dhcp-config)#exit                                              返回全域模式
R1(config)#ip dhcp excluded-address 192.168.10.200 192.168.10.254 指定192.168.10.200 ~ 192.168.10.254不配發

設定路由
由於在R1的路由表中並沒有192.168.10.0/24網段，所以必需要此網段加入路由表中

R1(config)#ip route 192.168.10.0 255.255.255.0 192.168.0.253  將192.168.10/24交由192.168.0.253傳送

設定DHCP Relay(IP helper)

R2(config)#interface gigabitEthernet0/1          進入gigabitEthernet0/1介面設定
R2(config-if)#ip helper-address 192.168.0.254    指定要轉送的DHCP Server IP


測試

C:\Users\&gt;ipconfig /all
乙太網路卡 區域連線:

&nbsp; &nbsp;連線特定 DNS 尾碼 . . . . . . . . :
&nbsp; &nbsp;實體位址 . . . . . . . . . . . . .: 00-01-C9-A0-16-88
&nbsp; &nbsp;DHCP 已啟用 . . . . . . . . . . . : 是
&nbsp; &nbsp;IPv4 位址 . . . . . . . . . . . . : 192.168.10.1(偏好選項)
&nbsp; &nbsp;子網路遮罩 . . . . . . . . . . . .: 255.255.255.0
&nbsp; &nbsp;預設閘道 . . . . . . . . . . . . .: 192.168.10.254
&nbsp; &nbsp;DHCPv6 IAID . . . . . . . . . . . : 240387238
&nbsp; 
&nbsp; &nbsp;DNS 伺服器 . . . . . . . . . . . .: 8.8.8.8


Client端可正常配發到IP，配發之IP也與DHCP Server設定一致


參考資料來源：Jan Ho的網路世界
]]></description>
      <content:encoded><![CDATA[<p>DHCP 是靠廣播(Broadcast)傳送的，如果 DHCP Server 與 DHCP Client 在不同一個網段，Client就無法配發到IP了，這時候可以使用 DHCP Relay (或稱為 IP Helper)，傳送DHCP Client的廣播到DHCP Server以能將IP配發到Client。</p>

<p><img alt="dhcp relay.JPG" src="https://pic.pimg.tw/david50/1502776311-2433817681.jpg?v=1502776329" title="dhcp relay.JPG"></p>

<p><strong>建立DHCP Pool</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">R1(config)#ip dhcp pool pool1                                     建立位址儲備池，並命名為pool1
R1(dhcp-config)#network 192.168.10.0 255.255.255.0                指定要分配的IP範圍
R1(dhcp-config)#default-router 192.168.10.254                     設定Pool1之預設閘道
R1(dhcp-config)#dns-server 8.8.8.8                                設定DNS
R1(dhcp-config)#exit                                              返回全域模式
R1(config)#ip dhcp excluded-address 192.168.10.200 192.168.10.254 指定192.168.10.200 ~ 192.168.10.254不配發</pre>

<p><strong>設定路由</strong><br>
由於在R1的路由表中並沒有192.168.10.0/24網段，所以必需要此網段加入路由表中</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">R1(config)#ip route 192.168.10.0 255.255.255.0 192.168.0.253  將192.168.10/24交由192.168.0.253傳送</pre>

<p><strong>設定DHCP Relay(IP helper)</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">R2(config)#interface gigabitEthernet0/1          進入gigabitEthernet0/1介面設定
R2(config-if)#ip helper-address 192.168.0.254    指定要轉送的DHCP Server IP
</pre>

<p>測試</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">C:\Users\&gt;ipconfig /all
乙太網路卡 區域連線:

&nbsp; &nbsp;連線特定 DNS 尾碼 . . . . . . . . :
&nbsp; &nbsp;實體位址 . . . . . . . . . . . . .: 00-01-C9-A0-16-88
&nbsp; &nbsp;<span style="color:#FF0000">DHCP 已啟用</span> . . . . . . . . . . . : <span style="color:#FF0000">是</span>
&nbsp; &nbsp;IPv4 位址 . . . . . . . . . . . . : <span style="color:#FF0000">192.168.10.1</span>(偏好選項)
&nbsp; &nbsp;子網路遮罩 . . . . . . . . . . . .: <span style="color:#FF0000">255.255.255.0</span>
&nbsp; &nbsp;預設閘道 . . . . . . . . . . . . .: <span style="color:#FF0000">192.168.10.254</span>
&nbsp; &nbsp;DHCPv6 IAID . . . . . . . . . . . : 240387238
&nbsp; 
&nbsp; &nbsp;DNS 伺服器 . . . . . . . . . . . .: <span style="color:#FF0000">8.8.8.8</span>
</pre>

<p>Client端可正常配發到IP，配發之IP也與DHCP Server設定一致</p>

<hr>
<p>參考資料來源：<a href="http://www.jannet.hk/zh-Hant/post/dynamic-host-configuration-protocol-dhcp/" target="_blank">Jan Ho的網路世界</a></p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45230529">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45230529"></div>]]></content:encoded>
      <pubDate>Fri, 12 May 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45230529#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Quota磁碟配額]]></title>
      <link>https://david50.pixnet.net/blog/post/45238215</link>
      <guid>https://david50.pixnet.net/blog/post/45238215</guid>
      <description><![CDATA[磁碟配額(quota)在以前上課時就有上過了，但久沒用都忘的差不多了，這次考網乙也有考到，所以再抓來複習一下，順便做個筆記以防以後還要用到囉!

修改/etc/fstab檔

ubuntu@ubuntu:/home$ sudo vim /etc/fstab
LABEL=cloudimg-rootfs &nbsp; /home &nbsp; &nbsp;ext4 &nbsp; defaults,usrquota,grpquota &nbsp; &nbsp; &nbsp;0 0  #在要啟用quota之分割區(/home)第4個欄位最後(defaults後)加入usrquota,grpquota
/swapfile &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; swap &nbsp; &nbsp; swap &nbsp; defualts &nbsp; &nbsp; &nbsp; &nbsp;                0 0
存檔後離開


重新掛載分額區

ubuntu@ubuntu:/home$ sudo mount -o remount /home   #重新掛載要啟用quota之分割區


查看/etc/mtab檔

ubuntu@ubuntu:/$ cat /etc/mtab&nbsp;
/dev/sda1 / ext4 rw,usrquota,grpquota 0 0       #usrquota,grpquota已被加入mtab中


掃描磁碟產生配額設定檔：quotacheck

ubuntu@ubuntu:/home$ sudo quotacheck -ugvmca  #經測試加-a即可產生設定檔，但大家都這麼教我就這麼記囉!

此時在要啟用quota之磁區中會多了2個檔案
ubuntu@ubuntu:/home$ ls -al /home
drwxr-xr-x 23 root root &nbsp; &nbsp; &nbsp;4096 May 10 14:58 .
drwxr-xr-x 23 root root &nbsp; &nbsp; &nbsp;4096 May 10 14:58 ..
-rw------- &nbsp;1 root root &nbsp; &nbsp; &nbsp;7168 May 10 15:45 aquota.group
-rw------- &nbsp;1 root root &nbsp; &nbsp; &nbsp;7168 May 10 15:45 aquota.user



	quotacheck參數說明
	
		
			&nbsp;參數
			說明
		
		
			-a
			掃描/etc/fstab檔案裡有加入quota設定的分割區
		
		
			-c
			不讀取已存在的quota資料庫,重新掃描硬碟並儲存
		
		
			-d
			顯示執行過程比-v來的詳細
		
		
			-g
			掃描/etc/mtab檔中有啟用群組磁碟配額的掛載點，計算群組所占用的目錄跟檔案數目,並建立quota.group
		
		
			-m
			強制執行
		
		
			-u
			掃描/etc/mtab檔中有啟用使用者磁碟配額的掛載點，計算使用者所占用的目錄跟檔案數目,並建立quota.usser
		
		
			-v
			執行過程中，顯示進度與資訊
		
	


啟用/停用磁碟配額：quotaon, quotaoff

ubuntu@ubuntu: sudo /home$ quotaon -a
# 執行後可利用-p參數查詢磁碟配額啟用狀態
ubuntu@ubuntu:/home$ sudo quotaon -ap
group quota on / (/dev/sda1) is on     #group quota已啟用
user quota on / (/dev/sda1) is on      #user quota已啟用
#若要關閉磁碟配額可使用quotaoff
ubuntu@ubuntu:/home$ sudo quotaoff -a  #停用quota
ubuntu@ubuntu:/home$ sudo quotaoff -ap  #再查詢一次quota狀態
group quota on / (/dev/sda1) is off     #group quota已停用
user quota on / (/dev/sda1) is off      #user quota已停用


設定使用者磁碟配額：edquota, setquota
Linux磁碟配額的設定有兩種，一種是磁碟空間(blocks)，另一種是檔案數(inodes)，在設定時使用容量時有兩個設定值一個是soft limit，另一個是hard limit，若使用超過soft limit所設定之值時，系統會顯示警告訊息，仍可繼續寫入檔案，但當所使用的容量或檔案數到達hard limit所設定之值時，即無法再寫入。

ubuntu@ubuntu:/home$ sudo edquota -u quotatest1    #使用edquota設定quotatest1使用者之磁碟配額
Disk quotas for user quotatest1 (uid 1002):
&nbsp; Filesystem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blocks &nbsp; &nbsp; &nbsp; soft &nbsp; &nbsp; &nbsp; hard &nbsp; &nbsp; inodes &nbsp; &nbsp; soft &nbsp; &nbsp; hard
&nbsp; /dev/sda1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;    52 &nbsp; &nbsp; &nbsp;10000 &nbsp; &nbsp; &nbsp;12000 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3 &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp;0      #將soft limit設為10M，hard limit設為12M
存檔後離開
ubuntu@ubuntu:/home$ sudo quota -u quotatest1 #查看quotatest1使用者之磁碟配額
Disk quotas for user quotatest1 (uid 1002):&nbsp;
&nbsp; &nbsp; &nbsp;Filesystem &nbsp;blocks &nbsp; quota &nbsp; limit &nbsp; grace &nbsp; files &nbsp; quota &nbsp; limit &nbsp; grace
&nbsp; &nbsp; &nbsp; /dev/sda1 &nbsp;    52 &nbsp; 10000 &nbsp; 12000 &nbsp; &nbsp;     &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; 0                       #設定完成


setquota的設定方式是在命令列即可完成，不像edquota會進入編輯模式。
語法：setquota -u 帳號 block soft limit block hard limit inode soft limit inode hard limit 目錄

ubuntu@ubuntu:/home$ sudo setquota -u quotatest2 8000 10000 0 0 /home   #使用setquota將quotatest2磁碟配額soft limit設為8M，hard limit設為10M
ubuntu@ubuntu:/home$ sudo quota -u quotatest2 #查看quotatest2使用者之磁碟配額
Disk quotas for user quotatest1 (uid 1003):&nbsp;
&nbsp; &nbsp; &nbsp;Filesystem &nbsp;blocks &nbsp; quota &nbsp; limit &nbsp; grace &nbsp; files &nbsp; quota &nbsp; limit &nbsp; grace
&nbsp; &nbsp; &nbsp; /dev/sda1 &nbsp;    52 &nbsp;  8000 &nbsp; 10000 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; 0              #設定完成


測試與驗證

ubuntu@ubuntu:/home$ su - quotatest1                #切換至quotatest1使用者
Password:&nbsp;                                          #輸入密碼
$ dd if=/dev/zero of=test bs=1M count=13            #使用dd建立一個13M的空檔案
dd: error writing ‘test’: Disk quota exceeded       #因超過設定的12M而出現了錯誤訊息
12+0 records in
11+0 records out
12279808 bytes (12 MB) copied, 0.0153828 s, 798 MB/s
$ ls -alh                                            #查看test檔案大小
total 12M
drwxr-xr-x 2 quotatest1 quotatest1 4.0K May 10 13:33 .
drwxr-xr-x 6 root &nbsp; &nbsp; &nbsp; root &nbsp; &nbsp; &nbsp; 4.0K May 10 15:09 ..
-rw-rw-r-- 1 quotatest1 quotatest1 &nbsp;12M May 10 15:56 test #test檔案大小12M


複製磁碟配額設定：edquota -p
語法：edquota -p 來源帳號 目標帳號
如果有很多個帳號需要設定磁碟額時，每個帳號都要各別設定的話，對管理人員來說就太耗時了，這時可以使用edquota -p這個參數將帳號quota設定複製到另一個帳號即可。

ubuntu@ubuntu:/home$ sudo edquota -p quotatest1  quotatest2  #將quotatest1帳號的配額複製到quotatest2帳號
ubuntu@ubuntu:/home$ sudo quota -u quotatest2                #查看quotatest2使用者之磁碟配額
Disk quotas for user quotatest2 (uid 1003):&nbsp;
&nbsp; &nbsp; &nbsp;Filesystem &nbsp;blocks &nbsp; quota &nbsp; limit &nbsp; grace &nbsp; files &nbsp; quota &nbsp; limit &nbsp; grace
&nbsp; &nbsp; &nbsp; /dev/sda1 &nbsp;    52 &nbsp; 10000 &nbsp; 12000 &nbsp; &nbsp; &nbsp;     &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; 0          #quotatest2的設定和quotatest1一樣了


寬限期 grace
當使用者使用的空間大於soft limit時，需在一定期限內將使用量降至soft limit值以下，此期限就稱寬限期，寬限期使用的單位有日(days)、小時(hours)、分鐘(minutes)及秒(seconds)，我們可以使用edquota -t參數設定寬限期

ubuntu@ubuntu:/home$ sudo edquota -t                     #設定寬限期
Grace period before enforcing soft limits for users:
Time units may be: days, hours, minutes, or seconds
&nbsp; Filesystem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Block grace period &nbsp; &nbsp; Inode grace period
&nbsp; /dev/sda1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1minutes &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7days      #將寬限期由原本的7天改為1分鐘
存檔後離開
ubuntu@ubuntu:/home$ su - quotatest2                      #切換至quotatest2使用者
Password:&nbsp;                                                #輸入密碼
$ dd if=/dev/zero of=test bs=1M count=11                  #使用dd建立一個11M的空檔案
11+0 records in
11+0 records out
11534336 bytes (12 MB) copied, 0.0148181 s, 778 MB/s
$ ls -alh                                                 #查看test檔案大小
total 12M
drwxr-xr-x 2 quotatest2 quotatest2 4.0K May 10 13:33 .
drwxr-xr-x 6 root &nbsp; &nbsp; &nbsp; root &nbsp; &nbsp; &nbsp; 4.0K May 10 15:09 ..
-rw-rw-r-- 1 quotatest2 quotatest2 &nbsp;11M May 10 16:03 test #test檔案大小11M
一分鐘過後再查看quotatest2之磁碟配額
$ quota
Disk quotas for user quotatest2 (uid 1003):&nbsp;
&nbsp; &nbsp; &nbsp;Filesystem &nbsp;blocks &nbsp; quota &nbsp; limit &nbsp; grace &nbsp; files &nbsp; quota &nbsp; limit &nbsp; grace
&nbsp; &nbsp; &nbsp; /dev/sda1 &nbsp; 11272* &nbsp;10000 &nbsp; 12000 &nbsp; &nbsp;none &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; 0&nbsp;        #blocks欄位加了*號，grace欄位變為none了


磁碟配額報表 repquota
repquota可產生磁碟配額的使用狀況報表，清楚得知每個帳號和群組的使用量。


	repquota參數說明
	
		
			參數
			說明
		
		
			-a
			
			對所有已掛載的檔案系統進行統計
			
		
		
			-v
			
			對所有檔案系統配額情況產生報表包含未掛載的系統檔案
			
		
		
			-g
			產生群組(group)的配額報表
		
		
			-u
			產生使用者(user)的配額報表
		
		
			-s
			
			包含完整的統計資訊
			
		
	


ubuntu@ubuntu:/home$ sudo repquota -avus                   #列出使用者配額報表
*** Report for user quotas on device /dev/sda1
Block grace time: 00:01; Inode grace time: 24:00
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Space limits &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;File limits
User &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;used &nbsp; &nbsp;soft &nbsp; &nbsp;hard &nbsp;grace &nbsp; &nbsp;used &nbsp;soft &nbsp;hard &nbsp;grace
----------------------------------------------------------------------
root &nbsp; &nbsp; &nbsp;-- &nbsp; 2532M &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;73657 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;
daemon &nbsp; &nbsp;-- &nbsp; &nbsp; 64K &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;
quotatest1 +- &nbsp;12000K &nbsp;10000K &nbsp;12000K &nbsp; none &nbsp;&nbsp; &nbsp; 3 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;
quotatest2 -- &nbsp; &nbsp; &nbsp;8K &nbsp;10000K &nbsp;12000K &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp;2 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;

Statistics:
Total blocks: 7
Data blocks: 1
Entries: 14
Used average: 14.000000
ubuntu@ubuntu:/home$ sudo repquota -avgs                  #列出群組配額報表
*** Report for group quotas on device /dev/sda1
Block grace time: 7days; Inode grace time: 7days
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Space limits &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;File limits
Group &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; used &nbsp; &nbsp;soft &nbsp; &nbsp;hard &nbsp;grace &nbsp; &nbsp;used &nbsp;soft &nbsp;hard &nbsp;grace
----------------------------------------------------------------------
root &nbsp; &nbsp; &nbsp;-- &nbsp; 2530M &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;73738 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;
quotatest1 -- &nbsp;12000K  &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;
quotatest2 -- &nbsp;10008K  &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;

Statistics:
Total blocks: 9
Data blocks: 2
Entries: 26
Used average: 13.000000



參考資料：
Welkin小窩-Ubuntu quota(磁碟額配)配置設定
Ubuntu Manuals
]]></description>
      <content:encoded><![CDATA[<p>磁碟配額(quota)在以前上課時就有上過了，但久沒用都忘的差不多了，這次考網乙也有考到，所以再抓來複習一下，順便做個筆記以防以後還要用到囉!<img alt="" height="19" src="//s.pixfs.net/f.pixnet.net/images/emotions/tounge_smile.gif" title="" width="19"></p>

<p><strong>修改/etc/fstab檔</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:/home$ sudo vim /etc/fstab
LABEL=cloudimg-rootfs &nbsp; /home &nbsp; &nbsp;ext4 &nbsp; defaults,<span style="color:#FF0000">usrquota,grpquota</span> &nbsp; &nbsp; &nbsp;0 0  #在要啟用quota之分割區(/home)第4個欄位最後(defaults後)加入usrquota,grpquota
/swapfile &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; swap &nbsp; &nbsp; swap &nbsp; defualts &nbsp; &nbsp; &nbsp; &nbsp;                0 0
存檔後離開
</pre>

<p>重新掛載分額區</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:/home$ sudo mount -o remount /home   #重新掛載要啟用quota之分割區
</pre>

<p>查看/etc/mtab檔</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:/$ cat /etc/mtab&nbsp;
/dev/sda1 / ext4 rw,<span style="color:#FF0000">usrquota,grpquota </span>0 0       #usrquota,grpquota已被加入mtab中
</pre>

<p><strong>掃描磁碟產生配額設定檔：quotacheck</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:/home$ sudo quotacheck -ugvmca  #經測試加-a即可產生設定檔，但大家都這麼教我就這麼記囉!<img alt="" height="19" src="//s.pixfs.net/f.pixnet.net/images/emotions/tounge_smile.gif" title="" width="19">

此時在要啟用quota之磁區中會多了2個檔案
ubuntu@ubuntu:/home$ ls -al /home
drwxr-xr-x 23 root root &nbsp; &nbsp; &nbsp;4096 May 10 14:58 .
drwxr-xr-x 23 root root &nbsp; &nbsp; &nbsp;4096 May 10 14:58 ..
-rw------- &nbsp;1 root root &nbsp; &nbsp; &nbsp;7168 May 10 15:45 <span style="color:#FF0000">aquota.group</span>
-rw------- &nbsp;1 root root &nbsp; &nbsp; &nbsp;7168 May 10 15:45 <span style="color:#FF0000">aquota.user</span>
</pre>

<table border="1" cellpadding="1" cellspacing="1" style="width:600px">
	<caption>quotacheck參數說明</caption>
	<tbody>
		<tr>
			<td style="text-align: center;"><span style="display:none">&nbsp;</span>參數</td>
			<td style="text-align: center;">說明</td>
		</tr>
		<tr>
			<td style="text-align: center;">-a</td>
			<td>掃描/etc/fstab檔案裡有加入quota設定的分割區</td>
		</tr>
		<tr>
			<td style="text-align: center;">-c</td>
			<td>不讀取已存在的quota資料庫,重新掃描硬碟並儲存</td>
		</tr>
		<tr>
			<td style="text-align: center;">-d</td>
			<td>顯示執行過程比-v來的詳細</td>
		</tr>
		<tr>
			<td style="text-align: center;">-g</td>
			<td>掃描/etc/mtab檔中有啟用群組磁碟配額的掛載點，計算群組所占用的目錄跟檔案數目,並建立quota.group</td>
		</tr>
		<tr>
			<td style="text-align: center;">-m</td>
			<td>強制執行</td>
		</tr>
		<tr>
			<td style="text-align: center;">-u</td>
			<td>掃描/etc/mtab檔中有啟用使用者磁碟配額的掛載點，計算使用者所占用的目錄跟檔案數目,並建立quota.usser</td>
		</tr>
		<tr>
			<td style="text-align: center;">-v</td>
			<td>執行過程中，顯示進度與資訊</td>
		</tr>
	</tbody>
</table>

<p><strong>啟用/停用磁碟配額：quotaon, quotaoff</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu: sudo /home$ quotaon -a
# 執行後可利用-p參數查詢磁碟配額啟用狀態
ubuntu@ubuntu:/home$ sudo quotaon -ap
group quota on / (/dev/sda1) is <span style="color:#FF0000">on</span><span style="color:#000000">     #group quota已啟用</span>
user quota on / (/dev/sda1) is <span style="color:#FF0000">on</span><span style="color:#000000">      #user quota已啟用
#若要關閉磁碟配額可使用quotaoff
</span>ubuntu@ubuntu:/home$ sudo quotaoff -a  #停用quota
ubuntu@ubuntu:/home$ sudo quotaoff -ap  #再查詢一次quota狀態
group quota on / (/dev/sda1) is <span style="color:#FF0000">off</span><span style="color:#000000">     #group quota已停用</span>
user quota on / (/dev/sda1) is <span style="color:#FF0000">off</span><span style="color:#000000">      #user quota已停用</span>
</pre>

<p><strong>設定使用者磁碟配額：edquota, setquota</strong><br>
Linux磁碟配額的設定有兩種，一種是磁碟空間(blocks)，另一種是檔案數(inodes)，在設定時使用容量時有兩個設定值一個是soft limit，另一個是hard limit，若使用超過soft limit所設定之值時，系統會顯示警告訊息，仍可繼續寫入檔案，但當所使用的容量或檔案數到達hard limit所設定之值時，即無法再寫入。</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:/home$ sudo edquota -u quotatest1    #使用edquota設定quotatest1使用者之磁碟配額
Disk quotas for user quotatest1 (uid 1002):
&nbsp; Filesystem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blocks &nbsp; &nbsp; &nbsp; soft &nbsp; &nbsp; &nbsp; hard &nbsp; &nbsp; inodes &nbsp; &nbsp; soft &nbsp; &nbsp; hard
&nbsp; /dev/sda1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;    52 &nbsp; &nbsp; &nbsp;<span style="color:#FF0000">10000</span> &nbsp; &nbsp; &nbsp;<span style="color:#FF0000">12000</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3 &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp;0      #將soft limit設為10M，hard limit設為12M
存檔後離開
ubuntu@ubuntu:/home$ sudo quota -u quotatest1 #查看quotatest1使用者之磁碟配額
Disk quotas for user quotatest1 (uid 1002):&nbsp;
&nbsp; &nbsp; &nbsp;Filesystem &nbsp;blocks &nbsp; quota &nbsp; limit &nbsp; grace &nbsp; files &nbsp; quota &nbsp; limit &nbsp; grace
&nbsp; &nbsp; &nbsp; /dev/sda1 &nbsp;    52 &nbsp; <span style="color:#FF0000">10000 &nbsp; 12000</span> &nbsp; &nbsp;     &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; 0                       #設定完成
</pre>

<p>setquota的設定方式是在命令列即可完成，不像edquota會進入編輯模式。<br>
語法：setquota -u 帳號 <span style="color:#FCA544">block soft limit</span> <span style="color:#F28582">block hard limit</span> <span style="color:#549BED">inode soft limit</span> <span style="color:#46871A">inode hard limit</span> 目錄</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:/home$ sudo setquota -u quotatest2 <span style="color:#FCA544">8000</span> <span style="color:#F28582">10000</span> <span style="color:#549BED">0</span> <span style="color:#46871A">0</span> /home   #使用setquota將quotatest2磁碟配額soft limit設為8M，hard limit設為10M
ubuntu@ubuntu:/home$ sudo quota -u quotatest2 #查看quotatest2使用者之磁碟配額
Disk quotas for user quotatest1 (uid 1003):&nbsp;
&nbsp; &nbsp; &nbsp;Filesystem &nbsp;blocks &nbsp; quota &nbsp; limit &nbsp; grace &nbsp; files &nbsp; quota &nbsp; limit &nbsp; grace
&nbsp; &nbsp; &nbsp; /dev/sda1 &nbsp;    52 &nbsp;  <span style="color:#FF0000">8000 &nbsp; 10000</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; 0              #設定完成
</pre>

<p>測試與驗證</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:/home$ su - quotatest1                #切換至quotatest1使用者
Password:&nbsp;                                          #輸入密碼
$ dd if=/dev/zero of=test bs=1M count=13            #使用dd建立一個13M的空檔案
dd: error writing ‘test’: Disk quota exceeded       #因超過設定的12M而出現了錯誤訊息
12+0 records in
11+0 records out
12279808 bytes (<span style="color:#FF0000">12 MB</span>) <span style="color:#FF0000">copied</span>, 0.0153828 s, 798 MB/s
$ ls -alh                                            #查看test檔案大小
total 12M
drwxr-xr-x 2 quotatest1 quotatest1 4.0K May 10 13:33 .
drwxr-xr-x 6 root &nbsp; &nbsp; &nbsp; root &nbsp; &nbsp; &nbsp; 4.0K May 10 15:09 ..
-rw-rw-r-- 1 quotatest1 quotatest1 &nbsp;<span style="color:#FF0000">12M</span> May 10 15:56 test #test檔案大小12M
</pre>

<p><strong>複製磁碟配額設定：edquota -p</strong><br>
語法：edquota -p 來源帳號 目標帳號<br>
如果有很多個帳號需要設定磁碟額時，每個帳號都要各別設定的話，對管理人員來說就太耗時了，這時可以使用edquota -p這個參數將帳號quota設定複製到另一個帳號即可。</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:/home$ sudo edquota -p quotatest1  quotatest2  #將quotatest1帳號的配額複製到quotatest2帳號
ubuntu@ubuntu:/home$ sudo quota -u quotatest2                #查看quotatest2使用者之磁碟配額
Disk quotas for user quotatest2 (uid 1003):&nbsp;
&nbsp; &nbsp; &nbsp;Filesystem &nbsp;blocks &nbsp; quota &nbsp; limit &nbsp; grace &nbsp; files &nbsp; quota &nbsp; limit &nbsp; grace
&nbsp; &nbsp; &nbsp; /dev/sda1 &nbsp;    52 &nbsp; <span style="color:#FF0000">10000 &nbsp; 12000</span> &nbsp; &nbsp; &nbsp;     &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; 0          #quotatest2的設定和quotatest1一樣了
</pre>

<p><strong>寬限期 grace</strong><br>
當使用者使用的空間大於soft limit時，需在一定期限內將使用量降至soft limit值以下，此期限就稱寬限期，寬限期使用的單位有日(days)、小時(hours)、分鐘(minutes)及秒(seconds)，我們可以使用edquota -t參數設定寬限期</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:/home$ sudo edquota -t                     #設定寬限期
Grace period before enforcing soft limits for users:
Time units may be: days, hours, minutes, or seconds
&nbsp; Filesystem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Block grace period &nbsp; &nbsp; Inode grace period
&nbsp; /dev/sda1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#FF0000">1minutes</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;7days      #將寬限期由原本的7天改為1分鐘
存檔後離開
ubuntu@ubuntu:/home$ su - quotatest2                      #切換至quotatest2使用者
Password:&nbsp;                                                #輸入密碼
$ dd if=/dev/zero of=test bs=1M count=11                  #使用dd建立一個11M的空檔案
11+0 records in
11+0 records out
11534336 bytes (12 MB) copied, 0.0148181 s, 778 MB/s
$ ls -alh                                                 #查看test檔案大小
total 12M
drwxr-xr-x 2 quotatest2 quotatest2 4.0K May 10 13:33 .
drwxr-xr-x 6 root &nbsp; &nbsp; &nbsp; root &nbsp; &nbsp; &nbsp; 4.0K May 10 15:09 ..
-rw-rw-r-- 1 quotatest2 quotatest2 &nbsp;<span style="color:#FF0000">11M</span> May 10 16:03 test #test檔案大小11M
一分鐘過後再查看quotatest2之磁碟配額
$ quota
Disk quotas for user quotatest2 (uid 1003):&nbsp;
&nbsp; &nbsp; &nbsp;Filesystem &nbsp;blocks &nbsp; quota &nbsp; limit &nbsp; grace &nbsp; files &nbsp; quota &nbsp; limit &nbsp; grace
&nbsp; &nbsp; &nbsp; /dev/sda1 &nbsp; <span style="color:#FF0000">11272*</span> &nbsp;10000 &nbsp; 12000 &nbsp; &nbsp;<span style="color:#FF0000">none</span> &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; 0&nbsp;        #blocks欄位加了*號，grace欄位變為none了
</pre>

<p><strong>磁碟配額報表 repquota</strong><br>
repquota可產生磁碟配額的使用狀況報表，清楚得知每個帳號和群組的使用量。</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<caption>repquota參數說明</caption>
	<tbody>
		<tr>
			<td style="text-align: center;">參數</td>
			<td>說明</td>
		</tr>
		<tr>
			<td style="text-align: center;">-a</td>
			<td>
			<pre style="margin: 0px; padding: 0px; border: 0px; font-weight: normal; font-style: normal; font-size: 12px; line-height: 16px; font-family: inherit; text-align: left; vertical-align: baseline; color: rgb(51, 51, 51); font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">對所有已掛載的檔案系統進行統計</pre>
			</td>
		</tr>
		<tr>
			<td style="text-align: center;">-v</td>
			<td>
			<pre style="margin: 0px; padding: 0px; border: 0px; font-weight: normal; font-style: normal; font-size: 12px; line-height: 16px; font-family: inherit; text-align: left; vertical-align: baseline; color: rgb(51, 51, 51); font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">對所有檔案系統配額情況產生報表包含未掛載的系統檔案</pre>
			</td>
		</tr>
		<tr>
			<td style="text-align: center;">-g</td>
			<td>產生群組(group)的配額報表</td>
		</tr>
		<tr>
			<td style="text-align: center;">-u</td>
			<td>產生使用者(user)的配額報表</td>
		</tr>
		<tr>
			<td style="text-align: center;">-s</td>
			<td>
			<pre style="margin: 0px; padding: 0px; border: 0px; font-weight: normal; font-style: normal; font-size: 12px; line-height: 16px; font-family: inherit; text-align: left; vertical-align: baseline; color: rgb(51, 51, 51); font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">包含完整的統計資訊</pre>
			</td>
		</tr>
	</tbody>
</table>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:/home$ sudo repquota -avus                   #列出使用者配額報表
*** Report for user quotas on device /dev/sda1
Block grace time: 00:01; Inode grace time: 24:00
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Space limits &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;File limits
User &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;used &nbsp; &nbsp;soft &nbsp; &nbsp;hard &nbsp;grace &nbsp; &nbsp;used &nbsp;soft &nbsp;hard &nbsp;grace
----------------------------------------------------------------------
root &nbsp; &nbsp; &nbsp;-- &nbsp; 2532M &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;73657 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;
daemon &nbsp; &nbsp;-- &nbsp; &nbsp; 64K &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;
quotatest1 +- &nbsp;12000K &nbsp;10000K &nbsp;12000K &nbsp; none &nbsp;&nbsp; &nbsp; 3 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;
quotatest2 -- &nbsp; &nbsp; &nbsp;8K &nbsp;10000K &nbsp;12000K &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp;2 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;

Statistics:
Total blocks: 7
Data blocks: 1
Entries: 14
Used average: 14.000000
ubuntu@ubuntu:/home$ sudo repquota -avgs                  #列出群組配額報表
*** Report for group quotas on device /dev/sda1
Block grace time: 7days; Inode grace time: 7days
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Space limits &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;File limits
Group &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; used &nbsp; &nbsp;soft &nbsp; &nbsp;hard &nbsp;grace &nbsp; &nbsp;used &nbsp;soft &nbsp;hard &nbsp;grace
----------------------------------------------------------------------
root &nbsp; &nbsp; &nbsp;-- &nbsp; 2530M &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;73738 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;
quotatest1 -- &nbsp;12000K  &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;
quotatest2 -- &nbsp;10008K  &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp;0K &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4 &nbsp; &nbsp; 0 &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;&nbsp;

Statistics:
Total blocks: 9
Data blocks: 2
Entries: 26
Used average: 13.000000
</pre>

<hr>
<p>參考資料：<br>
<a href="http://welkinchen.pixnet.net/blog/post/49328986-ubuntu-quota%28%E7%A3%81%E7%A2%9F%E9%A1%8D%E9%85%8D%29%E9%85%8D%E7%BD%AE%E8%A8%AD%E5%AE%9A" target="_blank">Welkin小窩-Ubuntu quota(磁碟額配)配置設定</a><br>
<a href="http://manpages.ubuntu.com/manpages/zesty/zh_TW/man8/repquota.8.html" target="_blank">Ubuntu Manuals</a></p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45238215">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45238215"></div>]]></content:encoded>
      <pubDate>Wed, 10 May 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[Linux]]></category>
      <comments>https://david50.pixnet.net/blog/post/45238215#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Cisco基本指令-Port Security]]></title>
      <link>https://david50.pixnet.net/blog/post/45227838</link>
      <guid>https://david50.pixnet.net/blog/post/45227838</guid>
      <description><![CDATA[啟用port-security
啟用port-security前需先將switchport mode由dynimic改為access，若無更改則會出現錯誤訊息。

Switch(config)#interface FastEthernet 0/1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 進入FastEthernet0/1介面設定
Switch(config-if)#switchport port-security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;啟用port-secruity
Command rejected: FastEthernet0/1 is a dynamic port. &nbsp; &nbsp; &nbsp;啟用失敗
Switch(config-if)#switchport mode access &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;將switchport mode更改為存取埠(access)模式
Switch(config-if)#switchport port-security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;啟用port-secruity
更改完後FastEthernet0/1介面即啟用port-security


查看port-security狀態

Switch#show port-security interface fastEthernet 0/1    查看FastEthernet0/1介面port-security設定
Port Security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Enabled                    Port Security已啟用
Port Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Secure-down                因尚未連接設備所以是Secure-down
Violation Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Shutdown
Aging Time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 0 mins
Aging Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses &nbsp; &nbsp; &nbsp;: 1
Total MAC Addresses &nbsp; &nbsp; &nbsp; &nbsp;: 0
Configured MAC Addresses &nbsp; : 0
Sticky MAC Addresses &nbsp; &nbsp; &nbsp; : 0
Last Source Address:Vlan &nbsp; : 0000.0000.0000:0          因尚未連接設也未記錄MAC Address
Security Violation Count &nbsp; : 0

在FastEthernet0/1接上設備後再查看port-security狀態

Switch#show port-security interface fastEthernet 0/1 查看FastEthernet0/1介面port-security設定
Port Security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Enabled
Port Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Secure-up               未連接設備後狀況改為Secure-up
Violation Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Shutdown
Aging Time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 0 mins
Aging Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses &nbsp; &nbsp; &nbsp;: 1
Total MAC Addresses &nbsp; &nbsp; &nbsp; &nbsp;: 1
Configured MAC Addresses &nbsp; : 0
Sticky MAC Addresses &nbsp; &nbsp; &nbsp; : 0
Last Source Address:Vlan &nbsp; : 00E0.8FD0.9C17:1        Mac Address也被記錄下來了
Security Violation Count &nbsp; : 0

手動輸入綁定Mac address

Switch(config)#interface FastEthernet 0/1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;              進入FastEthernet0/1介面設定
Switch(config-if)#switchport port-security mac-address 00E0.8FD0.9C17  手動輸入Mac address
Found duplicate mac-address 00E0.8FD0.9C17                             因mac address table已記錄Mac address所以無法輸入
Switch(config-if)#shutdown                                             將FastEthernet0/1介面關閉
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
Switch(config-if)#switchport port-security mac-address 00E0.8FD0.9C17  再次手動輸入Mac address即不會出現錯誤訊息了
Switch(config-if)#no shutdown                                          將FastEthernet0/1介面啟動
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Switch(config-if)#end                                                  切換回enable模式
Switch#show port-security interface fastEthernet 0/1                   查看FastEthernet0/1介面port-security設定
Port Security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Enabled
Port Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Secure-up
Violation Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Shutdown
Aging Time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 0 mins
Aging Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses &nbsp; &nbsp; &nbsp;: 1
Total MAC Addresses &nbsp; &nbsp; &nbsp; &nbsp;: 1
Configured MAC Addresses &nbsp; : 1
Sticky MAC Addresses &nbsp; &nbsp; &nbsp; : 0
Last Source Address:Vlan &nbsp; : 00E0.8FD0.9C17:1
Security Violation Count &nbsp; : 0
此時如果接上別台未設定MAC Address的設備即會出現以下訊息
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
Switch#show port-security interface fastEthernet 0/1 再查看FastEthernet0/1介面port-security設定
Port Security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Enabled
Port Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Secure-shutdown     Port Status被改為Secure-shutdown
Violation Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Shutdown
Aging Time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 0 mins
Aging Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses &nbsp; &nbsp; &nbsp;: 1
Total MAC Addresses &nbsp; &nbsp; &nbsp; &nbsp;: 1
Configured MAC Addresses &nbsp; : 1
Sticky MAC Addresses &nbsp; &nbsp; &nbsp; : 0
Last Source Address:Vlan &nbsp; : 00E0.8FD0.9C17:1
Security Violation Count &nbsp; : 1


設定最大連線數:maximum

因為剛才FastEthernet0/1介面被系統關閉，所以要先將FastEthernet0/1介面重新啟動
Switch(config)#interface FastEthernet 0/1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 進入FastEthernet0/1介面設定
Switch(config-if)#shutdown                                關閉FastEthernet0/1介面                                
Switch(config-if)#no shutdown                             啟動FastEthernet0/1介面
Switch(config-if)#switchport port-security maximum 2      設定最大連線數為2(預設為1)
Switch(config-if)#end                                     切換回enable模式
%SYS-5-CONFIG_I: Configured from console by console
Switch#show port-security interface fastEthernet 0/1      查看FastEthernet0/1介面port-security設定
Port Security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Enabled
Port Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Secure-up
Violation Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Shutdown
Aging Time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 0 mins
Aging Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses &nbsp; &nbsp; &nbsp;: 2                            最大連線數被改為2
Total MAC Addresses &nbsp; &nbsp; &nbsp; &nbsp;: 1
Configured MAC Addresses &nbsp; : 0
Sticky MAC Addresses &nbsp; &nbsp; &nbsp; : 0
Last Source Address:Vlan &nbsp; : 00E0.8FD0.9C17:1
Security Violation Count &nbsp; : 0

設定自動記錄MAC Address: sticky
由於每次自己輸作MAC Address實在太麻煩了，我們可以使用sticky讓Switch自動記錄MAC Address

Switch(config)#interface FastEthernet 0/2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;      進入FastEthernet0/2介面設定
Switch(config-if)#switchport port-security maximum 2           設定最大連線數為2
Switch(config-if)#switchport port-sceurity mac-address sticky  設定自動記錄MAC Address
將2台設備分別接上FastEthernet0/2介面後做連線測試，讓Switch可記錄2台的MAC Address
Switch(config-if)#end                                     切換回enable模式
%SYS-5-CONFIG_I: Configured from console by console
Switch#show port-security interface fastEthernet 0/1      查看FastEthernet0/2介面port-security設定
Port Security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Enabled
Port Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Secure-up
Violation Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Shutdown
Aging Time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 0 mins
Aging Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses &nbsp; &nbsp; &nbsp;: 2
Total MAC Addresses &nbsp; &nbsp; &nbsp; &nbsp;: 2
Configured MAC Addresses &nbsp; : 2
Sticky MAC Addresses &nbsp; &nbsp; &nbsp; : 2                            自動記錄了2筆MAC Address
Last Source Address:Vlan &nbsp; : 0090.2165.ED7D
Security Violation Count &nbsp; : 0

自動清除已記錄的MAC Address: again type, again time
Switch中的MAC Address預設是會永久保存，如果希望Switch能自動清除可使用"again type"及"again time"設定

Switch(config-if)#switchport port-security aging type ?
&nbsp; absolute &nbsp; &nbsp;Absolute aging (default)
&nbsp; inactivity &nbsp;Aging based on inactivity time period

again type又可分為"absolute"(預設)及"inactivity"2種設定方式
absolute: 經過一段時間自動清除
inactivity:&nbsp;經過一段時間未連線即自動清除

Switch(config-if)#switchport port-security aging type inactivity  將自動清除設定為"inactivity"
Switch(config-if)#switchport port-security aging time 600         設定600秒後即清除MAC Address

設定違規MAC Address的處理方式: violation
當Switch偵測到未認證的MAC Address時有portect, restrict和shutdown(預設)三種處理方式
portect: 阻擋未認證的MAC Address(認證過的MAC Address接回後仍可正常使用)
restrict: 阻擋未認證的MAC Address，並記錄在log檔中(認證過的MAC Address接回後仍可正常使用)
shutdown: 把未認證的MAC Address，並關閉Port，(認證過的MAC Address接回後仍無法使用)需由管理者重新啟動後才可再使用
]]></description>
      <content:encoded><![CDATA[<p><strong>啟用port-security</strong><br>
啟用port-security前需先將switchport mode由dynimic改為access，若無更改則會出現錯誤訊息。</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Switch(config)#interface FastEthernet 0/1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 進入FastEthernet0/1介面設定
Switch(config-if)#switchport port-security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;啟用port-secruity
Command rejected: FastEthernet0/1 is a dynamic port. &nbsp; &nbsp; &nbsp;啟用失敗
Switch(config-if)#switchport mode access &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;將switchport mode更改為存取埠(access)模式
Switch(config-if)#switchport port-security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;啟用port-secruity
更改完後FastEthernet0/1介面即啟用port-security
</pre>

<p><strong>查看port-security狀態</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Switch#show port-security interface fastEthernet 0/1    查看FastEthernet0/1介面port-security設定
Port Security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color:#FF0000">Enabled                    </span>Port Security已啟用
Port Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color:#FF0000"><span class="font_orange">Secure-down                </span></span><span style="color:#000000"><span class="font_orange">因尚未連接設備所以是Secure-down</span></span>
Violation Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Shutdown
Aging Time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 0 mins
Aging Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses &nbsp; &nbsp; &nbsp;: 1
Total MAC Addresses &nbsp; &nbsp; &nbsp; &nbsp;: 0
Configured MAC Addresses &nbsp; : 0
Sticky MAC Addresses &nbsp; &nbsp; &nbsp; : 0
Last Source Address:Vlan &nbsp; : <span style="color:#FF0000"><span class="font_orange">0000.0000.0000:0          </span></span><span style="color:#000000"><span class="font_orange">因尚未連接設也未記錄MAC Address</span></span>
Security Violation Count &nbsp; : 0</pre>

<p>在FastEthernet0/1接上設備後再查看port-security狀態</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Switch#show port-security interface fastEthernet 0/1 查看FastEthernet0/1介面port-security設定
Port Security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Enabled
Port Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color:#FF0000"><span class="font_orange">Secure-up               </span></span><span style="color:#000000"><span class="font_orange">未連接設備後狀況改為Secure-up</span></span>
Violation Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Shutdown
Aging Time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 0 mins
Aging Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses &nbsp; &nbsp; &nbsp;: 1
Total MAC Addresses &nbsp; &nbsp; &nbsp; &nbsp;: 1
Configured MAC Addresses &nbsp; : 0
Sticky MAC Addresses &nbsp; &nbsp; &nbsp; : 0
Last Source Address:Vlan &nbsp; : <span style="color:#FF0000"><span class="font_orange">00E0.8FD0.9C17:1        </span></span><span style="color:#000000"><span class="font_orange">Mac Address也被記錄下來了</span></span>
Security Violation Count &nbsp; : 0</pre>

<p><strong>手動輸入綁定Mac address</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Switch(config)#interface FastEthernet 0/1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;              進入FastEthernet0/1介面設定
Switch(config-if)#switchport port-security mac-address <span style="color:#000000"><span class="font_orange">00E0.8FD0.9C17  手動輸入Mac address</span></span>
<span style="color:#FCA544">Found duplicate mac-address <span class="font_orange">00E0.8FD0.9C17</span></span><span style="color:#000000"><span class="font_orange">                             因mac address table已記錄Mac address所以無法輸入</span></span>
Switch(config-if)#shutdown                                             將FastEthernet0/1介面關閉
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
Switch(config-if)#switchport port-security mac-address <span style="color:#000000"><span class="font_orange">00E0.8FD0.9C17  再次手動輸入Mac address即不會出現錯誤訊息了
</span></span>Switch(config-if)#no shutdown                                          將FastEthernet0/1介面啟動
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Switch(config-if)#end                                                  切換回enable模式
Switch#show port-security interface fastEthernet 0/1                   查看FastEthernet0/1介面port-security設定
Port Security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Enabled
Port Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color:#000000"><span class="font_orange">Secure-up</span></span>
Violation Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Shutdown
Aging Time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 0 mins
Aging Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses &nbsp; &nbsp; &nbsp;: 1
Total MAC Addresses &nbsp; &nbsp; &nbsp; &nbsp;: 1
Configured MAC Addresses &nbsp; : 1
Sticky MAC Addresses &nbsp; &nbsp; &nbsp; : 0
Last Source Address:Vlan &nbsp; : <span style="color:#000000"><span class="font_orange">00E0.8FD0.9C17:1</span></span>
Security Violation Count &nbsp; : 0
此時如果接上別台未設定MAC Address的設備即會出現以下訊息
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to <span style="color:#FCA544">administratively down</span>

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
Switch#show port-security interface fastEthernet 0/1 再查看FastEthernet0/1介面port-security設定
Port Security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Enabled
Port Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color:#FF0000">Secure-shutdown</span>     Port Status被改為Secure-shutdown
Violation Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Shutdown
Aging Time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 0 mins
Aging Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses &nbsp; &nbsp; &nbsp;: 1
Total MAC Addresses &nbsp; &nbsp; &nbsp; &nbsp;: 1
Configured MAC Addresses &nbsp; : 1
Sticky MAC Addresses &nbsp; &nbsp; &nbsp; : 0
Last Source Address:Vlan &nbsp; : <span style="color:#000000"><span class="font_orange">00E0.8FD0.9C17:1</span></span>
Security Violation Count &nbsp; : 1
</pre>

<p><strong>設定最大連線數:maximum</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">因為剛才FastEthernet0/1介面被系統關閉，所以要先將FastEthernet0/1介面重新啟動
Switch(config)#interface FastEthernet 0/1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 進入FastEthernet0/1介面設定
Switch(config-if)#shutdown                                關閉FastEthernet0/1介面                                
Switch(config-if)#no shutdown                             啟動FastEthernet0/1介面
Switch(config-if)#switchport port-security maximum 2      設定最大連線數為2(預設為1)
Switch(config-if)#end                                     切換回enable模式
%SYS-5-CONFIG_I: Configured from console by console
Switch#show port-security interface fastEthernet 0/1      查看FastEthernet0/1介面port-security設定
Port Security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Enabled
Port Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color:#000000"><span class="font_orange">Secure-up</span></span>
Violation Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Shutdown
Aging Time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 0 mins
Aging Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses &nbsp; &nbsp; &nbsp;: <span style="color:#FF0000">2                            </span><span style="color:#000000">最大連線數被改為2</span>
Total MAC Addresses &nbsp; &nbsp; &nbsp; &nbsp;: 1
Configured MAC Addresses &nbsp; : 0
Sticky MAC Addresses &nbsp; &nbsp; &nbsp; : 0
Last Source Address:Vlan &nbsp; : <span style="color:#000000"><span class="font_orange">00E0.8FD0.9C17:1</span></span>
Security Violation Count &nbsp; : 0</pre>

<p><strong>設定自動記錄MAC Address: sticky</strong><br>
由於每次自己輸作MAC Address實在太麻煩了，我們可以使用sticky讓Switch自動記錄MAC Address</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><span style="color:rgb(51, 51, 51)">Switch(config)#interface FastEthernet 0/2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;      進入FastEthernet0/2介面設定
Switch(config-if)#switchport port-security maximum 2           設定最大連線數為2
Switch(config-if)#switchport port-sceurity mac-address sticky  設定自動記錄MAC Address
將2台設備分別接上FastEthernet0/2介面後做連線測試，讓Switch可記錄2台的MAC Address
Switch(config-if)#end                                     切換回enable模式
%SYS-5-CONFIG_I: Configured from console by console
Switch#show port-security interface fastEthernet 0/1      查看FastEthernet0/2介面port-security設定
Port Security &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Enabled
Port Status &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color:#000000"><span class="font_orange">Secure-up</span></span>
Violation Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Shutdown
Aging Time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 0 mins
Aging Type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses &nbsp; &nbsp; &nbsp;: </span><span style="color:#000000">2</span>
Total MAC Addresses &nbsp; &nbsp; &nbsp; &nbsp;: 2
Configured MAC Addresses &nbsp; : 2
Sticky MAC Addresses &nbsp; &nbsp; &nbsp; : 2                            自動記錄了2筆MAC Address
Last Source Address:Vlan &nbsp; : <span style="color:rgb(0, 0, 0)"><span class="font_orange">0090.2165.ED7D</span></span>
Security Violation Count &nbsp; : 0</pre>

<p><strong>自動清除已記錄的MAC Address: again type, again time</strong><br>
Switch中的MAC Address預設是會永久保存，如果希望Switch能自動清除可使用"again type"及"again time"設定</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Switch(config-if)#switchport port-security aging type ?
&nbsp; absolute &nbsp; &nbsp;Absolute aging (default)
&nbsp; inactivity &nbsp;Aging based on inactivity time period</pre>

<p>again type又可分為"absolute"(預設)及"inactivity"2種設定方式<br>
absolute: 經過一段時間自動清除<br>
inactivity:&nbsp;經過一段時間未連線即自動清除</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Switch(config-if)#switchport port-security aging type inactivity  將自動清除設定為"inactivity"
Switch(config-if)#switchport port-security aging time 600         設定600秒後即清除MAC Address</pre>

<p><strong>設定違規MAC Address的處理方式: violation</strong><br>
當Switch偵測到未認證的MAC Address時有portect, restrict和shutdown(預設)三種處理方式<br>
portect: 阻擋未認證的MAC Address(認證過的MAC Address接回後仍可正常使用)<br>
restrict: 阻擋未認證的MAC Address，並記錄在log檔中(認證過的MAC Address接回後仍可正常使用)<br>
shutdown: 把未認證的MAC Address，並關閉Port，(認證過的MAC Address接回後仍無法使用)需由管理者重新啟動後才可再使用</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45227838">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45227838"></div>]]></content:encoded>
      <pubDate>Fri, 05 May 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45227838#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Linux時間及時區]]></title>
      <link>https://david50.pixnet.net/blog/post/45228135</link>
      <guid>https://david50.pixnet.net/blog/post/45228135</guid>
      <description><![CDATA[Linux的時間有分成二種，一種是「硬體時間」由BIOS(或CMOS)所負責，另一種為「系統時間」由Linux負責，系統時間在系統開機後讀取硬體時間後，再由Linux管理時間。

date 日期時間指令
輸入date後若不加參數系統會回傳系統時間。

$ date
Tue May 2 14:57:04 UTC 2017


Mon Aug 14 07:13:04 UTC 2017

Mon Aug 14 07:13:04 UTC 2017

Mon Aug 14 07:13:04 UTC 2017

也可以設定參數使系統只回傳所需要的值


	時間變數
	
		
			%Y
			年份
		
		
			%m
			月份
		
		
			%d
			日
		
		
			%H
			時
		
		
			%M
			分
		
		
			%S
			秒
		
	


僅回傳年份

$ date %Y
2017

設定時間 -s

$ sudo date -s "20170502 1500"
Tue May 2 15:00:00 UTC 2017


時區檔案
Linux系統皆有設定的預設時區，系統時區檔案位於/etc/localtime
/usr/share/zoneinfo/目錄下存放了各個國家與地區所屬的時區檔案，時區檔案/etc/localtime就是連結到/usr/share/zoneinfo/Asia/Taipei

ubuntu更換時區

$ sudo dpkg-reconfigure tzdata

即可依地地選擇城市



Current default time zone: 'Asia/Taipei'
Local time is now: &nbsp; &nbsp; &nbsp;Mon Aug 14 15:48:47 CST 2017.
Universal Time is now: &nbsp;Mon Aug 14 07:48:47 UTC 2017.

若是想使用非互動模式(none interactive)設定時區可使用timedatectl

設定時區為UTC

$ sudo timedatectl set-timezone UTC

列出所有時區

$ timedatectl list-timezones

列出所有時區後會發現時區檔實在太多了(425個),我們可用grep尋找所在的地區以取得時區正確的名稱

列出所有亞洲時區

$timedatectl list-timezones　| grep Asia

設定時區為東京(Tokyo)

$ date                                       #設定前先查看目前時間
Mon Aug 14 08:59:19 CST 2017
$ sudo timedatectl set-timezone Asia/Tokyo   #將時區設為東京時區

$ date                                       #查看設定後時區
Mon Aug 147 09:59:43 JST 2017


ntpdate 網路校時
語法：ntpdate &lt;ntp server&gt;

$sudo ntpdate watch.stdtime.gov.tw
2 May 14:37:09 ntpdate[18991]: the NTP socket is in use, exiting


hwclock 硬體(BIOS)時間


	hwclock常用參數
	
		
			參數
			說明
		
		
			-h
			顯示help文件
		
		
			-r
			顯示目前硬體時間(預設參數)
		
		
			-s
			將硬體時間寫入系統時間
		
		
			-w
			將系統時間寫入硬體時間
		
	


&nbsp;

$ hwclock      #不加參數回傳目前硬體時間(與-r同效果)
Tue May 2 15:03:12 UTC 2017  .265809 seconds
$ hwclock -r
Tue May 2 15:03:12 UTC 2017 .394674 seconds
$ sudo date -s "20160812 1200"  #先將系統時間更改
Fri Aug 12 12:00:00 UTC 2016
$ sudo hwclock -s;date    #將硬體時間寫入系統時間後再查看目前系統時間
Tue May 2 15:04:24 UTC 2017              #系統時間已被改寫
$ sudo ntpdate watch.stdtime.gov.tw;sudo hwclock -w;hwclock  #使用ndpdate校時後將系統時間寫入硬體時間並回傳目前硬體時間
2 May 15:06:29 ntpdate[18991]: the NTP socket is in use, exiting
Tue May 2 15:06:30 UTC 2017 .271364 seconds    #硬體時間已更新


&nbsp;


參考資料：
阿舍的隨手記記、隨手寫寫...: Ubuntu 用指令設定和變更時區
Linux安全網-linux hwclock命令参数及用法详解--linux显示/设置硬件时钟命令
Ask ubuntu-How to change time-zone settings from the command line
通達人驛站-RTC hwclock 和 date 系統時間
]]></description>
      <content:encoded><![CDATA[<p>Linux的時間有分成二種，一種是「硬體時間」由BIOS(或CMOS)所負責，另一種為「系統時間」由Linux負責，系統時間在系統開機後讀取硬體時間後，再由Linux管理時間。</p>

<p><strong>date 日期時間指令</strong><br>
輸入date後若不加參數系統會回傳系統時間。</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">$ date
Tue May 2 14:57:04 UTC 2017
</pre>

<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; user-select: text; position: absolute; top: -99px;">Mon Aug 14 07:13:04 UTC 2017</pre>

<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; user-select: text; position: absolute; top: -99px;">Mon Aug 14 07:13:04 UTC 2017</pre>

<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; user-select: text; position: absolute; top: -99px;">Mon Aug 14 07:13:04 UTC 2017</pre>

<p>也可以設定參數使系統只回傳所需要的值</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:300px">
	<caption>時間變數</caption>
	<tbody>
		<tr>
			<td>%Y</td>
			<td>年份</td>
		</tr>
		<tr>
			<td>%m</td>
			<td>月份</td>
		</tr>
		<tr>
			<td>%d</td>
			<td>日</td>
		</tr>
		<tr>
			<td>%H</td>
			<td>時</td>
		</tr>
		<tr>
			<td>%M</td>
			<td>分</td>
		</tr>
		<tr>
			<td>%S</td>
			<td>秒</td>
		</tr>
	</tbody>
</table>

<p><strong>僅回傳年份</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">$ date %Y
2017</pre>

<p><strong>設定時間 -s</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">$ sudo date -s "20170502 1500"
Tue May 2 15:00:00 UTC 2017
</pre>

<p><strong style="background-color:rgb(255, 255, 255); font-family:sans-serif,arial,verdana,trebuchet ms">時區檔案</strong><br>
Linux系統皆有設定的預設時區，系統時區檔案位於/etc/localtime<br>
/usr/share/zoneinfo/目錄下存放了各個國家與地區所屬的時區檔案，時區檔案/etc/localtime就是連結到/usr/share/zoneinfo/Asia/Taipei</p>

<p><strong>ubuntu更換時區</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">$ sudo dpkg-reconfigure tzdata</pre>

<p>即可依地地選擇城市</p>

<p><img alt="timezone.JPG" src="https://pic.pimg.tw/david50/1502696964-545735247_n.jpg?v=1502696984" title="timezone.JPG"></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">Current default time zone: 'Asia/Taipei'
Local time is now: &nbsp; &nbsp; &nbsp;Mon Aug 14 15:48:47 CST 2017.
Universal Time is now: &nbsp;Mon Aug 14 07:48:47 UTC 2017.</pre>

<p>若是想使用非互動模式(none interactive)設定時區可使用timedatectl</p>

<p>設定時區為UTC</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">$ sudo timedatectl set-timezone UTC</pre>

<p>列出所有時區</p>

<pre style="margin: 0px 0px 1em; padding: 5px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal; color: rgb(17, 17, 17); letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; vertical-align: baseline; background-color: rgb(239, 240, 241); white-space: inherit;">$ timedatectl list-timezones</code></pre>

<p>列出所有時區後會發現時區檔實在太多了(425個),我們可用grep尋找所在的地區以取得時區正確的名稱</p>

<p>列出所有亞洲時區</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; vertical-align: baseline; background-color: rgb(239, 240, 241); white-space: inherit;">$timedatectl list-timezones　| grep Asia</code></pre>

<p>設定時區為東京(Tokyo)</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">$ date                                       #設定前先查看目前時間
Mon Aug 14 08:59:19 <span style="color:#FF0000">CST</span> 2017
$ sudo timedatectl set-timezone Asia/Tokyo   #將時區設為東京時區

$ date                                       #查看設定後時區
Mon Aug 147 09:59:43 <span style="color:#FF0000">JST</span> 2017
</pre>

<p><strong>ntpdate 網路校時</strong><br>
語法：ntpdate &lt;ntp server&gt;</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">$sudo ntpdate watch.stdtime.gov.tw
2 May 14:37:09 ntpdate[18991]: the NTP socket is in use, exiting
</pre>

<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-wrap: break-word; white-space: pre-wrap;"><strong>hwclock 硬體(BIOS)時間</strong></pre>

<table border="1" cellpadding="1" cellspacing="1" style="width:550px">
	<caption>hwclock常用參數</caption>
	<tbody>
		<tr>
			<td style="text-align: center;">參數</td>
			<td style="text-align: center;">說明</td>
		</tr>
		<tr>
			<td style="text-align: center;">-h</td>
			<td>顯示help文件</td>
		</tr>
		<tr>
			<td style="text-align: center;">-r</td>
			<td>顯示目前硬體時間(預設參數)</td>
		</tr>
		<tr>
			<td style="text-align: center;">-s</td>
			<td>將硬體時間寫入系統時間</td>
		</tr>
		<tr>
			<td style="text-align: center;">-w</td>
			<td>將系統時間寫入硬體時間</td>
		</tr>
	</tbody>
</table>

<p>&nbsp;</p>

<pre class="notranslate" style="margin: 0px 0px 20px; padding: 6px 10px; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); line-height: 19px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; letter-spacing: normal;">$ hwclock      #不加參數回傳目前硬體時間(與-r同效果)
Tue May 2 15:03:12 UTC 2017  .265809 seconds
$ hwclock -r
Tue May 2 15:03:12 UTC 2017 .394674 seconds
$ sudo date -s "20160812 1200"  #先將系統時間更改
Fri Aug 12 12:00:00 UTC 2016
$ sudo hwclock -s;date    #將硬體時間寫入系統時間後再查看目前系統時間
Tue May 2 15:04:24 UTC 2017              #系統時間已被改寫
$ sudo ntpdate watch.stdtime.gov.tw;sudo hwclock -w;hwclock  #使用ndpdate校時後將系統時間寫入硬體時間並回傳目前硬體時間
2 May 15:06:29 ntpdate[18991]: the NTP socket is in use, exiting
Tue May 2 15:06:30 UTC 2017 .271364 seconds    #硬體時間已更新
</pre>

<p>&nbsp;</p>

<hr>
<p>參考資料：<br>
<a href="http://www.arthurtoday.com/2015/02/ubuntu-command-line-reconfig-time-zone.html" target="_blank">阿舍的隨手記記、隨手寫寫...: Ubuntu 用指令設定和變更時區</a><br>
<a href="http://www.linuxso.com/command/hwclock.html" target="_blank">Linux安全網-linux hwclock命令参数及用法详解--linux显示/设置硬件时钟命令</a><br>
<a href="https://goo.gl/Hrc7U9" target="_blank">Ask ubuntu-How to change time-zone settings from the command line</a><br>
<a href="http://www.prudentman.idv.tw/2014/12/rtc-hwclock-date.html" target="_blank">通達人驛站-RTC hwclock 和 date 系統時間</a></p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45228135">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45228135"></div>]]></content:encoded>
      <pubDate>Tue, 02 May 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[Linux]]></category>
      <comments>https://david50.pixnet.net/blog/post/45228135#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Cisco基本指令-路由]]></title>
      <link>https://david50.pixnet.net/blog/post/45224331</link>
      <guid>https://david50.pixnet.net/blog/post/45224331</guid>
      <description><![CDATA[

設定靜態路由(Static Route)
(config)#ip route 目的網路 遮罩 下站位址或離開介面
以R1為例
(config)#ip route 192.168.40.0 255.255.255.0 192.168.40.253&nbsp; &nbsp; &nbsp; &nbsp; 將192.168.40.0網段之封包交由192.168.40.253傳送
(config)#ip route 192.168.40.0 255.255.255.0 FastEthernet0/0&nbsp; &nbsp; &nbsp; &nbsp;將192.168.40.0網段之封包交由FastEthernet0/0介面傳送
(config)#no ip route 192.168.40.0 255.255.255.0 192.168.40.253 &nbsp; 取消192.168.40.0之靜態路由

設定預設路由(Default Route)
(config)#ip route 0.0.0.0 0.0.0.0 192.168.40.254&nbsp; &nbsp; &nbsp;將所有未知的網段都交由192.168.40.254傳送
(config)#ip route 0.0.0.0 0.0.0.0 FastEthernet0/0 &nbsp; &nbsp;將所有未知的網段都交由FastEthernet0/0介面傳送

查看路由表
#show ip route
]]></description>
      <content:encoded><![CDATA[<p><img alt="ip route.JPG" src="https://pic.pimg.tw/david50/1502440692-3656247245_n.jpg?v=1502440698" title="ip route.JPG"></p>

<p><strong>設定靜態路由(Static Route)</strong><br>
(config)#ip route 目的網路 遮罩 下站位址或離開介面<br>
以R1為例<br>
(config)#ip route 192.168.40.0 255.255.255.0 192.168.40.253&nbsp; &nbsp; &nbsp; &nbsp; 將192.168.40.0網段之封包交由192.168.40.253傳送<br>
(config)#ip route 192.168.40.0 255.255.255.0 FastEthernet0/0&nbsp; &nbsp; &nbsp; &nbsp;將192.168.40.0網段之封包交由FastEthernet0/0介面傳送<br>
(config)#no ip route 192.168.40.0 255.255.255.0 192.168.40.253 &nbsp; 取消192.168.40.0之靜態路由</p>

<p><strong>設定預設路由(Default Route)</strong><br>
(config)#ip route 0.0.0.0 0.0.0.0 192.168.40.254&nbsp; &nbsp; &nbsp;將所有未知的網段都交由192.168.40.254傳送<br>
(config)#ip route 0.0.0.0 0.0.0.0 FastEthernet0/0 &nbsp; &nbsp;將所有未知的網段都交由FastEthernet0/0介面傳送</p>

<p><strong>查看路由表</strong><br>
#show ip route</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45224331">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45224331"></div>]]></content:encoded>
      <pubDate>Fri, 28 Apr 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45224331#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Linux - top資訊及參數說明]]></title>
      <link>https://david50.pixnet.net/blog/post/45252072</link>
      <guid>https://david50.pixnet.net/blog/post/45252072</guid>
      <description><![CDATA[top是效能分析工具，能夠即時顯示系統中各個行程的資源佔用狀況。

ubuntu@ubuntu:~$ top &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
top - 08:15:01 up 44 min, &nbsp;1 user, &nbsp;load average: 0.00, 0.00, 0.00
Tasks: &nbsp;63 total, &nbsp; 1 running, &nbsp;62 sleeping, &nbsp; 0 stopped, &nbsp; 0 zombie
%Cpu(s): &nbsp;0.0 us, &nbsp;0.0 sy, &nbsp;0.0 ni,100.0 id, &nbsp;0.0 wa, &nbsp;0.0 hi, &nbsp;0.0 si, &nbsp;0.0 st
KiB Mem : &nbsp;1741400 total, &nbsp;1600560 free, &nbsp; &nbsp;73184 used, &nbsp; &nbsp;67656 buff/cache
KiB Swap: &nbsp; &nbsp; &nbsp; &nbsp;0 total, &nbsp; &nbsp; &nbsp; &nbsp;0 free, &nbsp; &nbsp; &nbsp; &nbsp;0 used. &nbsp;1557120 avail Mem&nbsp;

&nbsp; PID USER &nbsp; &nbsp; &nbsp;PR &nbsp;NI &nbsp; &nbsp;VIRT &nbsp; &nbsp;RES &nbsp; &nbsp;SHR S %CPU %MEM &nbsp; &nbsp; TIME+ COMMAND
&nbsp; &nbsp; 1 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; 56816 &nbsp; 6548 &nbsp; 5264 S &nbsp;0.0 &nbsp;0.4 &nbsp; 0:00.95 systemd
&nbsp; &nbsp; 2 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 kthreadd
&nbsp; &nbsp; 3 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.02 ksoftirqd/0
&nbsp; &nbsp; 5 root &nbsp; &nbsp; &nbsp; 0 -20 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 kworker/0:0H
&nbsp; &nbsp; 6 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.04 kworker/u2:0
&nbsp; &nbsp; 7 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.03 rcu_sched
&nbsp; &nbsp; 8 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 rcu_bh
&nbsp; &nbsp; 9 root &nbsp; &nbsp; &nbsp;rt &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 migration/0
&nbsp; &nbsp;10 root &nbsp; &nbsp; &nbsp; 0 -20 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 lru-add-drain
&nbsp; &nbsp;11 root &nbsp; &nbsp; &nbsp;rt &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 watchdog/0
&nbsp; &nbsp;12 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 cpuhp/0
&nbsp; &nbsp;13 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 kdevtmpfs
&nbsp; &nbsp;14 root &nbsp; &nbsp; &nbsp; 0 -20 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 netns
&nbsp; &nbsp;15 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 khungtaskd
&nbsp; &nbsp;16 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 oom_reaper
&nbsp; &nbsp;17 root &nbsp; &nbsp; &nbsp; 0 -20 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 writeback
&nbsp; &nbsp;18 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 kcompactd0

top上半部顯示的是系統資源使用情，下半部是系統行程的資訊。
上半部欄位說明
第1行
08:15:01：目前時間
up 44 min：主機開機時間
1 user：目前登入系統使用者數
load average: 1.00, 1.23, 0.86：系統每1分鐘、5分鐘、15分鐘的負載情況。
load average資料是每隔5秒鐘檢查一次活躍的進程數，然後按特定演算法計算出的數值。如果這個數除以邏輯CPU的數量，結果高於5的時候就表明系統在超負荷運轉了。
第2行
Tasks: &nbsp;63 total, &nbsp; 1 running, &nbsp;62 sleeping, &nbsp; 0 stopped, &nbsp; 0 zombie：
目前系統共63個行程，１個正在執行(running)，62個休眠狀態(sleeping)，0個已停止(stopped)，０個僵屍狀態(zombie)
第3行
%Cpu(s): &nbsp;1.1&nbsp;us, &nbsp;0.3&nbsp;sy, &nbsp;0.0&nbsp;ni,100.0 id, &nbsp;0.4&nbsp;wa, &nbsp;0.02 hi, &nbsp;0.1&nbsp;si, &nbsp;0.0 st：
1.1%us — 用戶空間佔用CPU的百分比
0.3% sy — 內核空間佔用CPU的百分比
0.0% ni — 改變過優先順序的進程佔用CPU的百分比
0.4% wa — IO等待佔用CPU的百分比
0.1% hi — 硬中斷（Hardware IRQ）佔用CPU的百分比
0.0% si — 軟中斷（Software Interrupts）佔用CPU的百分比
第4行
KiB Mem : &nbsp;1741400 total, &nbsp;1600560 free, &nbsp; &nbsp;73184 used, &nbsp; &nbsp;67656 buff/cach
記憶體使用狀態：
1741400 total：實體記憶體容量
1600560 free：剩餘記憶體容量
73184 used：已使用的記憶體容量
67656 buff/cach：暫存記憶體容量
第5行
KiB Swap: &nbsp; &nbsp; &nbsp; &nbsp;0 total, &nbsp; &nbsp; &nbsp; &nbsp;0 free, &nbsp; &nbsp; &nbsp; &nbsp;0 used. &nbsp;1557120 avail Mem&nbsp;
swap使用狀態：
0 total：swap總容量
0 free：已使用的swap容量
0 used：剩餘swap容量
1557120 avail Mem&nbsp;暫存記憶體容量

下半部欄位說明：
PID — 行程id(Process ID)
USER — 該行程使用者
PR — 行程優先順序
NI — nice值（值越小優先權優高）
VIRT — 該行程使用的虛擬記憶體總量，單位kb(VIRT=SWAP+RES)
RES — 該行程程使用的、未被使用的實體記憶體大小，單位kb(RES=CODE+DATA)
SHR — 共用記憶體大小（單位kb）
S — 行程狀態。D=不可中斷的睡眠狀態 R=運行 S=睡眠 T=跟蹤/停止 Z=僵屍進程
%CPU — 上次更新到現在的CPU時間佔用百分比
%MEM — 行程使用的實體記憶體百分比
TIME+ — 行程使用的CPU時間總計，單位1/100秒
COMMAND — 行程名稱


	top按鍵說明
	
		
			按鍵
			說明
		
		
			1
			顯示單一/多cpu使用情形切換
		
		
			B
			將欄位值做粗體/一般字體切換
		
		
			e/E
			時間顯示單位切換，可分s,ms,gs,ts,ps
		
		
			f/F
			Fields Management可自行選擇要顯示的欄位
		
		
			h
			叫出help說明
		
		
			k
			刪除指定行程
		
		
			l
			隱藏/顯示load average(第1行)資訊切換
		
		
			L
			尋找字串
		
		
			m
			依據mem用量進行排序
		
		
			M
			隱藏/顯示memory info (第4行)資訊切換
		
		
			P
			依據cpu用量進行排序
		
		
			q
			離開top
		
		
			R
			修改nice值
		
		
			S
			更改延遲時間(預設3秒)
		
		
			t
			隱藏/顯示tasks(第2.3行)資訊切換
		
		
			T
			依據Time+時間/累計時間進行排序
		
		
			z
			顯示顏色切換
		
		
			Z
			更改排序方式/顏色切換時之顏色
		
	


除了開啟top觀察系統資訊外top也可以使用指令將資訊直接回傳至營幕，若再使用"&gt;"或"&gt;&gt;"則可將結果匯出為檔案


	top常用參數
	
		
			參數
			說明
		
		
			b
			Batch mode
		
		
			d
			指定更新時間（單位:秒）
		
		
			o
			指定要輸出的欄位名稱
		
		
			p
			指定要觀察的pid
		
		
			u
			指定要觀察的使用者名稱
		
	


&nbsp;

ubuntu@ubuntu:~$ top -b -d 2 -p 6164  #使用batch mode，觀察pid 6164的行程並每2秒更新一次
top - 15:25:19 up 13 days, &nbsp;7:14, &nbsp;1 user, &nbsp;load average: 0.00, 0.00, 0.00
Tasks: &nbsp; 1 total, &nbsp; 0 running, &nbsp; 1 sleeping, &nbsp; 0 stopped, &nbsp; 0 zombie
%Cpu(s): &nbsp;0.1 us, &nbsp;0.2 sy, &nbsp;0.0 ni, 99.6 id, &nbsp;0.1 wa, &nbsp;0.0 hi, &nbsp;0.0 si, &nbsp;0.0 st
KiB Mem: &nbsp; &nbsp;602636 total, &nbsp; 383788 used, &nbsp; 218848 free, &nbsp; &nbsp;13528 buffers
KiB Swap: &nbsp; 524284 total, &nbsp; &nbsp;26740 used, &nbsp; 497544 free. &nbsp; 236088 cached Mem

&nbsp; PID USER &nbsp; &nbsp; &nbsp;PR &nbsp;NI &nbsp; &nbsp;VIRT &nbsp; &nbsp;RES &nbsp; &nbsp;SHR S %CPU %MEM &nbsp; &nbsp; TIME+ COMMAND
&nbsp;6164 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp;434960 &nbsp;27152 &nbsp; 2824 S &nbsp;0.0 &nbsp;4.5 &nbsp;71:22.76 mongod

top - 15:25:21 up 13 days, &nbsp;7:14, &nbsp;1 user, &nbsp;load average: 0.00, 0.00, 0.00
Tasks: &nbsp; 1 total, &nbsp; 0 running, &nbsp; 1 sleeping, &nbsp; 0 stopped, &nbsp; 0 zombie
%Cpu(s): &nbsp;0.5 us, &nbsp;0.0 sy, &nbsp;0.0 ni, 99.5 id, &nbsp;0.0 wa, &nbsp;0.0 hi, &nbsp;0.0 si, &nbsp;0.0 st
KiB Mem: &nbsp; &nbsp;602636 total, &nbsp; 383788 used, &nbsp; 218848 free, &nbsp; &nbsp;13528 buffers
KiB Swap: &nbsp; 524284 total, &nbsp; &nbsp;26740 used, &nbsp; 497544 free. &nbsp; 236088 cached Mem

&nbsp; PID USER &nbsp; &nbsp; &nbsp;PR &nbsp;NI &nbsp; &nbsp;VIRT &nbsp; &nbsp;RES &nbsp; &nbsp;SHR S %CPU %MEM &nbsp; &nbsp; TIME+ COMMAND
&nbsp;6164 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp;434960 &nbsp;27152 &nbsp; 2824 S &nbsp;0.0 &nbsp;4.5 &nbsp;71:22.76 mongod&nbsp;  #畫面會每2秒更新一次

ubuntu@ubuntu:~$ top -d 2 -u ubuntu                #觀察使用者ubuntu所執行的行程並每2秒更新一次
top - 15:30:25 up 13 days, &nbsp;7:19, &nbsp;1 user, &nbsp;load average: 0.00, 0.00, 0.00
Tasks: &nbsp;87 total, &nbsp; 2 running, &nbsp;85 sleeping, &nbsp; 0 stopped, &nbsp; 0 zombie
%Cpu(s): &nbsp;0.0 us, &nbsp;0.0 sy, &nbsp;0.0 ni,100.0 id, &nbsp;0.0 wa, &nbsp;0.0 hi, &nbsp;0.0 si, &nbsp;0.0 st
KiB Mem: &nbsp; &nbsp;602636 total, &nbsp; 383908 used, &nbsp; 218728 free, &nbsp; &nbsp;13540 buffers
KiB Swap: &nbsp; 524284 total, &nbsp; &nbsp;26740 used, &nbsp; 497544 free. &nbsp; 236088 cached Mem

&nbsp; PID USER &nbsp; &nbsp; &nbsp;PR &nbsp;NI &nbsp; &nbsp;VIRT &nbsp; &nbsp;RES &nbsp; &nbsp;SHR S %CPU %MEM &nbsp; &nbsp; TIME+ COMMAND &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
12227 ubuntu &nbsp;  20 &nbsp; 0 &nbsp;103592 &nbsp; 4044 &nbsp; 3048 S &nbsp;0.0 &nbsp;0.7 &nbsp; 0:00.51 sshd &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
12229 ubuntu   &nbsp;20 &nbsp; 0 &nbsp; 21332 &nbsp; 5244 &nbsp; 3244 S &nbsp;0.0 &nbsp;0.9 &nbsp; 0:00.08 bash &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
12230 ubuntu   &nbsp;20 &nbsp; 0 &nbsp; 12836 &nbsp; 1916 &nbsp; 1780 S &nbsp;0.0 &nbsp;0.3 &nbsp; 0:00.00 sftp-server &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
12662 ubuntu   &nbsp;20 &nbsp; 0 &nbsp; 23668 &nbsp; 2980 &nbsp; 2508 R &nbsp;0.0 &nbsp;0.5 &nbsp; 0:00.00 top &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;#不加-b參數會進入top內並每2秒更新一次

ubuntu@ubuntu:~$ top -b -o +%MEM | head -n 17                #使用batch mode，以記憶體做為排序依據，並只列出前17行
top - 15:46:13 up 13 days, &nbsp;7:35, &nbsp;1 user, &nbsp;load average: 0.00, 0.00, 0.00
Tasks: &nbsp;88 total, &nbsp; 1 running, &nbsp;87 sleeping, &nbsp; 0 stopped, &nbsp; 0 zombie
%Cpu(s): &nbsp;0.1 us, &nbsp;0.2 sy, &nbsp;0.0 ni, 99.6 id, &nbsp;0.1 wa, &nbsp;0.0 hi, &nbsp;0.0 si, &nbsp;0.0 st
KiB Mem: &nbsp; &nbsp;602636 total, &nbsp; 387760 used, &nbsp; 214876 free, &nbsp; &nbsp;14064 buffers
KiB Swap: &nbsp; 524284 total, &nbsp; &nbsp;26740 used, &nbsp; 497544 free. &nbsp; 240212 cached Mem

&nbsp; PID USER &nbsp; &nbsp; &nbsp;PR &nbsp;NI &nbsp; &nbsp;VIRT &nbsp; &nbsp;RES &nbsp; &nbsp;SHR S %CPU %MEM &nbsp; &nbsp; TIME+ COMMAND
&nbsp;6164 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp;434960 &nbsp;27152 &nbsp; 2824 S &nbsp;0.0 &nbsp;4.5 &nbsp;71:27.35 mongod
&nbsp;1376 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; 52316 &nbsp;10520 &nbsp; 3720 S &nbsp;0.0 &nbsp;1.7 &nbsp; 0:30.89 google_accounts
&nbsp;1374 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; 49960 &nbsp; 9692 &nbsp; 3056 S &nbsp;0.0 &nbsp;1.6 &nbsp; 0:19.92 google_clock_sk
&nbsp;1375 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; 49836 &nbsp; 9680 &nbsp; 3268 S &nbsp;0.0 &nbsp;1.6 &nbsp; 0:30.88 google_ip_forwa
12115 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp;103592 &nbsp; 6492 &nbsp; 5524 S &nbsp;0.0 &nbsp;1.1 &nbsp; 0:00.00 sshd
12229 ubuntu   &nbsp;20 &nbsp; 0 &nbsp; 21332 &nbsp; 5244 &nbsp; 3244 S &nbsp;0.0 &nbsp;0.9 &nbsp; 0:00.10 bash
12227 ubnutu   &nbsp;20 &nbsp; 0 &nbsp;103592 &nbsp; 4044 &nbsp; 3048 S &nbsp;0.0 &nbsp;0.7 &nbsp; 0:00.62 sshd
&nbsp; &nbsp; 1 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; 33528 &nbsp; 3172 &nbsp; 1996 S &nbsp;0.0 &nbsp;0.5 &nbsp; 0:03.47 init
12726 ubuntu   &nbsp;20 &nbsp; 0 &nbsp; 23548 &nbsp; 2892 &nbsp; 2548 R &nbsp;0.0 &nbsp;0.5 &nbsp; 0:00.00 top
&nbsp;1520 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; 61396 &nbsp; 2336 &nbsp; 2224 S &nbsp;0.0 &nbsp;0.4 &nbsp; 0:01.62 sshd


&nbsp;


參考資料：
每天一个linux命令（44）：top命令
鳥哥的Linux私房菜 -&nbsp;top：動態觀察程序的變化
Linux 用 ps 與 top 指令找出最耗費 CPU 與記憶體資源的程式
]]></description>
      <content:encoded><![CDATA[<p>top是效能分析工具，能夠即時顯示系統中各個行程的資源佔用狀況。</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ top &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
top - 08:15:01 up 44 min, &nbsp;1 user, &nbsp;load average: 0.00, 0.00, 0.00
Tasks: &nbsp;63 total, &nbsp; 1 running, &nbsp;62 sleeping, &nbsp; 0 stopped, &nbsp; 0 zombie
%Cpu(s): &nbsp;0.0 us, &nbsp;0.0 sy, &nbsp;0.0 ni,100.0 id, &nbsp;0.0 wa, &nbsp;0.0 hi, &nbsp;0.0 si, &nbsp;0.0 st
KiB Mem : &nbsp;1741400 total, &nbsp;1600560 free, &nbsp; &nbsp;73184 used, &nbsp; &nbsp;67656 buff/cache
KiB Swap: &nbsp; &nbsp; &nbsp; &nbsp;0 total, &nbsp; &nbsp; &nbsp; &nbsp;0 free, &nbsp; &nbsp; &nbsp; &nbsp;0 used. &nbsp;1557120 avail Mem&nbsp;

&nbsp; PID USER &nbsp; &nbsp; &nbsp;PR &nbsp;NI &nbsp; &nbsp;VIRT &nbsp; &nbsp;RES &nbsp; &nbsp;SHR S %CPU %MEM &nbsp; &nbsp; TIME+ COMMAND
&nbsp; &nbsp; 1 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; 56816 &nbsp; 6548 &nbsp; 5264 S &nbsp;0.0 &nbsp;0.4 &nbsp; 0:00.95 systemd
&nbsp; &nbsp; 2 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 kthreadd
&nbsp; &nbsp; 3 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.02 ksoftirqd/0
&nbsp; &nbsp; 5 root &nbsp; &nbsp; &nbsp; 0 -20 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 kworker/0:0H
&nbsp; &nbsp; 6 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.04 kworker/u2:0
&nbsp; &nbsp; 7 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.03 rcu_sched
&nbsp; &nbsp; 8 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 rcu_bh
&nbsp; &nbsp; 9 root &nbsp; &nbsp; &nbsp;rt &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 migration/0
&nbsp; &nbsp;10 root &nbsp; &nbsp; &nbsp; 0 -20 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 lru-add-drain
&nbsp; &nbsp;11 root &nbsp; &nbsp; &nbsp;rt &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 watchdog/0
&nbsp; &nbsp;12 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 cpuhp/0
&nbsp; &nbsp;13 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 kdevtmpfs
&nbsp; &nbsp;14 root &nbsp; &nbsp; &nbsp; 0 -20 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 netns
&nbsp; &nbsp;15 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 khungtaskd
&nbsp; &nbsp;16 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 oom_reaper
&nbsp; &nbsp;17 root &nbsp; &nbsp; &nbsp; 0 -20 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 writeback
&nbsp; &nbsp;18 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;0 S &nbsp;0.0 &nbsp;0.0 &nbsp; 0:00.00 kcompactd0</pre>

<p>top上半部顯示的是系統資源使用情，下半部是系統行程的資訊。<br>
上半部欄位說明<br>
<strong>第1行</strong><br>
08:15:01：目前時間<br>
up 44 min：主機開機時間<br>
1 user：目前登入系統使用者數<br>
load average: 1.00, 1.23, 0.86：系統每1分鐘、5分鐘、15分鐘的負載情況。<br>
load average資料是每隔5秒鐘檢查一次活躍的進程數，然後按特定演算法計算出的數值。如果這個數除以邏輯CPU的數量，結果高於5的時候就表明系統在超負荷運轉了。<br>
<strong>第2行</strong><br>
Tasks: &nbsp;63 total, &nbsp; 1 running, &nbsp;62 sleeping, &nbsp; 0 stopped, &nbsp; 0 zombie：<br>
目前系統共63個行程，１個正在執行(running)，62個休眠狀態(sleeping)，0個已停止(stopped)，０個僵屍狀態(zombie)<br>
<strong>第3行</strong><br>
%Cpu(s): &nbsp;1.1&nbsp;us, &nbsp;0.3&nbsp;sy, &nbsp;0.0&nbsp;ni,100.0 id, &nbsp;0.4&nbsp;wa, &nbsp;0.02 hi, &nbsp;0.1&nbsp;si, &nbsp;0.0 st：<br>
1.1%us — 用戶空間佔用CPU的百分比<br>
0.3% sy — 內核空間佔用CPU的百分比<br>
0.0% ni — 改變過優先順序的進程佔用CPU的百分比<br>
0.4% wa — IO等待佔用CPU的百分比<br>
0.1% hi — 硬中斷（Hardware IRQ）佔用CPU的百分比<br>
0.0% si — 軟中斷（Software Interrupts）佔用CPU的百分比<br>
<strong>第4行</strong><br>
KiB Mem : &nbsp;1741400 total, &nbsp;1600560 free, &nbsp; &nbsp;73184 used, &nbsp; &nbsp;67656 buff/cach<br>
記憶體使用狀態：<br>
1741400 total：實體記憶體容量<br>
1600560 free：剩餘記憶體容量<br>
73184 used：已使用的記憶體容量<br>
67656 buff/cach：暫存記憶體容量<br>
<strong>第5行</strong><br>
KiB Swap: &nbsp; &nbsp; &nbsp; &nbsp;0 total, &nbsp; &nbsp; &nbsp; &nbsp;0 free, &nbsp; &nbsp; &nbsp; &nbsp;0 used. &nbsp;1557120 avail Mem&nbsp;<br>
swap使用狀態：<br>
0 total：swap總容量<br>
0 free：已使用的swap容量<br>
0 used：剩餘swap容量<br>
1557120 avail Mem&nbsp;暫存記憶體容量<br>
<br>
下半部欄位說明：<br>
PID — 行程id(Process ID)<br>
USER — 該行程使用者<br>
PR — 行程優先順序<br>
NI — nice值（值越小優先權優高）<br>
VIRT — 該行程使用的虛擬記憶體總量，單位kb(VIRT=SWAP+RES)<br>
RES — 該行程程使用的、未被使用的實體記憶體大小，單位kb(RES=CODE+DATA)<br>
SHR — 共用記憶體大小（單位kb）<br>
S — 行程狀態。D=不可中斷的睡眠狀態 R=運行 S=睡眠 T=跟蹤/停止 Z=僵屍進程<br>
%CPU — 上次更新到現在的CPU時間佔用百分比<br>
%MEM — 行程使用的實體記憶體百分比<br>
TIME+ — 行程使用的CPU時間總計，單位1/100秒<br>
COMMAND — 行程名稱</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<caption>top按鍵說明</caption>
	<tbody>
		<tr>
			<td style="text-align: center;">按鍵</td>
			<td>說明</td>
		</tr>
		<tr>
			<td style="text-align: center;">1</td>
			<td>顯示單一/多cpu使用情形切換</td>
		</tr>
		<tr>
			<td style="text-align: center;">B</td>
			<td>將欄位值做粗體/一般字體切換</td>
		</tr>
		<tr>
			<td style="text-align: center;">e/E</td>
			<td>時間顯示單位切換，可分s,ms,gs,ts,ps</td>
		</tr>
		<tr>
			<td style="text-align: center;">f/F</td>
			<td>Fields Management可自行選擇要顯示的欄位</td>
		</tr>
		<tr>
			<td style="text-align: center;">h</td>
			<td>叫出help說明</td>
		</tr>
		<tr>
			<td style="text-align: center;">k</td>
			<td>刪除指定行程</td>
		</tr>
		<tr>
			<td style="text-align: center;">l</td>
			<td>隱藏/顯示load average(第1行)資訊切換</td>
		</tr>
		<tr>
			<td style="text-align: center;">L</td>
			<td>尋找字串</td>
		</tr>
		<tr>
			<td style="text-align: center;">m</td>
			<td>依據mem用量進行排序</td>
		</tr>
		<tr>
			<td style="text-align: center;">M</td>
			<td>隱藏/顯示memory info (第4行)資訊切換</td>
		</tr>
		<tr>
			<td style="text-align: center;">P</td>
			<td>依據cpu用量進行排序</td>
		</tr>
		<tr>
			<td style="text-align: center;">q</td>
			<td>離開top</td>
		</tr>
		<tr>
			<td style="text-align: center;">R</td>
			<td>修改nice值</td>
		</tr>
		<tr>
			<td style="text-align: center;">S</td>
			<td>更改延遲時間(預設3秒)</td>
		</tr>
		<tr>
			<td style="text-align: center;">t</td>
			<td>隱藏/顯示tasks(第2.3行)資訊切換</td>
		</tr>
		<tr>
			<td style="text-align: center;">T</td>
			<td>依據Time+時間/累計時間進行排序</td>
		</tr>
		<tr>
			<td style="text-align: center;">z</td>
			<td>顯示顏色切換</td>
		</tr>
		<tr>
			<td style="text-align: center;">Z</td>
			<td>更改排序方式/顏色切換時之顏色</td>
		</tr>
	</tbody>
</table>

<p>除了開啟top觀察系統資訊外top也可以使用指令將資訊直接回傳至營幕，若再使用"<strong>&gt;</strong>"或"<strong>&gt;&gt;</strong>"則可將結果匯出為檔案</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<caption>top常用參數</caption>
	<tbody>
		<tr>
			<td style="text-align: center;">參數</td>
			<td style="text-align: center;">說明</td>
		</tr>
		<tr>
			<td style="text-align: center;">b</td>
			<td>Batch mode</td>
		</tr>
		<tr>
			<td style="text-align: center;">d</td>
			<td>指定更新時間（單位:秒）</td>
		</tr>
		<tr>
			<td style="text-align: center;">o</td>
			<td>指定要輸出的欄位名稱</td>
		</tr>
		<tr>
			<td style="text-align: center;">p</td>
			<td>指定要觀察的pid</td>
		</tr>
		<tr>
			<td style="text-align: center;">u</td>
			<td>指定要觀察的使用者名稱</td>
		</tr>
	</tbody>
</table>

<p>&nbsp;</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ubuntu@ubuntu:~$ top -b -d 2 -p 6164  #使用batch mode，觀察pid 6164的行程並每2秒更新一次
top - 15:25:19 up 13 days, &nbsp;7:14, &nbsp;1 user, &nbsp;load average: 0.00, 0.00, 0.00
Tasks: &nbsp; 1 total, &nbsp; 0 running, &nbsp; 1 sleeping, &nbsp; 0 stopped, &nbsp; 0 zombie
%Cpu(s): &nbsp;0.1 us, &nbsp;0.2 sy, &nbsp;0.0 ni, 99.6 id, &nbsp;0.1 wa, &nbsp;0.0 hi, &nbsp;0.0 si, &nbsp;0.0 st
KiB Mem: &nbsp; &nbsp;602636 total, &nbsp; 383788 used, &nbsp; 218848 free, &nbsp; &nbsp;13528 buffers
KiB Swap: &nbsp; 524284 total, &nbsp; &nbsp;26740 used, &nbsp; 497544 free. &nbsp; 236088 cached Mem

&nbsp; PID USER &nbsp; &nbsp; &nbsp;PR &nbsp;NI &nbsp; &nbsp;VIRT &nbsp; &nbsp;RES &nbsp; &nbsp;SHR S %CPU %MEM &nbsp; &nbsp; TIME+ COMMAND
&nbsp;6164 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp;434960 &nbsp;27152 &nbsp; 2824 S &nbsp;0.0 &nbsp;4.5 &nbsp;71:22.76 mongod

top - 15:25:21 up 13 days, &nbsp;7:14, &nbsp;1 user, &nbsp;load average: 0.00, 0.00, 0.00
Tasks: &nbsp; 1 total, &nbsp; 0 running, &nbsp; 1 sleeping, &nbsp; 0 stopped, &nbsp; 0 zombie
%Cpu(s): &nbsp;0.5 us, &nbsp;0.0 sy, &nbsp;0.0 ni, 99.5 id, &nbsp;0.0 wa, &nbsp;0.0 hi, &nbsp;0.0 si, &nbsp;0.0 st
KiB Mem: &nbsp; &nbsp;602636 total, &nbsp; 383788 used, &nbsp; 218848 free, &nbsp; &nbsp;13528 buffers
KiB Swap: &nbsp; 524284 total, &nbsp; &nbsp;26740 used, &nbsp; 497544 free. &nbsp; 236088 cached Mem

&nbsp; PID USER &nbsp; &nbsp; &nbsp;PR &nbsp;NI &nbsp; &nbsp;VIRT &nbsp; &nbsp;RES &nbsp; &nbsp;SHR S %CPU %MEM &nbsp; &nbsp; TIME+ COMMAND
&nbsp;6164 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp;434960 &nbsp;27152 &nbsp; 2824 S &nbsp;0.0 &nbsp;4.5 &nbsp;71:22.76 mongod&nbsp;  #畫面會每2秒更新一次

ubuntu@ubuntu:~$ top -d 2 -u ubuntu                #觀察使用者ubuntu所執行的行程並每2秒更新一次
top - 15:30:25 up 13 days, &nbsp;7:19, &nbsp;1 user, &nbsp;load average: 0.00, 0.00, 0.00
Tasks: &nbsp;87 total, &nbsp; 2 running, &nbsp;85 sleeping, &nbsp; 0 stopped, &nbsp; 0 zombie
%Cpu(s): &nbsp;0.0 us, &nbsp;0.0 sy, &nbsp;0.0 ni,100.0 id, &nbsp;0.0 wa, &nbsp;0.0 hi, &nbsp;0.0 si, &nbsp;0.0 st
KiB Mem: &nbsp; &nbsp;602636 total, &nbsp; 383908 used, &nbsp; 218728 free, &nbsp; &nbsp;13540 buffers
KiB Swap: &nbsp; 524284 total, &nbsp; &nbsp;26740 used, &nbsp; 497544 free. &nbsp; 236088 cached Mem

&nbsp; PID USER &nbsp; &nbsp; &nbsp;PR &nbsp;NI &nbsp; &nbsp;VIRT &nbsp; &nbsp;RES &nbsp; &nbsp;SHR S %CPU %MEM &nbsp; &nbsp; TIME+ COMMAND &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
12227 ubuntu &nbsp;  20 &nbsp; 0 &nbsp;103592 &nbsp; 4044 &nbsp; 3048 S &nbsp;0.0 &nbsp;0.7 &nbsp; 0:00.51 sshd &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
12229 ubuntu   &nbsp;20 &nbsp; 0 &nbsp; 21332 &nbsp; 5244 &nbsp; 3244 S &nbsp;0.0 &nbsp;0.9 &nbsp; 0:00.08 bash &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
12230 ubuntu   &nbsp;20 &nbsp; 0 &nbsp; 12836 &nbsp; 1916 &nbsp; 1780 S &nbsp;0.0 &nbsp;0.3 &nbsp; 0:00.00 sftp-server &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
12662 ubuntu   &nbsp;20 &nbsp; 0 &nbsp; 23668 &nbsp; 2980 &nbsp; 2508 R &nbsp;0.0 &nbsp;0.5 &nbsp; 0:00.00 top &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;#不加-b參數會進入top內並每2秒更新一次

ubuntu@ubuntu:~$ top -b -o +%MEM | head -n 17                #使用batch mode，以記憶體做為排序依據，並只列出前17行
top - 15:46:13 up 13 days, &nbsp;7:35, &nbsp;1 user, &nbsp;load average: 0.00, 0.00, 0.00
Tasks: &nbsp;88 total, &nbsp; 1 running, &nbsp;87 sleeping, &nbsp; 0 stopped, &nbsp; 0 zombie
%Cpu(s): &nbsp;0.1 us, &nbsp;0.2 sy, &nbsp;0.0 ni, 99.6 id, &nbsp;0.1 wa, &nbsp;0.0 hi, &nbsp;0.0 si, &nbsp;0.0 st
KiB Mem: &nbsp; &nbsp;602636 total, &nbsp; 387760 used, &nbsp; 214876 free, &nbsp; &nbsp;14064 buffers
KiB Swap: &nbsp; 524284 total, &nbsp; &nbsp;26740 used, &nbsp; 497544 free. &nbsp; 240212 cached Mem

&nbsp; PID USER &nbsp; &nbsp; &nbsp;PR &nbsp;NI &nbsp; &nbsp;VIRT &nbsp; &nbsp;RES &nbsp; &nbsp;SHR S %CPU %MEM &nbsp; &nbsp; TIME+ COMMAND
&nbsp;6164 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp;434960 &nbsp;27152 &nbsp; 2824 S &nbsp;0.0 &nbsp;4.5 &nbsp;71:27.35 mongod
&nbsp;1376 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; 52316 &nbsp;10520 &nbsp; 3720 S &nbsp;0.0 &nbsp;1.7 &nbsp; 0:30.89 google_accounts
&nbsp;1374 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; 49960 &nbsp; 9692 &nbsp; 3056 S &nbsp;0.0 &nbsp;1.6 &nbsp; 0:19.92 google_clock_sk
&nbsp;1375 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; 49836 &nbsp; 9680 &nbsp; 3268 S &nbsp;0.0 &nbsp;1.6 &nbsp; 0:30.88 google_ip_forwa
12115 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp;103592 &nbsp; 6492 &nbsp; 5524 S &nbsp;0.0 &nbsp;1.1 &nbsp; 0:00.00 sshd
12229 ubuntu   &nbsp;20 &nbsp; 0 &nbsp; 21332 &nbsp; 5244 &nbsp; 3244 S &nbsp;0.0 &nbsp;0.9 &nbsp; 0:00.10 bash
12227 ubnutu   &nbsp;20 &nbsp; 0 &nbsp;103592 &nbsp; 4044 &nbsp; 3048 S &nbsp;0.0 &nbsp;0.7 &nbsp; 0:00.62 sshd
&nbsp; &nbsp; 1 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; 33528 &nbsp; 3172 &nbsp; 1996 S &nbsp;0.0 &nbsp;0.5 &nbsp; 0:03.47 init
12726 ubuntu   &nbsp;20 &nbsp; 0 &nbsp; 23548 &nbsp; 2892 &nbsp; 2548 R &nbsp;0.0 &nbsp;0.5 &nbsp; 0:00.00 top
&nbsp;1520 root &nbsp; &nbsp; &nbsp;20 &nbsp; 0 &nbsp; 61396 &nbsp; 2336 &nbsp; 2224 S &nbsp;0.0 &nbsp;0.4 &nbsp; 0:01.62 sshd
</pre>

<p>&nbsp;</p>

<hr>
<p>參考資料：<br>
<a href="http://www.cnblogs.com/peida/archive/2012/12/24/2831353.html" target="_blank">每天一个linux命令（44）：top命令</a><br>
<a href="http://linux.vbird.org/linux_basic/0440processcontrol.php#topm" target="_blank">鳥哥的Linux私房菜 -&nbsp;top：動態觀察程序的變化</a><br>
<a href="https://blog.gtwang.org/linux/ps-top-find-processes-by-cpu-memory-usage/" target="_blank">Linux 用 ps 與 top 指令找出最耗費 CPU 與記憶體資源的程式</a></p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45252072">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45252072"></div>]]></content:encoded>
      <pubDate>Wed, 26 Apr 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[Linux]]></category>
      <comments>https://david50.pixnet.net/blog/post/45252072#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Linux指令-ps(process status)]]></title>
      <link>https://david50.pixnet.net/blog/post/45224451</link>
      <guid>https://david50.pixnet.net/blog/post/45224451</guid>
      <description><![CDATA[在Linux中我們可以使用ps指令(Process status)來觀察行程(Process)的資訊，當ps指令不加任何選項時，只會顯示該使用者在當次登入時的資訊：



PPID:PPID全名是Parent Process ID，是父行程編號代表該行程編號。


上圖第二行代表的資訊是ps -f行程，這個行程是由bash行程(PID 312)衍生出來的子行程(PPID 312)，我們可以通常說bash是ps -f的父行程。

ps也可以查看系統行程，我們可以ps指令加上aux選項查看系統行程。(由於系統行程實在太多我們可使用more分頁瀏灠ps aus |more)




	ps欄位說明
	
		
			USER
			該行程之擁有者
		
		
			PID
			該行程之PID
		
		
			%CPU
			CPU使用率
		
		
			%MEM
			記憶體使用率
		
		
			VSZ
			虛擬記憶體使用量，以KB為單位
		
		
			RSS
			固定占用的記憶體，以KB為單位
		
		
			TTY
			終端機編號，系統服務均無終端機因為TTY欄為?
		
		
			STAT
			目前狀態。S:睡眠中，R:執行中
		
		
			START
			啟動日期
		
		
			TIME
			實際使用CPU時間
		
		
			COMMAND
			該行程指令
		
	


優先權(nice value)
在Linux中行程有優先權的設計，順序以-20至19表示，這個數字稱為nice值(nice value)，數字越小表示該行程擁有的優先權越高，數字越大則優先權越低。
我們可使用"l"參數查看nice值



顯示特定欄位o
ps o comm,pid,ni&nbsp; &nbsp;顯示command.pid及ni欄位



指定優先權(nice value)
語法：nice -n 欲指定之nice值 指令
nice指令在執行指令時用以指定其nice值。


上例是在執行sleep 60時將其nice值指定為-3

調整行程優先權 renice
更改已在執行中的nice值可使用renice。
語法：renice 新的nice值 PID



行程優先權序值PRI(Priority)
Linux為每一個行程定義了優先權序值Pri(priority)，PRI越小則越能優先被系統執行，系統會先為每個行程產生一個動態PRI值，而PRI值會加上nice值，成為最終的懮先權序植。



上例即可發現第一次執行sleep 200 &amp;時未指定nice值則PRI值為80，第二次執行sleep 300指定nice值為-10後的PRI值變為70

刪除行程 kill
kill能將目前運作的行程刪除，當kill指令送出訊號收到訊號的行程將依本身訊號值決定是否結束，能否結束還要看行程本身，若要強制結束可使用-9參數。
語法：kill PID



使用行程名稱刪除正在執行的行程 killall
有時同一程式會同時執行好幾個行程，若使用kill一個一個刪實在太慢也太麻煩了，此時可以使用killall將相同名稱的行桯一次刪除。
語法：killall 行程名稱




&nbsp;
]]></description>
      <content:encoded><![CDATA[<p>在Linux中我們可以使用ps指令(Process status)來觀察行程(Process)的資訊，當ps指令不加任何選項時，只會顯示該使用者在當次登入時的資訊：</p>

<p><img alt="ps.JPG" src="https://pic.pimg.tw/david50/1502594425-4131273106_n.jpg?v=1502594437" title="ps.JPG"></p>

<p><strong>PPID</strong>:PPID全名是Parent Process ID，是父行程編號代表該行程編號。</p>

<p><img alt="ps -f.JPG" src="https://pic.pimg.tw/david50/1502594868-3122033590_n.jpg?v=1502594873" title="ps -f.JPG"><br>
上圖第二行代表的資訊是ps -f行程，這個行程是由bash行程(PID 312)衍生出來的子行程(PPID 312)，我們可以通常說bash是ps -f的父行程。</p>

<p>ps也可以查看系統行程，我們可以ps指令加上aux選項查看系統行程。(由於系統行程實在太多我們可使用more分頁瀏灠ps aus |more)</p>

<p><img alt="ps aux.JPG" src="https://pic.pimg.tw/david50/1502596864-643808139_n.jpg?v=1502596871" title="ps aux.JPG"></p>

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<caption>ps欄位說明</caption>
	<tbody>
		<tr>
			<td>USER</td>
			<td>該行程之擁有者</td>
		</tr>
		<tr>
			<td>PID</td>
			<td>該行程之PID</td>
		</tr>
		<tr>
			<td>%CPU</td>
			<td>CPU使用率</td>
		</tr>
		<tr>
			<td>%MEM</td>
			<td>記憶體使用率</td>
		</tr>
		<tr>
			<td>VSZ</td>
			<td>虛擬記憶體使用量，以KB為單位</td>
		</tr>
		<tr>
			<td>RSS</td>
			<td>固定占用的記憶體，以KB為單位</td>
		</tr>
		<tr>
			<td>TTY</td>
			<td>終端機編號，系統服務均無終端機因為TTY欄為?</td>
		</tr>
		<tr>
			<td>STAT</td>
			<td>目前狀態。S:睡眠中，R:執行中</td>
		</tr>
		<tr>
			<td>START</td>
			<td>啟動日期</td>
		</tr>
		<tr>
			<td>TIME</td>
			<td>實際使用CPU時間</td>
		</tr>
		<tr>
			<td>COMMAND</td>
			<td>該行程指令</td>
		</tr>
	</tbody>
</table>

<p><strong>優先權(nice value)</strong><br>
在Linux中行程有優先權的設計，順序以-20至19表示，這個數字稱為nice值(nice value)，數字越小表示該行程擁有的優先權越高，數字越大則優先權越低。<br>
我們可使用"<strong>l</strong>"參數查看nice值</p>

<p><img alt="ps l-1.jpg" src="https://pic.pimg.tw/david50/1502603653-1309348439_n.jpg?v=1502603659" title="ps l-1.jpg"></p>

<p><strong>顯示特定欄位o</strong><br>
ps o comm,pid,ni&nbsp; &nbsp;顯示command.pid及ni欄位</p>

<p><img alt="ps o.jpg" src="https://pic.pimg.tw/david50/1502603653-1353471732_n.jpg?v=1502603659" title="ps o.jpg"></p>

<p><strong>指定優先權(nice value)</strong><br>
語法：nice -n 欲指定之nice值 指令<br>
nice指令在執行指令時用以指定其nice值。<br>
<img alt="nice.JPG" src="https://pic.pimg.tw/david50/1502605007-4217026208_n.jpg?v=1502605010" title="nice.JPG"></p>

<p>上例是在執行sleep 60時將其nice值指定為-3</p>

<p><strong>調整行程優先權 renice</strong><br>
更改已在執行中的nice值可使用renice。<br>
語法：renice 新的nice值 PID</p>

<p><img alt="renice.JPG" src="https://pic.pimg.tw/david50/1502612537-4208317444_n.jpg?v=1502612549" title="renice.JPG"></p>

<p><strong>行程優先權序值PRI(Priority)</strong><br>
Linux為每一個行程定義了優先權序值Pri(priority)，PRI越小則越能優先被系統執行，系統會先為每個行程產生一個動態PRI值，而PRI值會加上nice值，成為最終的懮先權序植。</p>

<p><img alt="pri.JPG" src="https://pic.pimg.tw/david50/1502609443-1362008003_n.jpg?v=1502609458" title="pri.JPG"></p>

<p>上例即可發現第一次執行sleep 200 &amp;時未指定nice值則PRI值為80，第二次執行sleep 300指定nice值為-10後的PRI值變為70</p>

<p><strong>刪除行程 kill</strong><br>
kill能將目前運作的行程刪除，當kill指令送出訊號收到訊號的行程將依本身訊號值決定是否結束，能否結束還要看行程本身，若要強制結束可使用<strong>-9</strong>參數。<br>
語法：kill PID</p>

<p><img alt="kill.JPG" src="https://pic.pimg.tw/david50/1502605908-3142894422_n.jpg?v=1502608182" title="kill.JPG"></p>

<p><strong>使用行程名稱刪除正在執行的行程 killall</strong><br>
有時同一程式會同時執行好幾個行程，若使用kill一個一個刪實在太慢也太麻煩了，此時可以使用killall將相同名稱的行桯一次刪除。<br>
語法：killall 行程名稱</p>

<p><img alt="killall.JPG" src="https://pic.pimg.tw/david50/1502611366-10968118_n.jpg?v=1502611380" title="killall.JPG"></p>

<p><br>
&nbsp;</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45224451">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45224451"></div>]]></content:encoded>
      <pubDate>Tue, 25 Apr 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[Linux]]></category>
      <comments>https://david50.pixnet.net/blog/post/45224451#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Cisco DHCP Server實做]]></title>
      <link>https://david50.pixnet.net/blog/post/45220440</link>
      <guid>https://david50.pixnet.net/blog/post/45220440</guid>
      <description><![CDATA[(config)#ip dhcp pool pool1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 建立位址儲備池，並命名為pool1
(dhcp-config)#network 10.0.0.0 255.255.255.0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;指定要分配的IP範圍(10.0.0.0為Network ID)
(dhcp-config)#default-router 10.0.0.254 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;設定預設閘道
(dhcp-config)#dns-server 8.8.8.8 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;設定DNS
(dhcp-config)#exit &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;回到全域模式
(config)#ip dhcp exclude-address 10.0.0.200 10.0.0.254 &nbsp; 指定10.0.0.200 ~ 10.0.0.254不配發

查詢DHCP池使用狀況
#show ip dhcp binding
]]></description>
      <content:encoded><![CDATA[<p>(config)#ip dhcp pool pool1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 建立位址儲備池，並命名為pool1<br>
(dhcp-config)#network 10.0.0.0 255.255.255.0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;指定要分配的IP範圍(10.0.0.0為Network ID)<br>
(dhcp-config)#default-router 10.0.0.254 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;設定預設閘道<br>
(dhcp-config)#dns-server 8.8.8.8 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;設定DNS<br>
(dhcp-config)#exit &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;回到全域模式<br>
(config)#ip dhcp exclude-address 10.0.0.200 10.0.0.254 &nbsp; 指定10.0.0.200 ~ 10.0.0.254不配發</p>

<p>查詢DHCP池使用狀況<br>
#show ip dhcp binding</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45220440">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45220440"></div>]]></content:encoded>
      <pubDate>Fri, 21 Apr 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45220440#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]DHCP運作流程]]></title>
      <link>https://david50.pixnet.net/blog/post/45218274</link>
      <guid>https://david50.pixnet.net/blog/post/45218274</guid>
      <description><![CDATA[用戶端(設定自動取得IP)


	網路上沒有DHCP伺服器時

	
		剛開機時的IP:0.0.0.0
		自動使用APIPA IP(169.254.x.x)
	
	
	網路上有DHCP伺服器時
	
		用戶端發出DHCP探索（廣播）
		DHCP伺服器保留一個IP準備給用戶
		發出DHCP回覆（廣播）
	
	
	用戶端發出DHCP要求（廣播）
	
		沒被要求的DHCP釋放IP
	
	
	DHCP伺服器發出DHCP確認

]]></description>
      <content:encoded><![CDATA[<p><span><span style="font-family:新細明體,serif">用戶端<span>(</span>設定自動取得<span>IP)</span></span></span></p>

<ol>
	<li><span><span style="font-family:新細明體,serif">網路上沒有</span></span><span>DHCP</span><span><span style="font-family:新細明體,serif">伺服器時</span></span>

	<ul>
		<li><span><span style="font-family:新細明體,serif">剛開機時的</span></span><span>IP:0.0.0.0</span></li>
		<li><span><span style="font-family:新細明體,serif">自動使用</span></span><span>APIPA IP(169.254.x.x)</span></li>
	</ul>
	</li>
	<li><span><span style="font-family:新細明體,serif">網路上有</span></span><span>DHCP</span><span><span style="font-family:新細明體,serif">伺服器時</span></span>
	<ul>
		<li><span><span style="font-family:新細明體,serif">用戶端發出</span></span><span>DHCP</span><span><span style="font-family:新細明體,serif">探索（廣播）</span></span></li>
		<li><span>DHCP</span><span><span style="font-family:新細明體,serif">伺服器保留一個</span></span><span>IP</span><span><span style="font-family:新細明體,serif">準備給用戶</span></span></li>
		<li><span><span style="font-family:新細明體,serif">發出</span></span><span>DHCP</span><span><span style="font-family:新細明體,serif">回覆（廣播）</span></span></li>
	</ul>
	</li>
	<li><span><span style="font-family:新細明體,serif">用戶端發出</span></span><span>DHCP</span><span><span style="font-family:新細明體,serif">要求（廣播）</span></span>
	<ul>
		<li><span><span style="font-family:新細明體,serif">沒被要求的</span></span><span>DHCP</span><span><span style="font-family:新細明體,serif">釋放</span></span><span>IP</span></li>
	</ul>
	</li>
	<li><span>DHCP伺服器</span><span><span style="font-family:新細明體,serif">發出</span></span><span>DHCP</span><span><span style="font-family:新細明體,serif">確認</span></span></li>
</ol>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45218274">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45218274"></div>]]></content:encoded>
      <pubDate>Fri, 21 Apr 2017 10:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45218274#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]非對稱(asymmetric)式加密特點]]></title>
      <link>https://david50.pixnet.net/blog/post/45218142</link>
      <guid>https://david50.pixnet.net/blog/post/45218142</guid>
      <description><![CDATA[非對稱式(asymmetric)加密


	伺服器產生兩把key



	公開key：可在網路上傳遞
	私密key：伺服器獨自保管



	非對稱式加密用途



	資料加密：用公開key加密；用私密key解密
	確認資料完整性（數位簽章）：用私密key加密，用公開key解密



	非對稱式加密：加解密用不同key
	如何確認伺服器公開key的真偽



	使用憑證授權單位
	確認資料完整性

]]></description>
      <content:encoded><![CDATA[<p>非對稱式(asymmetric)加密</p>

<ol>
	<li><span><span style="font-family:新細明體,serif">伺服器產生兩把<span>key</span></span></span></li>
</ol>

<ol style="list-style-type: lower-alpha; margin-left: 40px;">
	<li><span><span style="font-family:新細明體,serif">公開<span>key</span>：可在網路上傳遞</span></span></li>
	<li><span><span style="font-family:新細明體,serif">私密<span>key</span>：伺服器獨自保管</span></span></li>
</ol>

<ol>
	<li value="2"><span><span style="font-family:新細明體,serif">非對稱式加密用途</span></span></li>
</ol>

<ol style="list-style-type: lower-alpha; margin-left: 40px;">
	<li><span><span style="font-family:新細明體,serif">資料加密：用公開<span>key</span>加密；用私密<span>key</span>解密</span></span></li>
	<li><span><span style="font-family:新細明體,serif">確認資料完整性（數位簽章）：用私密<span>key</span>加密，用公開<span>key</span>解密</span></span></li>
</ol>

<ol>
	<li value="3"><span><span style="font-family:新細明體,serif">非對稱式加密：加解密用不同<span>key</span></span></span></li>
	<li><span><span style="font-family:新細明體,serif">如何確認伺服器公開<span>key</span>的真偽</span></span></li>
</ol>

<ol style="list-style-type: lower-alpha; margin-left: 40px;">
	<li><span><span style="font-family:新細明體,serif">使用憑證授權單位</span></span></li>
	<li><span><span style="font-family:新細明體,serif">確認資料完整性</span></span></li>
</ol>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45218142">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45218142"></div>]]></content:encoded>
      <pubDate>Fri, 14 Apr 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45218142#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Cisco基本指令-啟用SSH]]></title>
      <link>https://david50.pixnet.net/blog/post/45217866</link>
      <guid>https://david50.pixnet.net/blog/post/45217866</guid>
      <description><![CDATA[要啟用SSH需完成3個設定

1.設定本機帳號
(config)#username cisco password ccna &nbsp; 建立帳號cisco密碼nnca(密碼未加密)
(config)#username cisco secret ccna &nbsp; &nbsp; &nbsp; &nbsp; 建立帳號cisco1密碼nnca(密碼加密)
同一帳號僅可選一種方式設定密碼
若要取消password可使用
(config)#username cisco nopassword
取消secret使用
(config)#username cisco nosecret

2.設定加密方式(產生加密key)
(config)#ip domain-name ccna.com &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;設定domain-name為ccna
(config)#crypto key generate rsa &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 產生rsa金鑰
How many bit in the modulus[512]:1024 &nbsp;使用1024bit加密(預設512)

3.啟用SSH/Telnet連線
(config)#ip ssh version 2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 使用ssh v2協定
(config)#line vty 0 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;開啟0~4vty連線(即最大連線人數5人)
(config-line)#login local &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;啟用密碼(login)及帳號(local)&nbsp;
(config-line)#transport input ssh &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;啟用ssh
(config-line)#transport input telnet &nbsp; &nbsp; &nbsp; &nbsp;啟用telnet
(config-line)#transport input all &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ssh.telnet均啟用
(config-line)#transport input none &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;ssh.telnet均關閉

連線測試
#ssh -l cisco 10.0.0.1
]]></description>
      <content:encoded><![CDATA[<p>要啟用SSH需完成3個設定</p>

<p><strong>1.設定本機帳號</strong><br>
(config)#username cisco password ccna &nbsp; 建立帳號cisco密碼nnca(密碼未加密)<br>
(config)#username cisco secret ccna &nbsp; &nbsp; &nbsp; &nbsp; 建立帳號cisco1密碼nnca(密碼加密)<br>
同一帳號僅可選一種方式設定密碼<br>
若要取消password可使用<br>
(config)#username cisco nopassword<br>
取消secret使用<br>
(config)#username cisco nosecret</p>

<p><strong>2.設定加密方式(產生加密key)</strong><br>
(config)#ip domain-name ccna.com &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;設定domain-name為ccna<br>
(config)#crypto key generate rsa &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 產生rsa金鑰<br>
How many bit in the modulus[512]:1024 &nbsp;使用1024bit加密(預設512)</p>

<p><strong>3.啟用SSH/Telnet連線</strong><br>
(config)#ip ssh version 2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 使用ssh v2協定<br>
(config)#line vty 0 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;開啟0~4vty連線(即最大連線人數5人)<br>
(config-line)#login local &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;啟用密碼(login)及帳號(local)&nbsp;<br>
(config-line)#transport input ssh &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;啟用ssh<br>
(config-line)#transport input telnet &nbsp; &nbsp; &nbsp; &nbsp;啟用telnet<br>
(config-line)#transport input all &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ssh.telnet均啟用<br>
(config-line)#transport input none &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;ssh.telnet均關閉</p>

<p>連線測試<br>
#ssh -l cisco 10.0.0.1</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45217866">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45217866"></div>]]></content:encoded>
      <pubDate>Fri, 07 Apr 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45217866#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Cisco基本指令-密碼設定]]></title>
      <link>https://david50.pixnet.net/blog/post/45217572</link>
      <guid>https://david50.pixnet.net/blog/post/45217572</guid>
      <description><![CDATA[設定Console登入密碼
(Config)#line console 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 由全域模式進入line模式
(Config-line)#password ccna &nbsp; &nbsp;將密碼為ccna
(Config-line)#login &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 啟用密碼

取消登入密碼
(Config)#line console 0
(Config-line)#no password &nbsp;

設定登入特權(enable)模式密碼
(Config)#enable password ccna &nbsp; &nbsp;設定明碼密碼為ccna
(Config)#enable secret ccnp &nbsp; &nbsp; &nbsp; &nbsp; 設定加密密碼為ccnp
*當明碼(password)和加密(secret)密碼2者都有設定時優先使用secret之密碼

取消登入特權(enable)模式密碼
(Config)#no enable password
(Config)#no enable secret

設定遠端登入(Virtual type terminal, vty)密碼
*開啟vty登入需先設定登入enable模式密碼，否則登入後將無法進入enable模式
(config)#line vty ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 查看vty可連線數量(系統預設0-15)
(config)#line vty 0 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;開啟0~4vty連線(即最大連線人數5人)
(config-line)#password ccnb &nbsp; &nbsp;設定密碼為ccnb
(config-line)#login &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;啟用密碼

取消遠端登入(Virtual type terminal, vty)密碼
(config)#line vty 0 4
(config-line)#no password

設定Console連線逾時時間
(config)#line console 0
(config-line)#exec-time 00 00 &nbsp;設定永不逾時
(config-line)#exec-time 02&nbsp;30 &nbsp;設定逾時時間為2:30

防止跳出控制台訊息
(config)#line console 0
(config-line)#logging synchronous
]]></description>
      <content:encoded><![CDATA[<p><strong>設定Console登入密碼</strong><br>
(Config)#line console 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 由全域模式進入line模式<br>
(Config-line)#password ccna &nbsp; &nbsp;將密碼為ccna<br>
(Config-line)#login &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 啟用密碼</p>

<p><strong>取消登入密碼</strong><br>
(Config)#line console 0<br>
(Config-line)#no password &nbsp;</p>

<p><strong>設定登入特權(enable)模式密碼</strong><br>
(Config)#enable password ccna &nbsp; &nbsp;設定明碼密碼為ccna<br>
(Config)#enable secret ccnp &nbsp; &nbsp; &nbsp; &nbsp; 設定加密密碼為ccnp<br>
*當明碼(password)和加密(secret)密碼2者都有設定時<u>優先使用secret之密碼</u></p>

<p><strong>取消登入特權(enable)模式密碼</strong><br>
(Config)#no enable password<br>
(Config)#no enable secret</p>

<p><strong>設定遠端登入(Virtual type terminal, vty)密碼</strong><br>
*開啟vty登入需先設定登入enable模式密碼，否則登入後將無法進入enable模式<br>
(config)#line vty ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 查看vty可連線數量(系統預設0-15)<br>
(config)#line vty 0 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;開啟0~4vty連線(即最大連線人數5人)<br>
(config-line)#password ccnb &nbsp; &nbsp;設定密碼為ccnb<br>
(config-line)#login &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;啟用密碼</p>

<p><strong>取消遠端登入(Virtual type terminal, vty)密碼</strong><br>
(config)#line vty 0 4<br>
(config-line)#no password</p>

<p><strong>設定Console連線逾時時間</strong><br>
(config)#line console 0<br>
(config-line)#exec-time 00 00 &nbsp;設定永不逾時<br>
(config-line)#exec-time 02&nbsp;30 &nbsp;設定逾時時間為2:30</p>

<p><strong>防止跳出控制台訊息</strong><br>
(config)#line console 0<br>
(config-line)#logging synchronous</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45217572">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45217572"></div>]]></content:encoded>
      <pubDate>Fri, 31 Mar 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45217572#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Cisco基本指令-tftp備份、還原與升級]]></title>
      <link>https://david50.pixnet.net/blog/post/45253824</link>
      <guid>https://david50.pixnet.net/blog/post/45253824</guid>
      <description><![CDATA[TFTP是一種簡單型FTP服務，和FTP一樣可作為檔案傳輸用，FTP是使用TCP協定傳輸，而TFTP是使用UDP，因此TFTP不需經過驗證，通常用於網路設備之間的檔案傳輸，我們可使用TFTP更新網路設備的韌體(Firmware)或設定。

在PacketTracert新增TFTP Server



在左下角之"End Device"選擇"Server PT"，設定好IP後和R1連線即可。



將設定檔備份至TFTP伺服器

R1#copy running-config tftp                        #將設定檔備份至TFTP伺服器
Address or name of remote host []? 192.168.0.254   #輸入TFTP伺服器IP
Destination filename [R1-confg]?&nbsp;                  #輸入要存檔之檔名，若不輸作即使用預設檔名(R1-confg)

Writing running-config....!!
[OK - 415 bytes]

415 bytes copied in 3.033 secs (136 bytes/sec)     #備份完成



在"Services"標纖的TFTP服務中即可看到剛才上傳的設定檔

將設定檔由TFTP還原

R1#copy tftp: running-config&nbsp;                     #將設定檔由TFTP伺服器還原
Address or name of remote host []? 192.168.0.254  #輸入TFTP伺服器IP
Source filename []? R1-confg                      #輸入要伺服器端之檔名
Destination filename [running-config]?&nbsp;           #詢問是否要覆蓋目前設定檔(running-config)

Accessing tftp://192.168.0.254/R1-confg....
Loading R1-confg from 192.168.0.254: !
[OK - 415 bytes]

415 bytes copied in 3.014 secs (137 bytes/sec)    #還原完成

備份Cisco設備之IOS至TFTP伺服器

查看目前IOS版本：show version

R1&gt;show version&nbsp;                         #查看目前ISO版本
Cisco IOS Software, 1841 Software (C1841-IPBASE-M), Version 12.3(14)T7, RELEASE SOFTWARE (fc2)  #目前載入的IOS版本為12.3(14)T7
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
Compiled Mon 15-May-06 14:54 by pt_team

ROM: System Bootstrap, Version 12.3(8r)T8, RELEASE SOFTWARE (fc1)

System returned to ROM by power-on
System image file is "flash:c1841-ipbase-mz.123-14.T7.bin"   #影像檔檔名為"c1841-ipbase-mz.123-14.T7.bin"


在檔名前有看到"flash:"代表這個影像檔是存放於flash內

查看flahs內容：show flash:

R1#show flash:&nbsp;

System flash directory:
File &nbsp;Length &nbsp; Name/status
&nbsp; 3 &nbsp; 13832032 c1841-ipbase-mz.123-14.T7.bin               #目前IOS的影像檔就在這
&nbsp; 2 &nbsp; 28282 &nbsp; &nbsp;sigdef-category.xml
&nbsp; 1 &nbsp; 227537 &nbsp; sigdef-default.xml
[13832032 bytes used, 50184352 available, 64016384 total]  #目前已使用了約13.8M,還剩約50M容量可用,flash總容量為約64M
63488K bytes of processor board System flash (Read/Write)

備份IOS至TFTP Server

R1#copy flash: tftp                                         #將IOS備份至TFTP Server
Source filename []? c1841-ipbase-mz.123-14.T7.bin           #輸入要備份影像檔之檔名(大小寫需一致)
Address or name of remote host []? 192.168.0.254            #輸入TFTP伺服器IP
Destination filename [c1841-ipbase-mz.123-14.T7.bin]? c1841-ipbase-mz.123-14.T7.mybackup.bin
                                                            #輸入要存檔之檔名，若不輸入即使用原檔名
Writing c1841-ipbase-mz.123-14.T7.bin...!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 13832032 bytes]

13832032 bytes copied in 0.212 secs (4467594 bytes/sec)   #備份完成


&nbsp;



檔案已上傳至TFTP Server上了



在TFTP Server上發現了新的ISO版本的影像檔

從TFTP Server更新IOS版本

R1#copy tftp flash:&nbsp;                                           #將新的影像檔下載至flash
Address or name of remote host []? 192.168.0.254               #輸入IP
Source filename []? c1841-advipservicesk9-mz.124-15.T1.bin     #輸入要下載影像檔之檔名(大小寫需一致)
Destination filename [c1841-advipservicesk9-mz.124-15.T1.bin]?&nbsp;#輸入要存檔之檔名，若不輸入即使用原檔名

Accessing tftp://192.168.0.254/c1841-advipservicesk9-mz.124-15.T1.bin...
Loading c1841-advipservicesk9-mz.124-15.T1.bin from 192.168.0.254: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 33591768 bytes]

33591768 bytes copied in 0.517 secs (6822044 bytes/sec)        #下載完成


查看下載下來之影像檔

R1#show flash:&nbsp;

System flash directory:
File &nbsp;Length &nbsp; Name/status
&nbsp; 4 &nbsp; 33591768 c1841-advipservicesk9-mz.124-15.T1.bin       #檔案已下載下來了
&nbsp; 3 &nbsp; 13832032 c1841-ipbase-mz.123-14.T7.bin
&nbsp; 2 &nbsp; 28282 &nbsp; &nbsp;sigdef-category.xml
&nbsp; 1 &nbsp; 227537 &nbsp; sigdef-default.xml
[47679619 bytes used, 16336765 available, 64016384 total]
63488K bytes of processor board System flash (Read/Write)

指定開機影像檔

R1#configure terminal&nbsp;                                       #進任全域模式
Enter configuration commands, one per line. &nbsp;End with CNTL/Z.
R1(config)#boot system flash c1841-advipservicesk9-mz.124-15.T1.bin
R1(config)#exit                                              #切換回enable模式
%SYS-5-CONFIG_I: Configured from console by console

R1#write&nbsp;                                                    #存檔
Building configuration...
[OK]
R1#reload&nbsp;                                                   #重新開機
Proceed with reload? [confirm]
System Bootstrap, Version 12.3(8r)T8, RELEASE SOFTWARE (fc1)
Initializing memory for ECC
..
c2811 processor with 524288 Kbytes of main memory
Main memory is configured to 64 bit mode with ECC enabled

Readonly ROMMON initialized

Self decompressing the image :
########################################################################## [OK]
(略)
R1&gt;enable                                                    #進入enable模式
R1#sho
R1#show version&nbsp;                                             #查看目前版本
Cisco IOS Software, 1841 Software (C1841-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2)  #IOS版本更新為12.4(15)T1
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 18-Jul-07 04:52 by pt_team

ROM: System Bootstrap, Version 12.3(8r)T8, RELEASE SOFTWARE (fc1)

System returned to ROM by power-on
System image file is "flash:c1841-advipservicesk9-mz.124-15.T1.bin"                                       #影像檔也更新了


刪除不需要的影像檔

R1#show flash:&nbsp;                                            #列出flash內之檔案

System flash directory:
File &nbsp;Length &nbsp; Name/status
&nbsp; 4 &nbsp; 33591768 c1841-advipservicesk9-mz.124-15.T1.bin
&nbsp; 3 &nbsp; 13832032 c1841-ipbase-mz.123-14.T7.bin               #要刪除舊版之影像檔
&nbsp; 2 &nbsp; 28282 &nbsp; &nbsp;sigdef-category.xml
&nbsp; 1 &nbsp; 227537 &nbsp; sigdef-default.xml
[47679619 bytes used, 16336765 available, 64016384 total]
63488K bytes of processor board System flash (Read/Write)


R1#delete flash: c1841-ipbase-mz.123-14.T7.bin             #flash:後不可有空格，有空格會出現錯誤訊息
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^
% Invalid input detected at '^' marker.
&nbsp;&nbsp; &nbsp;
R1#delete flash:c1841-ipbase-mz.123-14.T7.bin              #刪除檔案(大小寫需一致)
Delete filename [c1841-ipbase-mz.123-14.T7.bin]?           #確認刪除檔案
Delete flash:/c1841-ipbase-mz.123-14.T7.bin? [confirm]     #再次確認

R1#show flash:&nbsp;                                            #再列出flash內之檔案

System flash directory:
File &nbsp;Length &nbsp; Name/status
&nbsp; 4 &nbsp; 33591768 c1841-advipservicesk9-mz.124-15.T1.bin      #舊版影像檔已被刪除
&nbsp; 2 &nbsp; 28282 &nbsp; &nbsp;sigdef-category.xml
&nbsp; 1 &nbsp; 227537 &nbsp; sigdef-default.xml
[33847587 bytes used, 30168797 available, 64016384 total]
63488K bytes of processor board System flash (Read/Write)
]]></description>
      <content:encoded><![CDATA[<p>TFTP是一種簡單型FTP服務，和FTP一樣可作為檔案傳輸用，FTP是使用TCP協定傳輸，而TFTP是使用UDP，因此TFTP不需經過驗證，通常用於網路設備之間的檔案傳輸，我們可使用TFTP更新網路設備的韌體(Firmware)或設定。</p>

<p><strong>在PacketTracert新增TFTP Server</strong></p>

<p><img alt="pt-server.JPG" src="https://pic.pimg.tw/david50/1503455791-3697615618.jpg?v=1503455860" title="pt-server.JPG"></p>

<p>在左下角之"End Device"選擇"Server PT"，設定好IP後和R1連線即可。</p>

<p><img alt="tftp.JPG" src="https://pic.pimg.tw/david50/1503454763-673916729_n.jpg?v=1503454779" title="tftp.JPG"></p>

<p><strong>將設定檔備份至TFTP伺服器</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">R1#copy running-config tftp                        #將設定檔備份至TFTP伺服器
Address or name of remote host []? 192.168.0.254   #輸入TFTP伺服器IP
Destination filename [R1-confg]?&nbsp;                  #輸入要存檔之檔名，若不輸作即使用預設檔名(R1-confg)

Writing running-config....!!
[OK - 415 bytes]

415 bytes copied in 3.033 secs (136 bytes/sec)     #備份完成</pre>

<p><img alt="pt-server-1.JPG" src="https://pic.pimg.tw/david50/1503455793-2823827240_n.jpg?v=1503455860" title="pt-server-1.JPG"></p>

<p>在"Services"標纖的TFTP服務中即可看到剛才上傳的設定檔</p>

<p><strong>將設定檔由TFTP還原</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">R1#copy tftp: running-config&nbsp;                     #將設定檔由TFTP伺服器還原
Address or name of remote host []? 192.168.0.254  #輸入TFTP伺服器IP
Source filename []? R1-confg                      #輸入要伺服器端之檔名
Destination filename [running-config]?&nbsp;           #詢問是否要覆蓋目前設定檔(running-config)

Accessing tftp://192.168.0.254/R1-confg....
Loading R1-confg from 192.168.0.254: !
[OK - 415 bytes]

415 bytes copied in 3.014 secs (137 bytes/sec)    #還原完成</pre>

<p><strong>備份Cisco設備之IOS至TFTP伺服器</strong></p>

<p><strong>查看目前IOS版本：show version</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">R1&gt;show version&nbsp;                         #查看目前ISO版本
Cisco IOS Software, 1841 Software (C1841-IPBASE-M), <span style="color:#FF0000">Version 12.3(14)T7</span>, RELEASE SOFTWARE (fc2)  #目前載入的IOS版本為12.3(14)T7
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
Compiled Mon 15-May-06 14:54 by pt_team

ROM: System Bootstrap, Version 12.3(8r)T8, RELEASE SOFTWARE (fc1)

System returned to ROM by power-on
System image file is "<span style="color:#FF0000">flash:c1841-ipbase-mz.123-14.T7.bin</span>"   #影像檔檔名為"<span style="color:#000000">c1841-ipbase-mz.123-14.T7.bin</span>"
</pre>

<p>在檔名前有看到"<strong>flash:</strong>"代表這個影像檔是存放於flash內</p>

<p>查看flahs內容：show flash:</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">R1#show flash:&nbsp;

System flash directory:
File &nbsp;Length &nbsp; Name/status
&nbsp; 3 &nbsp; 13832032 c1841-ipbase-mz.123-14.T7.bin               #目前IOS的影像檔就在這
&nbsp; 2 &nbsp; 28282 &nbsp; &nbsp;sigdef-category.xml
&nbsp; 1 &nbsp; 227537 &nbsp; sigdef-default.xml
[<span style="color:#FCA544">13832032</span> bytes used, <span style="color:#51BAD7">50184352</span> available, <span style="color:#46871A">64016384</span> total]  #目前已使用了約<span style="color:#FCA544">13.8M</span>,還剩約<span style="color:#51BAD7">50M</span>容量可用,flash總容量為約<span style="color:#46871A">64M</span>
63488K bytes of processor board System flash (Read/Write)</pre>

<p><strong>備份IOS至TFTP Server</strong></p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">R1#copy flash: tftp                                         #將IOS備份至TFTP Server
Source filename []? c1841-ipbase-mz.123-14.T7.bin           #輸入要備份影像檔之檔名(大小寫需一致)
Address or name of remote host []? 192.168.0.254            #輸入TFTP伺服器IP
Destination filename [c1841-ipbase-mz.123-14.T7.bin]? c1841-ipbase-mz.123-14.T7.mybackup.bin
                                                            #輸入要存檔之檔名，若不輸入即使用原檔名
Writing c1841-ipbase-mz.123-14.T7.bin...!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 13832032 bytes]

13832032 bytes copied in 0.212 secs (4467594 bytes/sec)   #備份完成
</pre>

<p>&nbsp;</p>

<p><img alt="pt-server-1.JPG" src="https://pic.pimg.tw/david50/1503455793-2823827240_n.jpg?v=1503469759" title="pt-server-1.JPG"></p>

<p>檔案已上傳至TFTP Server上了</p>

<p><img alt="tftp3.JPG" src="https://pic.pimg.tw/david50/1503470194-2472798320_n.jpg?v=1503470224" title="tftp3.JPG"></p>

<p>在TFTP Server上發現了新的ISO版本的影像檔</p>

<p>從TFTP Server更新IOS版本</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">R1#copy tftp flash:&nbsp;                                           #將新的影像檔下載至flash
Address or name of remote host []? 192.168.0.254               #輸入IP
Source filename []? c1841-advipservicesk9-mz.124-15.T1.bin     #輸入要下載影像檔之檔名(大小寫需一致)
Destination filename [c1841-advipservicesk9-mz.124-15.T1.bin]?&nbsp;#輸入要存檔之檔名，若不輸入即使用原檔名

Accessing tftp://192.168.0.254/c1841-advipservicesk9-mz.124-15.T1.bin...
Loading c1841-advipservicesk9-mz.124-15.T1.bin from 192.168.0.254: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 33591768 bytes]

33591768 bytes copied in 0.517 secs (6822044 bytes/sec)        #下載完成
</pre>

<p>查看下載下來之影像檔</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">R1#show flash:&nbsp;

System flash directory:
File &nbsp;Length &nbsp; Name/status
&nbsp; 4 &nbsp; 33591768 c1841-advipservicesk9-mz.124-15.T1.bin       #檔案已下載下來了
&nbsp; 3 &nbsp; 13832032 c1841-ipbase-mz.123-14.T7.bin
&nbsp; 2 &nbsp; 28282 &nbsp; &nbsp;sigdef-category.xml
&nbsp; 1 &nbsp; 227537 &nbsp; sigdef-default.xml
[47679619 bytes used, 16336765 available, 64016384 total]
63488K bytes of processor board System flash (Read/Write)</pre>

<p>指定開機影像檔</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">R1#configure terminal&nbsp;                                       #進任全域模式
Enter configuration commands, one per line. &nbsp;End with CNTL/Z.
R1(config)#boot system flash c1841-advipservicesk9-mz.124-15.T1.bin
R1(config)#exit                                              #切換回enable模式
%SYS-5-CONFIG_I: Configured from console by console

R1#write&nbsp;                                                    #存檔
Building configuration...
[OK]
R1#reload&nbsp;                                                   #重新開機
Proceed with reload? [confirm]
System Bootstrap, Version 12.3(8r)T8, RELEASE SOFTWARE (fc1)
Initializing memory for ECC
..
c2811 processor with 524288 Kbytes of main memory
Main memory is configured to 64 bit mode with ECC enabled

Readonly ROMMON initialized

Self decompressing the image :
########################################################################## [OK]
(略)
R1&gt;enable                                                    #進入enable模式
R1#sho
R1#show version&nbsp;                                             #查看目前版本
Cisco IOS Software, 1841 Software (C1841-ADVIPSERVICESK9-M), <span style="color:#FF0000">Version 12.4(15)T1</span>, RELEASE SOFTWARE (fc2)  #IOS版本更新為12.4(15)T1
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 18-Jul-07 04:52 by pt_team

ROM: System Bootstrap, Version 12.3(8r)T8, RELEASE SOFTWARE (fc1)

System returned to ROM by power-on
System image file is "<span style="color:#FF0000">flash:c1841-advipservicesk9-mz.124-15.T1.bin</span>"                                       #影像檔也更新了
</pre>

<p>刪除不需要的影像檔</p>

<pre class="notranslate" style="font-family: Consolas, &quot;Liberation Mono&quot;, Courier, monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; border: 1px dashed rgb(204, 204, 204); padding: 6px 10px; line-height: 19px; margin-bottom: 20px; color: rgb(51, 51, 51); background: rgb(248, 248, 248); border-radius: 3px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">R1#show flash:&nbsp;                                            #列出flash內之檔案

System flash directory:
File &nbsp;Length &nbsp; Name/status
&nbsp; 4 &nbsp; 33591768 c1841-advipservicesk9-mz.124-15.T1.bin
&nbsp; 3 &nbsp; 13832032 c1841-ipbase-mz.123-14.T7.bin               #要刪除舊版之影像檔
&nbsp; 2 &nbsp; 28282 &nbsp; &nbsp;sigdef-category.xml
&nbsp; 1 &nbsp; 227537 &nbsp; sigdef-default.xml
[47679619 bytes used, 16336765 available, 64016384 total]
63488K bytes of processor board System flash (Read/Write)


R1#delete flash: c1841-ipbase-mz.123-14.T7.bin             #flash:後不可有空格，有空格會出現錯誤訊息
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^
% Invalid input detected at '^' marker.
&nbsp;&nbsp; &nbsp;
R1#delete flash:c1841-ipbase-mz.123-14.T7.bin              #刪除檔案(大小寫需一致)
Delete filename [c1841-ipbase-mz.123-14.T7.bin]?           #確認刪除檔案
Delete flash:/c1841-ipbase-mz.123-14.T7.bin? [confirm]     #再次確認

R1#show flash:&nbsp;                                            #再列出flash內之檔案

System flash directory:
File &nbsp;Length &nbsp; Name/status
&nbsp; 4 &nbsp; 33591768 c1841-advipservicesk9-mz.124-15.T1.bin      #舊版影像檔已被刪除
&nbsp; 2 &nbsp; 28282 &nbsp; &nbsp;sigdef-category.xml
&nbsp; 1 &nbsp; 227537 &nbsp; sigdef-default.xml
[33847587 bytes used, 30168797 available, 64016384 total]
63488K bytes of processor board System flash (Read/Write)</pre>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45253824">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45253824"></div>]]></content:encoded>
      <pubDate>Mon, 27 Mar 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45253824#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Cisco交換器/路由器開機流程]]></title>
      <link>https://david50.pixnet.net/blog/post/45215079</link>
      <guid>https://david50.pixnet.net/blog/post/45215079</guid>
      <description><![CDATA[

&nbsp;


	當Router/Switch通電後會先做POST(Power on Self Test)
	Bootstrap
	尋找IOS檔案
	Flash
	開機區程式儲存於唯讀記憶體 ROM 中，它會到 Flash Memory 去尋找 Cisco IOS 軟體來載入，若找不到IOS檔案，則執行mini IOS，進入ROM Monitor模式
	NVRAM(Non-Violatile Random Access Memory)
	NVRAM中若沒有設定檔➔進入配裝模式(Setup Mode)


&nbsp;
]]></description>
      <content:encoded><![CDATA[<p><img alt="Cisco_Bootup-1.jpg" src="https://pic.pimg.tw/david50/1502246877-1121715495_n.jpg?v=1502246885" title="Cisco_Bootup-1.jpg"></p>

<p>&nbsp;</p>

<ol>
	<li>當Router/Switch通電後會先做POST(Power on Self Test)</li>
	<li>Bootstrap<br>
	尋找IOS檔案</li>
	<li>Flash<br>
	開機區程式儲存於唯讀記憶體 ROM 中，它會到 Flash Memory 去尋找 Cisco IOS 軟體來載入，若找不到IOS檔案，則執行mini IOS，進入ROM Monitor模式</li>
	<li>NVRAM(Non-Violatile Random Access Memory)<br>
	NVRAM中若沒有設定檔➔進入配裝模式(Setup Mode)</li>
</ol>

<p>&nbsp;</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45215079">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45215079"></div>]]></content:encoded>
      <pubDate>Fri, 24 Mar 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45215079#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]IPv4 Submask計算]]></title>
      <link>https://david50.pixnet.net/blog/post/45215556</link>
      <guid>https://david50.pixnet.net/blog/post/45215556</guid>
      <description><![CDATA[之前學CCNA時每次遇到計算遮罩都讓我很頭大
今天上課學到的再配合同學提供的方法真的讓我解決了煩腦已久的問題了
今天一定要把這方法記錄起來
避免下次要用時忘了就麻煩了&nbsp;


我們常會在查看IP時看到像這樣的表示法：192.168.3.12/24
這/24是以2進位表示有24個1,以10進位則是以255.255.255.0來表示
在計算時如果/後之數字是在24-32即用32去減/後之數字，16-24即用24去減/後之數字，8-16即用16/後之數字，0-8即用8/後之數字
如數字為8即遮罩為：255.0.0.0，16即遮罩為：255.255.0.0，24即遮罩為：255.255.255.0，32即遮罩為：255.255.255.255(當然這不可能出現啦)

例1：
192.168.3.73/27
32 -&nbsp;27&nbsp;=&nbsp;5
25 = 16 &nbsp;將所得之數*2
16&nbsp;* 2 =32 &nbsp;此即為每段之IP數量
256 - 32&nbsp;= 224 =&gt;Submask:&nbsp;&nbsp;255.255.255.224
若要計算73的Network ID及廣播位址
73 / 32 = 2.xxx
32 * 2 = 64 =&gt; Network ID: 192.168.3.64
64 + (32-1) = 95 =&gt;Broadcast: 192.168.3.95

例2：
172.16.223.56/20
24 - 20 = 4
24 = 8&nbsp;&nbsp;將所得之數*2
8&nbsp;* 2 =16
256 - 16&nbsp;= 224 =&gt;Submask:&nbsp;&nbsp;255.255.240.0
若要計算223的Network ID及廣播位址
223 / 16 = 13.xxx
16 * 13 = 208 =&gt; Network ID: 172.16.208.0
208 + (16-1) = 223&nbsp;=&gt;Broadcast: 172.16.223.255

例3：
10.195.123.45/10
16 - 10 = 6
26 = 32&nbsp;&nbsp;將所得之數*2
32&nbsp;* 2 =64
256 - 64&nbsp;= 192&nbsp;=&gt;Submask:&nbsp;&nbsp;255.192.0.0
若要計算195的Network ID及廣播位址
195 / 64 = 3.xxx
64 * 3 = 192&nbsp;=&gt; Network ID: 10.192.0.0
192&nbsp;+ (64-1) = 255&nbsp;=&gt;Broadcast: 10.255.255.255

例4：
115.86.186.97/4
8&nbsp;- 4&nbsp;= 4
24 = 8&nbsp;&nbsp;將所得之數*2
8&nbsp;* 2 =16
256 - 16&nbsp;= 240&nbsp;=&gt;Submask:&nbsp;&nbsp;240.0.0.0
若要計算115的Network ID及廣播位址
115&nbsp;/ 16&nbsp;= 7.xxx
16&nbsp;* 7 = 112&nbsp;=&gt; Network ID: 112.0.0.0
112&nbsp;+ (16-1) = 127&nbsp;=&gt;Broadcast: 127.255.255.255
]]></description>
      <content:encoded><![CDATA[<p>之前學CCNA時每次遇到計算遮罩都讓我很頭大<br>
今天上課學到的再配合同學提供的方法真的讓我解決了煩腦已久的問題了<br>
今天一定要把這方法記錄起來<br>
避免下次要用時忘了就麻煩了&nbsp;<img alt="" height="19" src="//s.pixfs.net/f.pixnet.net/images/emotions/tounge_smile.gif" title="" width="19"></p>

<hr>
<p>我們常會在查看IP時看到像這樣的表示法：192.168.3.12/24<br>
這/24是以2進位表示有24個1,以10進位則是以255.255.255.0來表示<br>
在計算時如果/後之數字是在24-32即用32去減/後之數字，16-24即用24去減/後之數字，8-16即用16/後之數字，0-8即用8/後之數字<br>
如數字為8即遮罩為：255.0.0.0，16即遮罩為：255.255.0.0，24即遮罩為：255.255.255.0，32即遮罩為：255.255.255.255(當然這不可能出現啦<img alt="" height="19" src="//s.pixfs.net/f.pixnet.net/images/emotions/tounge_smile.gif" title="" width="19">)</p>

<p>例1：<br>
192.168.3.73/<span style="color:#FF0000">27</span><br>
32 -&nbsp;<span style="color:#FF0000">27&nbsp;</span>=&nbsp;<span style="color:#FCA544">5</span><br>
<span lang="EN-US" style="font-family:calibri,sans-serif; font-size:12.0pt; mso-ansi-language:EN-US; mso-ascii-theme-font:minor-latin; mso-bidi-font-family:&quot;Times New Roman&quot;; mso-bidi-font-size:11.0pt; mso-bidi-language:AR-SA; mso-bidi-theme-font:minor-bidi; mso-fareast-font-family:新細明體; mso-fareast-language:ZH-TW; mso-fareast-theme-font:minor-fareast; mso-hansi-theme-font:minor-latin">2<span style="color:#FCA544"><sup>5</sup></span></span> = <span style="color:#00FFFF">16 &nbsp;</span><span style="color:#000000">將所得之數*2</span><br>
<span style="color:#00FFFF">16</span>&nbsp;* 2 =<span style="color:#00FF00">32 &nbsp;</span><span style="color:#000000">此即為每段之IP數量</span><br>
256 - <span style="color:#00FF00">32</span>&nbsp;= 224 =&gt;Submask:&nbsp;&nbsp;255.255.255.224<br>
若要計算73的Network ID及廣播位址<br>
73 / <span style="color:#00FF00">32</span> = <span style="color:#FF00FF">2</span>.xxx<br>
<span style="color:#00FF00">32</span> * <span style="color:#FF00FF">2</span> = <span style="color:#0000FF">64</span> =&gt; Network ID: 192.168.3.<span style="color:#0000FF">64</span><br>
<span style="color:#0000FF">64</span> + (<span style="color:#00FF00">32</span>-1) = <span style="color:#BBABEA">95</span> =&gt;Broadcast: 192.168.3.<span style="color:#BBABEA">95</span></p>

<p>例2：<br>
172.16.223.56/<span style="color:#FF0000">20</span><br>
24 - <span style="color:#FF0000">20</span> = <span style="color:#FCA544">4</span><br>
<span><span style="font-size:12.0pt"><span style="font-family:calibri,sans-serif">2<span style="color:#FCA544"><sup>4</sup></span></span></span></span> = <span style="color:#00FFFF">8&nbsp;&nbsp;</span><span style="color:#000000">將所得之數*2</span><br>
<span style="color:#00FFFF">8</span>&nbsp;* 2 =<span style="color:#00FF00">16</span><br>
256 - <span style="color:#00FF00">16</span>&nbsp;= 224 =&gt;Submask:&nbsp;&nbsp;255.255.240.0<br>
若要計算223的Network ID及廣播位址<br>
223 / <span style="color:#00FF00">16</span> = <span style="color:#FF00FF">13</span>.xxx<br>
<span style="color:#00FF00">16</span> * <span style="color:#FF00FF">13</span> = <span style="color:#0000FF">208</span> =&gt; Network ID: 172.16.<span style="color:#0000FF">208</span>.0<br>
<span style="color:#0000FF">208</span> + (<span style="color:#00FF00">16</span>-1) = <span style="color:#BBABEA">223</span>&nbsp;=&gt;Broadcast: 172.16.<span style="color:#BBABEA">223</span>.255</p>

<p>例3：<br>
10.195.123.45/10<br>
16 - 10 = 6<br>
<span><span style="font-size:12.0pt"><span style="font-family:calibri,sans-serif">2<span style="color:#FCA544"><sup>6</sup></span></span></span></span> = <span style="color:#00FFFF">32&nbsp;&nbsp;</span><span style="color:#000000">將所得之數*2</span><br>
<span style="color:#00FFFF">32</span>&nbsp;* 2 =<span style="color:#00FF00">64</span><br>
256 - <span style="color:#00FF00">64</span>&nbsp;= 192&nbsp;=&gt;Submask:&nbsp;&nbsp;255.192.0.0<br>
若要計算195的Network ID及廣播位址<br>
195 / <span style="color:#00FF00">64</span> = <span style="color:#FF00FF">3</span>.xxx<br>
<span style="color:#00FF00">64</span> * <span style="color:#FF00FF">3</span> = <span style="color:#0000FF">192</span>&nbsp;=&gt; Network ID: 10.<span style="color:#0000FF">192</span>.0.0<br>
<span style="color:#0000FF">192</span>&nbsp;+ (<span style="color:#00FF00">64</span>-1) = <span style="color:#BBABEA">255</span>&nbsp;=&gt;Broadcast: 10.<span style="color:#BBABEA">255</span>.255.255</p>

<p>例4：<br>
115.86.186.97/4<br>
8&nbsp;- 4&nbsp;= 4<br>
<span><span style="font-size:12.0pt"><span style="font-family:calibri,sans-serif">2<span style="color:#FCA544"><sup>4</sup></span></span></span></span> = <span style="color:#00FFFF">8&nbsp;&nbsp;</span><span style="color:#000000">將所得之數*2</span><br>
<span style="color:#00FFFF">8</span>&nbsp;* 2 =<span style="color:#00FF00">16</span><br>
256 - <span style="color:#00FF00">16</span>&nbsp;= 240&nbsp;=&gt;Submask:&nbsp;&nbsp;240.0.0.0<br>
若要計算115的Network ID及廣播位址<br>
115&nbsp;/ <span style="color:#00FF00">16</span>&nbsp;= <font color="#ff00ff">7</font>.xxx<br>
<span style="color:#00FF00">16</span>&nbsp;* <span style="color:#FF00FF">7</span> = <span style="color:#0000FF">112</span>&nbsp;=&gt; Network ID: <span style="color:#0000FF">112</span>.0.0.0<br>
<span style="color:#0000FF">112</span>&nbsp;+ (<span style="color:#00FF00">16</span>-1) = <span style="color:#BBABEA">127</span>&nbsp;=&gt;Broadcast: <span style="color:#BBABEA">127</span>.255.255.255</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45215556">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45215556"></div>]]></content:encoded>
      <pubDate>Fri, 17 Mar 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45215556#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]連接埠分類及常用連接埠]]></title>
      <link>https://david50.pixnet.net/blog/post/45212784</link>
      <guid>https://david50.pixnet.net/blog/post/45212784</guid>
      <description><![CDATA[IP:負責把資料送到正確的主機

TCP/UDP:負把把資料送到正確的程序(程式)
TCP:可靠傳輸
UDP:不可靠傳輸

Well-known 公認埠： 0 ~ 1023

Regirered Port 註冊埠：1024 ~ 49151

Dynamic Port 動態埠：49152 ~ 65535

常用的連接埠


	
		
			連接埠編號
			名稱
		
		
			20
			FTP-data
		
		
			21
			FTP
		
		
			22
			SSH
		
		
			23
			Telnet
		
		
			25
			smtp
		
		
			42
			nameserver
		
		
			53
			DNS
		
		
			63
			WHOIS++
		
		
			67
			Bootstrap Protocol Serve(DHCP)
		
		
			68
			Bootstrap Protocol Client(DHCP)
		
		
			69
			TFTP
		
		
			80
			http
		
		
			110
			POP3
		
		
			115
			SFTP
		
		
			123
			NTP
		
		
			143
			IMAP
		
		
			161,162
			SNMP
		
		
			389
			LDAP
		
		
			443
			https
		
		
			445
			SMB
		
		
			456
			DHCPv6-Client
		
		
			457
			DHCPv6-Server
		
		
			636
			LDAPs
		
		
			873
			rsync
		
		
			995
			POP3s
		
	


如需更詳盡資訊可至IANA查詢哦!&nbsp;

&nbsp;
]]></description>
      <content:encoded><![CDATA[<p>IP:負責把資料送到正確的主機</p>

<p>TCP/UDP:負把把資料送到正確的程序(程式)<br>
TCP:可靠傳輸<br>
UDP:不可靠傳輸</p>

<p>Well-known 公認埠： 0 ~ 1023</p>

<p>Regirered Port 註冊埠：1024 ~ 49151</p>

<p>Dynamic Port 動態埠：49152 ~ 65535</p>

<p>常用的連接埠</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:400px">
	<tbody>
		<tr>
			<td style="text-align: center;">連接埠編號</td>
			<td style="text-align: center;">名稱</td>
		</tr>
		<tr>
			<td style="text-align: center;">20</td>
			<td>FTP-data</td>
		</tr>
		<tr>
			<td style="text-align: center;">21</td>
			<td>FTP</td>
		</tr>
		<tr>
			<td style="text-align: center;">22</td>
			<td>SSH</td>
		</tr>
		<tr>
			<td style="text-align: center;">23</td>
			<td>Telnet</td>
		</tr>
		<tr>
			<td style="text-align: center;">25</td>
			<td>smtp</td>
		</tr>
		<tr>
			<td style="text-align: center;">42</td>
			<td>nameserver</td>
		</tr>
		<tr>
			<td style="text-align: center;">53</td>
			<td>DNS</td>
		</tr>
		<tr>
			<td style="text-align: center;">63</td>
			<td>WHOIS++</td>
		</tr>
		<tr>
			<td style="text-align: center;">67</td>
			<td>Bootstrap Protocol Serve(DHCP)</td>
		</tr>
		<tr>
			<td style="text-align: center;">68</td>
			<td>Bootstrap Protocol Client(DHCP)</td>
		</tr>
		<tr>
			<td style="text-align: center;">69</td>
			<td>TFTP</td>
		</tr>
		<tr>
			<td style="text-align: center;">80</td>
			<td>http</td>
		</tr>
		<tr>
			<td style="text-align: center;">110</td>
			<td>POP3</td>
		</tr>
		<tr>
			<td style="text-align: center;">115</td>
			<td>SFTP</td>
		</tr>
		<tr>
			<td style="text-align: center;">123</td>
			<td>NTP</td>
		</tr>
		<tr>
			<td style="text-align: center;">143</td>
			<td>IMAP</td>
		</tr>
		<tr>
			<td style="text-align: center;">161,162</td>
			<td>SNMP</td>
		</tr>
		<tr>
			<td style="text-align: center;">389</td>
			<td>LDAP</td>
		</tr>
		<tr>
			<td style="text-align: center;">443</td>
			<td>https</td>
		</tr>
		<tr>
			<td style="text-align: center;">445</td>
			<td>SMB</td>
		</tr>
		<tr>
			<td style="text-align: center;">456</td>
			<td>DHCPv6-Client</td>
		</tr>
		<tr>
			<td style="text-align: center;">457</td>
			<td>DHCPv6-Server</td>
		</tr>
		<tr>
			<td style="text-align: center;">636</td>
			<td>LDAPs</td>
		</tr>
		<tr>
			<td style="text-align: center;">873</td>
			<td>rsync</td>
		</tr>
		<tr>
			<td style="text-align: center;">995</td>
			<td>POP3s</td>
		</tr>
	</tbody>
</table>

<p>如需更詳盡資訊可至<a href="http://www.iana.org/assignments/port-numbers" target="_blank">IANA</a>查詢哦!&nbsp;<img alt="" height="19" src="//s.pixfs.net/f.pixnet.net/images/emotions/wink_smile.gif" title="" width="19"></p>

<p>&nbsp;</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45212784">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45212784"></div>]]></content:encoded>
      <pubDate>Tue, 14 Mar 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[Internet]]></category>
      <comments>https://david50.pixnet.net/blog/post/45212784#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Linux時間日期變數]]></title>
      <link>https://david50.pixnet.net/blog/post/45212433</link>
      <guid>https://david50.pixnet.net/blog/post/45212433</guid>
      <description><![CDATA[之前在使用Linux做備份時一直想要以時間做為檔名
但卻一直找不到該怎麼下這個變數
今天老師終於教了時間日期的變數
一定要記下來下次就可以好好利用這功能囉 

設定時間日期變數：
time=`date +%Y%m%d-%H%M`

此時觀看變數即會出現時間及日期
$ echo $time
$ 20170308-1510

若要每日備份/etc下的資料即可在cron table中加入以下指令：
tar czf "/backup/$time-etc".tgz /etc
]]></description>
      <content:encoded><![CDATA[<p>之前在使用Linux做備份時一直想要以時間做為檔名<br>
但卻一直找不到該怎麼下這個變數<br>
今天老師終於教了時間日期的變數<br>
一定要記下來下次就可以好好利用這功能囉 <img alt="" height="19" src="//s.pixfs.net/f.pixnet.net/images/emotions/regular_smile.gif" title="" width="19"></p>

<p>設定時間日期變數：<br>
time=`date +%Y%m%d-%H%M`</p>

<p>此時觀看變數即會出現時間及日期<br>
$ echo $time<br>
$ 20170308-1510</p>

<p>若要每日備份/etc下的資料即可在cron table中加入以下指令：<br>
tar czf "/backup/$time-etc".tgz /etc</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45212433">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45212433"></div>]]></content:encoded>
      <pubDate>Wed, 08 Mar 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[Linux]]></category>
      <comments>https://david50.pixnet.net/blog/post/45212433#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]IPv6 EUI-64格式]]></title>
      <link>https://david50.pixnet.net/blog/post/45204141</link>
      <guid>https://david50.pixnet.net/blog/post/45204141</guid>
      <description><![CDATA[
	
		
			xxxx : xxxx : xxxx : xxxx :
			xxxx : xxxx : xxxx : xxxx
		
		
			Network ID
			Host
		
	


假設一MAC為: 00:10:AB:23:45:67
使用IPv6 EUI-64格式轉換後之IPv6 IP為: 0210 : ABFF : FE23 : 4567
轉換過程:


	在MAC第6個數字後加上FFFE &nbsp;=&gt; ABFF : FE23
	將第2個數字(U/L bit)以16進位展開為:0000 0000,將第7個bit做補數運算,即0變成1,1變成0 =&gt; 0000 0010
	U/L bit為0表示:全球統一管理
	U/L bit為1表示:本地自行管理


即變成: 0210 : ABFF : FE23 : 4567 EUI-64格式IPv6位址
]]></description>
      <content:encoded><![CDATA[<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<tbody>
		<tr>
			<td style="text-align: center;">xxxx : xxxx : xxxx : xxxx :</td>
			<td style="text-align: center;">xxxx : xxxx : xxxx : xxxx</td>
		</tr>
		<tr>
			<td style="text-align: center;">Network ID</td>
			<td style="text-align: center;">Host</td>
		</tr>
	</tbody>
</table>

<p>假設一MAC為: 00:10:AB:23:45:67<br>
使用IPv6 EUI-64格式轉換後之IPv6 IP為: 0<u><span style="color:#FF0000">2</span></u>10 : AB<u><span style="color:#549BED">FF</span></u> : <u><span style="color:#549BED">FE</span></u>23 : 4567<br>
轉換過程:</p>

<ol>
	<li>在MAC第6個數字後加上<span style="color:#549BED">FFFE &nbsp;</span><span style="color:#000000">=&gt; AB</span><u><span style="color:#549BED">FF</span></u><span style="color:#000000"> : </span><u><span style="color:#549BED">FE</span></u><span style="color:#000000">23</span></li>
	<li>將第2個數字(U/L bit)以16進位展開為:0000 00<span style="color:#FF0000"><u>0</u></span>0,將第7個bit做補數運算,即0變成1,1變成0 =&gt; 0000 00<span style="color:#FF0000"><u>1</u></span>0<br>
	U/L bit為0表示:全球統一管理<br>
	U/L bit為1表示:本地自行管理</li>
</ol>

<p>即變成: 0210 : ABFF : FE23 : 4567 EUI-64格式IPv6位址</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45204141">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45204141"></div>]]></content:encoded>
      <pubDate>Fri, 24 Feb 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45204141#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]電話線色碼]]></title>
      <link>https://david50.pixnet.net/blog/post/45210348</link>
      <guid>https://david50.pixnet.net/blog/post/45210348</guid>
      <description><![CDATA[纜線種類：
含金屬線：
非平衡型：銅軸電纜
平衡型：對絞電纜、星絞電纜

10P:


	
		
			對數
			芯線色碼
		
		
			1
			藍黃
		
		
			2
			綠紅
		
		
			3
			紫白
		
		
			4
			棕黑
		
	


&nbsp;

20P:


	
		
			對數
			芯線色碼
			對數
			芯線色碼
		
		
			1
			藍白
			2
			棕黑
		
		
			3
			黃白
			4
			棕黑
		
		
			5
			綠白
			6
			棕黑
		
		
			7
			紅白
			8
			棕黑
		
		
			9
			紫白
			10
			棕黑
		
	


&nbsp;

20P以上纜線需用線對內之色帶顏色做為編紮之識別

50P:


	
		
			對數
			色帶色碼
		
		
			1-10
			藍
		
		
			11-20
			黃
		
		
			21-30
			綠
		
		
			31-40
			紅
		
		
			41-50
			紫
		
	


&nbsp;

100P:


	
		
			對數
			色帶色碼
			對數
			色帶色碼
		
		
			1-10
			藍藍
			51-60
			藍白
		
		
			11-20
			黃黃
			61-70
			黃白
		
		
			21-30
			綠綠
			71-80
			綠白
		
		
			31-40
			紅紅
			81-90
			紅白
		
		
			41-50
			紫紫
			91-100
			紫白
		
	


&nbsp;

200P:


	
		
			對數
			色帶色碼
			對數
			色帶色碼
			對數
			色帶色碼
			對數
			色帶色碼
		
		
			1-10
			藍藍
			51-60
			藍白
			101-110
			藍棕
			151-160
			藍黑
		
		
			11-20
			黃黃
			61-70
			黃白
			111-120
			黃棕
			161-170
			黃黑
		
		
			21-30
			綠綠
			71-80
			綠白
			121-130
			綠棕
			171-180
			綠黑
		
		
			31-40
			紅紅
			81-90
			紅白
			131-140
			紅棕
			181-190
			紅黑
		
		
			41-50
			紫紫
			91-100
			紫白
			141-150
			紫棕
			190-200
			紫黑
		
	


&nbsp;

600P:


	
		
			對數
			色帶色碼
			對數
			色帶色碼
		
		
			1-50
			藍藍
			301-350
			黃白
		
		
			51-100
			黃黃
			351-400
			綠白
		
		
			101-150
			綠綠
			401-450
			紅白
		
		
			151-200
			紅紅
			451-500
			紫白
		
		
			201-250
			紫紫
			501-550
			藍棕
		
		
			251-300
			藍白
			551-600
			黃棕
		
	


&nbsp;
]]></description>
      <content:encoded><![CDATA[<p>纜線種類：<br>
含金屬線：<br>
非平衡型：銅軸電纜<br>
平衡型：對絞電纜、星絞電纜</p>

<p>10P:</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:100px">
	<tbody>
		<tr>
			<td style="text-align: center;">對數</td>
			<td style="text-align: center;">芯線色碼</td>
		</tr>
		<tr>
			<td style="text-align: center;">1</td>
			<td style="text-align: center;">藍黃</td>
		</tr>
		<tr>
			<td style="text-align: center;">2</td>
			<td style="text-align: center;">綠紅</td>
		</tr>
		<tr>
			<td style="text-align: center;">3</td>
			<td style="text-align: center;">紫白</td>
		</tr>
		<tr>
			<td style="text-align: center;">4</td>
			<td style="text-align: center;">棕黑</td>
		</tr>
	</tbody>
</table>

<p>&nbsp;</p>

<p>20P:</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:200px">
	<tbody>
		<tr>
			<td style="text-align: center;">對數</td>
			<td style="text-align: center;">芯線色碼</td>
			<td style="text-align: center;">對數</td>
			<td style="text-align: center;">芯線色碼</td>
		</tr>
		<tr>
			<td style="text-align: center;">1</td>
			<td style="text-align: center;">藍白</td>
			<td style="text-align: center;">2</td>
			<td style="text-align: center;">棕黑</td>
		</tr>
		<tr>
			<td style="text-align: center;">3</td>
			<td style="text-align: center;">黃白</td>
			<td style="text-align: center;">4</td>
			<td style="text-align: center;">棕黑</td>
		</tr>
		<tr>
			<td style="text-align: center;">5</td>
			<td style="text-align: center;">綠白</td>
			<td style="text-align: center;">6</td>
			<td style="text-align: center;">棕黑</td>
		</tr>
		<tr>
			<td style="text-align: center;">7</td>
			<td style="text-align: center;">紅白</td>
			<td style="text-align: center;">8</td>
			<td style="text-align: center;">棕黑</td>
		</tr>
		<tr>
			<td style="text-align: center;">9</td>
			<td style="text-align: center;">紫白</td>
			<td style="text-align: center;">10</td>
			<td style="text-align: center;">棕黑</td>
		</tr>
	</tbody>
</table>

<p>&nbsp;</p>

<p>20P以上纜線需用線對內之色帶顏色做為編紮之識別</p>

<p>50P:</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:150px">
	<tbody>
		<tr>
			<td style="text-align: center;">對數</td>
			<td style="text-align: center;">色帶色碼</td>
		</tr>
		<tr>
			<td style="text-align: center;">1-10</td>
			<td style="text-align: center;">藍</td>
		</tr>
		<tr>
			<td style="text-align: center;">11-20</td>
			<td style="text-align: center;">黃</td>
		</tr>
		<tr>
			<td style="text-align: center;">21-30</td>
			<td style="text-align: center;">綠</td>
		</tr>
		<tr>
			<td style="text-align: center;">31-40</td>
			<td style="text-align: center;">紅</td>
		</tr>
		<tr>
			<td style="text-align: center;">41-50</td>
			<td style="text-align: center;">紫</td>
		</tr>
	</tbody>
</table>

<p>&nbsp;</p>

<p>100P:</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:300px">
	<tbody>
		<tr>
			<td style="text-align: center;">對數</td>
			<td style="text-align: center;">色帶色碼</td>
			<td style="text-align: center;">對數</td>
			<td style="text-align: center;">色帶色碼</td>
		</tr>
		<tr>
			<td style="text-align: center;">1-10</td>
			<td style="text-align: center;">藍藍</td>
			<td style="text-align: center;">51-60</td>
			<td style="text-align: center;">藍白</td>
		</tr>
		<tr>
			<td style="text-align: center;">11-20</td>
			<td style="text-align: center;">黃黃</td>
			<td style="text-align: center;">61-70</td>
			<td style="text-align: center;">黃白</td>
		</tr>
		<tr>
			<td style="text-align: center;">21-30</td>
			<td style="text-align: center;">綠綠</td>
			<td style="text-align: center;">71-80</td>
			<td style="text-align: center;">綠白</td>
		</tr>
		<tr>
			<td style="text-align: center;">31-40</td>
			<td style="text-align: center;">紅紅</td>
			<td style="text-align: center;">81-90</td>
			<td style="text-align: center;">紅白</td>
		</tr>
		<tr>
			<td style="text-align: center;">41-50</td>
			<td style="text-align: center;">紫紫</td>
			<td style="text-align: center;">91-100</td>
			<td style="text-align: center;">紫白</td>
		</tr>
	</tbody>
</table>

<p>&nbsp;</p>

<p>200P:</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<tbody>
		<tr>
			<td style="text-align: center;">對數</td>
			<td style="text-align: center;">色帶色碼</td>
			<td style="text-align: center;">對數</td>
			<td style="text-align: center;">色帶色碼</td>
			<td style="text-align: center;">對數</td>
			<td style="text-align: center;">色帶色碼</td>
			<td style="text-align: center;">對數</td>
			<td style="text-align: center;">色帶色碼</td>
		</tr>
		<tr>
			<td style="text-align: center;">1-10</td>
			<td style="text-align: center;">藍藍</td>
			<td style="text-align: center;">51-60</td>
			<td style="text-align: center;">藍白</td>
			<td style="text-align: center;">101-110</td>
			<td style="text-align: center;">藍棕</td>
			<td style="text-align: center;">151-160</td>
			<td style="text-align: center;">藍黑</td>
		</tr>
		<tr>
			<td style="text-align: center;">11-20</td>
			<td style="text-align: center;">黃黃</td>
			<td style="text-align: center;">61-70</td>
			<td style="text-align: center;">黃白</td>
			<td style="text-align: center;">111-120</td>
			<td style="text-align: center;">黃棕</td>
			<td style="text-align: center;">161-170</td>
			<td style="text-align: center;">黃黑</td>
		</tr>
		<tr>
			<td style="text-align: center;">21-30</td>
			<td style="text-align: center;">綠綠</td>
			<td style="text-align: center;">71-80</td>
			<td style="text-align: center;">綠白</td>
			<td style="text-align: center;">121-130</td>
			<td style="text-align: center;">綠棕</td>
			<td style="text-align: center;">171-180</td>
			<td style="text-align: center;">綠黑</td>
		</tr>
		<tr>
			<td style="text-align: center;">31-40</td>
			<td style="text-align: center;">紅紅</td>
			<td style="text-align: center;">81-90</td>
			<td style="text-align: center;">紅白</td>
			<td style="text-align: center;">131-140</td>
			<td style="text-align: center;">紅棕</td>
			<td style="text-align: center;">181-190</td>
			<td style="text-align: center;">紅黑</td>
		</tr>
		<tr>
			<td style="text-align: center;">41-50</td>
			<td style="text-align: center;">紫紫</td>
			<td style="text-align: center;">91-100</td>
			<td style="text-align: center;">紫白</td>
			<td style="text-align: center;">141-150</td>
			<td style="text-align: center;">紫棕</td>
			<td style="text-align: center;">190-200</td>
			<td style="text-align: center;">紫黑</td>
		</tr>
	</tbody>
</table>

<p>&nbsp;</p>

<p>600P:</p>

<table border="1" cellpadding="1" cellspacing="1" style="width:300px">
	<tbody>
		<tr>
			<td style="text-align: center;">對數</td>
			<td style="text-align: center;">色帶色碼</td>
			<td style="text-align: center;">對數</td>
			<td style="text-align: center;">色帶色碼</td>
		</tr>
		<tr>
			<td style="text-align: center;">1-50</td>
			<td style="text-align: center;">藍藍</td>
			<td style="text-align: center;">301-350</td>
			<td style="text-align: center;">黃白</td>
		</tr>
		<tr>
			<td style="text-align: center;">51-100</td>
			<td style="text-align: center;">黃黃</td>
			<td style="text-align: center;">351-400</td>
			<td style="text-align: center;">綠白</td>
		</tr>
		<tr>
			<td style="text-align: center;">101-150</td>
			<td style="text-align: center;">綠綠</td>
			<td style="text-align: center;">401-450</td>
			<td style="text-align: center;">紅白</td>
		</tr>
		<tr>
			<td style="text-align: center;">151-200</td>
			<td style="text-align: center;">紅紅</td>
			<td style="text-align: center;">451-500</td>
			<td style="text-align: center;">紫白</td>
		</tr>
		<tr>
			<td style="text-align: center;">201-250</td>
			<td style="text-align: center;">紫紫</td>
			<td style="text-align: center;">501-550</td>
			<td style="text-align: center;">藍棕</td>
		</tr>
		<tr>
			<td style="text-align: center;">251-300</td>
			<td style="text-align: center;">藍白</td>
			<td style="text-align: center;">551-600</td>
			<td style="text-align: center;">黃棕</td>
		</tr>
	</tbody>
</table>

<p>&nbsp;</p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45210348">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45210348"></div>]]></content:encoded>
      <pubDate>Tue, 21 Feb 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[通信線路]]></category>
      <comments>https://david50.pixnet.net/blog/post/45210348#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]IP v4 & IP v6分類]]></title>
      <link>https://david50.pixnet.net/blog/post/45203121</link>
      <guid>https://david50.pixnet.net/blog/post/45203121</guid>
      <description><![CDATA[IP v4

私有IP位址(Private IP)：
Class A 10.0.0.0/8 (1段)

Class B 172.16.0.0/16 ~ 172.31.0.0/16 (16段)

Class C 192.168.0.0/24 ~ 192.168.255.0/24 (256段)

自動私人 IP 位址(APIPA，Automatic Private IP Addressing)
169.254.x.x/16

公有IP位址(Public IP)：
非私有IP位址均屬公有IP

IP v6

IPv6的位址依傳送方式區分為單點傳送(unicast；one-to-one)、多點傳送(multicast；one-to-many)與任一傳送(anycast；one-to-nearest)三種。

單點傳送(unicast；one-to-one)：
如同IPv4的傳輸方式，系將封包傳送給單一介面位址，適用於單一點對單一節點的資料傳送，這種類型的IPv6位址又區分為"全域單點傳播(Global Unicast)位址"、"唯一區域(Unique Local)位址"及"鏈路區域(Link-local)位址"。

全域單點傳播(Global Unicast)
可在Internet上互連之位址(類似IPv4的Public&nbsp;Address)。
2000::/3 ~ 3FFF::/3

唯一區域(Unique Local)
Unique-Local位址只能在限制的網路內路由(類似IPv4的Private Address)。
FC00::/7 ~ FDFF::/7

鏈路區域(Link-local)
這類IP均由系統自動指定且無法跨越路由器(類似IPv4的自動私人 IP 位址(APIPA))。
FE80::/10 ~ FEBF::/10

多點傳送(Multicast；one-to-mary)
多點傳送位址用來定義一群節點的位址。

任一傳送(Anycast；one-to-nearest)
任一傳送位址也是用來定義一群不相節點的位址，但與多點傳送不同之處在於多點傳送位址的封包會傳送給群組中的每個點，而任一傳送位址的封包只會傳送給群組中最接近的一個節點，Anycast位址只能分配給路由器，不能分配給電腦使用，而且不能作為發送端的位址。


參考資料：
傲笑紅塵路-簡介 IPv6
WikiPedia-IPv6
]]></description>
      <content:encoded><![CDATA[<p><span style="font-size:14px"><strong>IP v4</strong></span></p>

<p><strong>私有IP位址(Private IP)：</strong><br>
Class A 10.0.0.0/8 (1段)</p>

<p>Class B 172.16.0.0/16 ~ 172.31.0.0/16 (16段)</p>

<p>Class C 192.168.0.0/24 ~ 192.168.255.0/24 (256段)</p>

<p>自動私人 IP 位址(APIPA，Automatic Private IP Addressing)<br>
169.254.x.x/16</p>

<p><strong>公有IP位址(Public IP)：</strong><br>
非私有IP位址均屬公有IP</p>

<p><span style="font-size:14px"><strong>IP v6</strong></span></p>

<p>IPv6的位址依傳送方式區分為單點傳送(unicast；one-to-one)、多點傳送(multicast；one-to-many)與任一傳送(anycast；one-to-nearest)三種。</p>

<p><strong>單點傳送(unicast；one-to-one)：</strong><br>
如同IPv4的傳輸方式，系將封包傳送給單一介面位址，適用於單一點對單一節點的資料傳送，這種類型的IPv6位址又區分為"全域單點傳播(Global Unicast)位址"、"唯一區域(Unique Local)位址"及"鏈路區域(Link-local)位址"。</p>

<p style="margin-left: 40px;"><strong>全域單點傳播(Global Unicast)</strong><br>
可在Internet上互連之位址(類似IPv4的Public&nbsp;Address)。<br>
2000::/3 ~ 3FFF::/3</p>

<p style="margin-left: 40px;"><strong>唯一區域(Unique Local)</strong><br>
Unique-Local位址只能在限制的網路內路由(類似IPv4的Private Address)。<br>
FC00::/7 ~ FDFF::/7</p>

<p style="margin-left: 40px;"><strong>鏈路區域(Link-local)</strong><br>
這類IP均由系統自動指定且無法跨越路由器(類似IPv4的自動私人 IP 位址(APIPA))。<br>
FE80::/10 ~ FEBF::/10</p>

<p><strong>多點傳送(Multicast；one-to-mary)</strong><br>
多點傳送位址用來定義一群節點的位址。</p>

<p><strong>任一傳送(Anycast；one-to-nearest)</strong><br>
任一傳送位址也是用來定義一群不相節點的位址，但與多點傳送不同之處在於多點傳送位址的封包會傳送給群組中的每個點，而任一傳送位址的封包只會傳送給群組中最接近的一個節點，Anycast位址只能分配給路由器，不能分配給電腦使用，而且不能作為發送端的位址。</p>

<hr>
<p>參考資料：<br>
<a href="http://www.lijyyh.com/2011/11/ipv6_16.html" target="_blank">傲笑紅塵路-簡介 IPv6</a><br>
<a href="https://zh.wikipedia.org/wiki/IPv6" target="_blank">WikiPedia-IPv6</a></p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/45203121">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F45203121"></div>]]></content:encoded>
      <pubDate>Fri, 17 Feb 2017 15:00:00 +0800</pubDate>
      <category><![CDATA[CCNA]]></category>
      <comments>https://david50.pixnet.net/blog/post/45203121#comments</comments>
    </item>
    <item>
      <title><![CDATA[[照片]2014.12.19巨堡耶誕晚會]]></title>
      <link>https://david50.pixnet.net/blog/post/41819770</link>
      <guid>https://david50.pixnet.net/blog/post/41819770</guid>
      <description><![CDATA[
 &nbsp;
 &nbsp;
地點：永和國父紀念館 &nbsp;檢視較大的地圖&nbsp;成員：妞妞]]></description>
      <content:encoded><![CDATA[<p><object width="600" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="https://photos.gstatic.com/media/slideshow.swf" /><param name="flashvars" value="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F6095679410706497185%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCI6N3YTnmbTuiAE%26hl%3Dzh_TW" /><param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer" /><embed width="600" height="400" type="application/x-shockwave-flash" src="https://photos.gstatic.com/media/slideshow.swf" flashvars="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F6095679410706497185%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCI6N3YTnmbTuiAE%26hl%3Dzh_TW" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object><br /><br /></p>
<p><iframe src="http://www.youtube.com/embed/XKrYU0ntIOU" width="600" height="400" frameborder="0" title="YouTube video player" allowfullscreen=""></iframe> &nbsp;</p>
<p><iframe src="http://www.youtube.com/embed/G3sKiZZvZSA" width="600" height="400" frameborder="0" title="YouTube video player" allowfullscreen=""></iframe> &nbsp;</p>
<p>地點：永和國父紀念館 &nbsp;<em id="__mceDel"><small><a style="color: #0000ff; text-align: left;" href="http://maps.google.com/?ie=UTF8&amp;f=q&amp;source=s_q&amp;q=loc:25.008708,+121.52055799999994+(%E6%B0%B8%E5%92%8C%E5%9C%8B%E7%88%B6%E7%B4%80%E5%BF%B5%E9%A4%A8)&amp;sll=25.001902,121.511438&amp;ll=25.008708,121.520558&amp;marker=25.008708,121.520558&amp;mrt=loc&amp;z=15&amp;t=m&amp;source=embed">檢視較大的地圖</a></small>&nbsp;<br /></em>成員：妞妞</p>  <div class="more"><a href="https://david50.pixnet.net/blog/post/41819770">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F41819770"></div>]]></content:encoded>
      <pubDate>Fri, 19 Dec 2014 22:57:00 +0800</pubDate>
      <category><![CDATA[個人相簿]]></category>
      <comments>https://david50.pixnet.net/blog/post/41819770#comments</comments>
    <enclosure length="22253" type="application/x-shockwave-flash" url="https://photos.gstatic.com/media/slideshow.swf"/><itunes:explicit/><itunes:subtitle>&amp;nbsp; &amp;nbsp; 地點：永和國父紀念館 &amp;nbsp;檢視較大的地圖&amp;nbsp;成員：妞妞</itunes:subtitle><itunes:summary>&amp;nbsp; &amp;nbsp; 地點：永和國父紀念館 &amp;nbsp;檢視較大的地圖&amp;nbsp;成員：妞妞</itunes:summary><itunes:keywords>個人相簿</itunes:keywords></item>
    <item>
      <title><![CDATA[[照片]2014.11.30菁桐車站]]></title>
      <link>https://david50.pixnet.net/blog/post/41819701</link>
      <guid>https://david50.pixnet.net/blog/post/41819701</guid>
      <description><![CDATA[
地點：菁桐車站成員：妞妞.羚寶貝&amp;Me]]></description>
      <content:encoded><![CDATA[<p><object width="600" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="https://photos.gstatic.com/media/slideshow.swf" /><param name="flashvars" value="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F6095674803240514065%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCK3px_r0_9qcOw%26hl%3Dzh_TW" /><param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer" /><embed width="600" height="400" type="application/x-shockwave-flash" src="https://photos.gstatic.com/media/slideshow.swf" flashvars="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F6095674803240514065%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCK3px_r0_9qcOw%26hl%3Dzh_TW" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></p>
<p>地點：菁桐車站<br />成員：妞妞.羚寶貝&amp;Me</p>  <div class="more"><a href="https://david50.pixnet.net/blog/post/41819701">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F41819701"></div>]]></content:encoded>
      <pubDate>Sun, 30 Nov 2014 22:54:00 +0800</pubDate>
      <category><![CDATA[個人相簿]]></category>
      <comments>https://david50.pixnet.net/blog/post/41819701#comments</comments>
    <enclosure length="22253" type="application/x-shockwave-flash" url="https://photos.gstatic.com/media/slideshow.swf"/><itunes:explicit/><itunes:subtitle>地點：菁桐車站成員：妞妞.羚寶貝&amp;amp;Me</itunes:subtitle><itunes:summary>地點：菁桐車站成員：妞妞.羚寶貝&amp;amp;Me</itunes:summary><itunes:keywords>個人相簿</itunes:keywords></item>
    <item>
      <title><![CDATA[[照片]2014.11.28蘆竹花海]]></title>
      <link>https://david50.pixnet.net/blog/post/41819686</link>
      <guid>https://david50.pixnet.net/blog/post/41819686</guid>
      <description><![CDATA[
地點：蘆竹成員：妞妞.羚寶貝＆Ｍe]]></description>
      <content:encoded><![CDATA[<p><object width="600" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="https://photos.gstatic.com/media/slideshow.swf" /><param name="flashvars" value="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F6095666150473013473%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCJPii-7s9_X5Qw%26hl%3Dzh_TW" /><param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer" /><embed width="600" height="400" type="application/x-shockwave-flash" src="https://photos.gstatic.com/media/slideshow.swf" flashvars="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F6095666150473013473%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCJPii-7s9_X5Qw%26hl%3Dzh_TW" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></p>
<p>地點：蘆竹<br />成員：妞妞.羚寶貝＆Ｍe</p>  <div class="more"><a href="https://david50.pixnet.net/blog/post/41819686">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F41819686"></div>]]></content:encoded>
      <pubDate>Fri, 28 Nov 2014 22:50:00 +0800</pubDate>
      <category><![CDATA[個人相簿]]></category>
      <comments>https://david50.pixnet.net/blog/post/41819686#comments</comments>
    <enclosure length="22253" type="application/x-shockwave-flash" url="https://photos.gstatic.com/media/slideshow.swf"/><itunes:explicit/><itunes:subtitle>地點：蘆竹成員：妞妞.羚寶貝＆Ｍe</itunes:subtitle><itunes:summary>地點：蘆竹成員：妞妞.羚寶貝＆Ｍe</itunes:summary><itunes:keywords>個人相簿</itunes:keywords></item>
    <item>
      <title><![CDATA[[照片]1014.10.10昱帝嶺老爸慶生]]></title>
      <link>https://david50.pixnet.net/blog/post/41506384</link>
      <guid>https://david50.pixnet.net/blog/post/41506384</guid>
      <description><![CDATA[地點:基隆昱帝嶺成員:老爸.老媽.阿母.老哥.大嫂一家.羚寶貝.妞妞&amp;Me
&nbsp;
]]></description>
      <content:encoded><![CDATA[<p>地點:基隆昱帝嶺<br />成員:老爸.老媽.阿母.老哥.大嫂一家.羚寶貝.妞妞&amp;Me</p>
<p>&nbsp;</p>
<p><object width="600" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="https://photos.gstatic.com/media/slideshow.swf" /><param name="flashvars" value="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F6068590421529087825%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCJqhv_Lty42gXg%26hl%3Dzh_TW" /><param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer" /><embed width="600" height="400" type="application/x-shockwave-flash" src="https://photos.gstatic.com/media/slideshow.swf" flashvars="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F6068590421529087825%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCJqhv_Lty42gXg%26hl%3Dzh_TW" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></p>  <div class="more"><a href="https://david50.pixnet.net/blog/post/41506384">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F41506384"></div>]]></content:encoded>
      <pubDate>Fri, 10 Oct 2014 23:34:54 +0800</pubDate>
      <category><![CDATA[個人相簿]]></category>
      <comments>https://david50.pixnet.net/blog/post/41506384#comments</comments>
    <enclosure length="22253" type="application/x-shockwave-flash" url="https://photos.gstatic.com/media/slideshow.swf"/><itunes:explicit/><itunes:subtitle>地點:基隆昱帝嶺成員:老爸.老媽.阿母.老哥.大嫂一家.羚寶貝.妞妞&amp;amp;Me &amp;nbsp;</itunes:subtitle><itunes:summary>地點:基隆昱帝嶺成員:老爸.老媽.阿母.老哥.大嫂一家.羚寶貝.妞妞&amp;amp;Me &amp;nbsp;</itunes:summary><itunes:keywords>個人相簿</itunes:keywords></item>
    <item>
      <title><![CDATA[[音樂]Triplane-Dear Friends 歌詞]]></title>
      <link>https://david50.pixnet.net/blog/post/40772974</link>
      <guid>https://david50.pixnet.net/blog/post/40772974</guid>
      <description><![CDATA[第一次聽到這首歌是在Onepiece中的片尾曲片尾曲因為時間的關係做了大幅度的修剪所以聽起來沒有什麼特別的感覺直到劇情到了要和梅利號告別時才算是第一次聽完這首歌當時當然被當時感人的劇情和配樂感動到落淚每次聽到這首歌時都會想到劇情而有點感傷最近突然看到了原唱版的MV仔細聽過音樂後發現這首歌真是太好聽了從主唱的聲音到中間的吉他Solo都讓我想起了久未發片的Mr.Children今天把歌詞記錄起來希望能好好保存起這份感動囉!^^

&nbsp;
日文歌詞：
Dear Fridnes
毎日陽が沈むまで 泥まみれになりながら無邪気に過ごした日々も捨て難いけれど夢見る僕が居てもそれはそれで僕だからジグソーパズルみたいにはまってなくて良い&nbsp;誰かの"Yes"が君にとって"No"であるのと同じようにいつだって自由なはずだから&nbsp;明日 風が通り抜けた時にパズルが欠けていたとしても誰もそれを責めたりしないよ&nbsp;あの日夢見た僕らは 間違いじゃないと信じて 荒くうねる海原を渡って行ける君の胸の痛みだって 僕らは知っているからもしも君がこの船を下りて違う世界に居たとしても最後にはきっと笑えるよ&nbsp;今でも僕らは夢を見ているよ託されたその想いも乗せて&nbsp;荒れたこの海原を痛みと戦って今日も行く約束が噓にならないようにそしていつか僕らの船を下りた違う世界に居る君に
&nbsp;
中文歌詞：
Dear Fridnes
&nbsp;
難忘兒時天真的我們在夕陽下滿身灰泥那無憂無慮的日子那時做著美好的夢的我可以不必在乎那些拼圖別人說的 "對"對你來說就和 "錯" 沒有兩樣無論何時應該是如此自由就算明天大風吹散了拼圖也不會有人責備&nbsp;&nbsp;那一天&nbsp; 憧憬著夢想的我們堅信著彼此的信念跨過剝濤洶湧的大海你的痛苦我們比誰都清楚即便你離開這條船去了不同世界最後也定能開懷暢笑&nbsp;現在的我們仍然在憧憬著夢想還加上那被託付了的心願&nbsp;&nbsp;今天我們仍要面對洶湧的大海面對悲傷為了不讓約定落空為了有一天能將完成的拼圖交給離開了我們的船去了不同世界的你完成したパズルを屆けよう
&nbsp;
羅馬拼音歌詞：
Dear Friends
Lyrics: Ebata Hyoue Music: Ebata Hyoue
Ma-i ni-chi hi ga shi zu-mu ma deDo lo ma mi re ni na ri na ga raMu ja ki-ni su go shi-ta hi bi mo su te ga ta i ke re doYu me mi ru bo ku ga i te-mo so re wa so re de bo-ku da ka raJI GU SO-O PA ZU RU mi ta i niHa ma tte na ku te iiDa re ka no 「Yes」 ga ki mi ni to tte「No」 de a ru no to-o na ji yo-u niI tsu da tte ji yu-u na ha zu da ka raA shi ta ka ze ga to ori nu ke ta to ki niPA ZU RU ga ka ke te i-ta to shi te moDa re mo so re-wo se me ta ri shi na i yoAno hi yu me mi ta bo ku ra waMa chi ga-i ja na-i to sh in ji teA ra ku-u ne ru-u na ba ra wo wa ta tte i-ke u wuKi mi no mu ne no i-ta mi da tteBo ku ra wa shi tte i-ru ka raMo shi mo ki mi ga ko no fu ne wo ku da ri teChi ga-u se ka i-ni i-ta to shi te mo Sa-i go ni wa ki i-tto wa ra e ru yoI ma de mo bo ku ra wa yu me wo mi te i-ru yoTa ku sa re-ta so no o mo-i mo no se teA re ta ko no-u na ba ra wo i ta mi to ta ta ka tte ko-you mo yu kuYa ku so ku ga u-so ni na ra na-i you niSo shi te i-tsu kaBo ku ra no fu ne wo i ta chi ga-u se ka-i ni i-ru ki mi niKa-u se i shi-ta PA ZU RU wo to do ke yo-u
&nbsp;
]]></description>
      <content:encoded><![CDATA[<p>第一次聽到這首歌是在Onepiece中的片尾曲<br />片尾曲因為時間的關係做了大幅度的修剪<br />所以聽起來沒有什麼特別的感覺<br />直到劇情到了要和梅利號告別時才算是第一次聽完這首歌<br />當時當然被當時感人的劇情和配樂感動到落淚<br />每次聽到這首歌時都會想到劇情而有點感傷<br />最近突然看到了原唱版的MV<br />仔細聽過音樂後發現這首歌真是太好聽了<br />從主唱的聲音到中間的吉他Solo都讓我想起了久未發片的Mr.Children<br />今天把歌詞記錄起來<br />希望能好好保存起這份感動囉!^^</p>
<p><iframe src="//www.youtube.com/embed/IBK0FuAs6WA" width="640" height="360" frameborder="0" allowfullscreen=""></iframe></p>
<p>&nbsp;</p>
<p>日文歌詞：</p>
<p>Dear Fridnes</p>
<p>毎日陽が沈むまで 泥まみれになりながら<br /><br />無邪気に過ごした日々も捨て難いけれど<br /><br />夢見る僕が居てもそれはそれで僕だから<br /><br />ジグソーパズルみたいにはまってなくて良い<br /><br />&nbsp;<br /><br />誰かの"Yes"が君にとって"No"であるのと同じように<br /><br />いつだって自由なはずだから<br /><br />&nbsp;<br />明日 風が通り抜けた時にパズルが欠けていたとしても<br /><br />誰もそれを責めたりしないよ<br /><br />&nbsp;<br /><br />あの日夢見た僕らは 間違いじゃないと信じて 荒くうねる海原を渡って行ける<br /><br />君の胸の痛みだって 僕らは知っているから<br /><br />もしも君がこの船を下りて違う世界に居たとしても<br /><br />最後にはきっと笑えるよ<br />&nbsp;<br /><br />今でも僕らは夢を見ているよ<br /><br />託されたその想いも乗せて<br />&nbsp;<br /><br />荒れたこの海原を痛みと戦って今日も行く<br /><br />約束が噓にならないように<br /><br />そしていつか<br /><br />僕らの船を下りた違う世界に居る君に</p>
<p>&nbsp;</p>
<p>中文歌詞：</p>
<p>Dear Fridnes</p>
<p>&nbsp;</p>
<p>難忘兒時天真的我們在夕陽下<br /><br />滿身灰泥那無憂無慮的日子<br /><br />那時做著美好的夢的我<br /><br />可以不必在乎那些拼圖<br /><br />別人說的 "對"<br /><br />對你來說就和 "錯" 沒有兩樣<br /><br />無論何時應該是如此自由<br /><br />就算明天大風吹散了拼圖<br /><br />也不會有人責備<br /><br />&nbsp;<br /><br />&nbsp;<br /><br />那一天&nbsp; 憧憬著夢想的我們<br /><br />堅信著彼此的信念<br /><br />跨過剝濤洶湧的大海<br /><br />你的痛苦我們比誰都清楚<br /><br />即便你離開這條船去了不同世界<br /><br />最後也定能開懷暢笑<br /><br />&nbsp;<br /><br />現在的我們仍然在憧憬著夢想<br /><br />還加上那被託付了的心願<br /><br />&nbsp;<br /><br />&nbsp;<br /><br />今天我們仍要面對洶湧的大海面對悲傷<br /><br />為了不讓約定落空<br /><br />為了有一天<br /><br />能將完成的拼圖<br /><br />交給離開了我們的船去了不同世界的你<br /><br />完成したパズルを屆けよう</p>
<p>&nbsp;</p>
<p>羅馬拼音歌詞：</p>
<p>Dear Friends</p>
<p>Lyrics: Ebata Hyoue Music: Ebata Hyoue</p>
<p><br />Ma-i ni-chi hi ga shi zu-mu ma de<br />Do lo ma mi re ni na ri na ga ra<br />Mu ja ki-ni su go shi-ta hi bi mo su te ga ta i ke re do<br /><br />Yu me mi ru bo ku ga i te-mo so re wa so re de bo-ku da ka ra<br />JI GU SO-O PA ZU RU mi ta i ni<br />Ha ma tte na ku te ii<br /><br />Da re ka no 「Yes」 ga ki mi ni to tte<br />「No」 de a ru no to-o na ji yo-u ni<br />I tsu da tte ji yu-u na ha zu da ka ra<br />A shi ta ka ze ga to ori nu ke ta to ki ni<br />PA ZU RU ga ka ke te i-ta to shi te mo<br />Da re mo so re-wo se me ta ri shi na i yo<br /><br />Ano hi yu me mi ta bo ku ra wa<br />Ma chi ga-i ja na-i to sh in ji te<br />A ra ku-u ne ru-u na ba ra wo wa ta tte i-ke u wu<br />Ki mi no mu ne no i-ta mi da tte<br />Bo ku ra wa shi tte i-ru ka ra<br /><br />Mo shi mo ki mi ga ko no fu ne wo ku da ri te<br />Chi ga-u se ka i-ni i-ta to shi te mo Sa-i go ni wa ki i-tto wa ra e ru yo<br /><br />I ma de mo bo ku ra wa yu me wo mi te i-ru yo<br />Ta ku sa re-ta so no o mo-i mo no se te<br /><br />A re ta ko no-u na ba ra wo <br />i ta mi to ta ta ka tte ko-you mo yu ku<br />Ya ku so ku ga u-so ni na ra na-i you ni<br /><br />So shi te i-tsu ka<br />Bo ku ra no fu ne wo i ta chi ga-u se ka-i ni i-ru ki mi ni<br />Ka-u se i shi-ta PA ZU RU wo to do ke yo-u</p>
<p>&nbsp;</p>
<p><iframe src="//www.youtube.com/embed/T3XMflSkSd8" width="640" height="360" frameborder="0" allowfullscreen=""></iframe></p>  <div class="more"><a href="https://david50.pixnet.net/blog/post/40772974">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F40772974"></div>]]></content:encoded>
      <pubDate>Tue, 29 Apr 2014 22:57:22 +0800</pubDate>
      <category><![CDATA[音樂欣賞]]></category>
      <comments>https://david50.pixnet.net/blog/post/40772974#comments</comments>
    </item>
    <item>
      <title><![CDATA[[照片]2014.02.27木柵動物園外拍行]]></title>
      <link>https://david50.pixnet.net/blog/post/40762450</link>
      <guid>https://david50.pixnet.net/blog/post/40762450</guid>
      <description><![CDATA[
&nbsp;
地點：木柵動物員.貓空成員：阿母.弟弟.小妞.羚寶貝&amp;Me]]></description>
      <content:encoded><![CDATA[<p><object style="display: block; margin-left: auto; margin-right: auto;" width="600" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="https://photos.gstatic.com/media/slideshow.swf" /><param name="flashvars" value="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F6006244957608203281%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCJXYhqPagP-jfw%26hl%3Dzh_TW" /><param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer" /><embed style="display: block; margin-left: auto; margin-right: auto;" width="600" height="400" type="application/x-shockwave-flash" src="https://photos.gstatic.com/media/slideshow.swf" flashvars="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F6006244957608203281%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCJXYhqPagP-jfw%26hl%3Dzh_TW" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></p>
<p>&nbsp;</p>
<p>地點：木柵動物員.貓空<br />成員：阿母.弟弟.小妞<span style="color: #555555; font-family: 'Century Gothic'; letter-spacing: 1.1428571939468384px; line-height: 20px;">.</span>羚寶貝&amp;Me</p>  <div class="more"><a href="https://david50.pixnet.net/blog/post/40762450">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F40762450"></div>]]></content:encoded>
      <pubDate>Thu, 27 Feb 2014 22:45:00 +0800</pubDate>
      <category><![CDATA[個人相簿]]></category>
      <comments>https://david50.pixnet.net/blog/post/40762450#comments</comments>
    <enclosure length="22253" type="application/x-shockwave-flash" url="https://photos.gstatic.com/media/slideshow.swf"/><itunes:explicit/><itunes:subtitle>&amp;nbsp; 地點：木柵動物員.貓空成員：阿母.弟弟.小妞.羚寶貝&amp;amp;Me</itunes:subtitle><itunes:summary>&amp;nbsp; 地點：木柵動物員.貓空成員：阿母.弟弟.小妞.羚寶貝&amp;amp;Me</itunes:summary><itunes:keywords>個人相簿</itunes:keywords></item>
    <item>
      <title><![CDATA[謝謝妳的陪伴]]></title>
      <link>https://david50.pixnet.net/blog/post/40184404</link>
      <guid>https://david50.pixnet.net/blog/post/40184404</guid>
      <description><![CDATA[今天老婆突然抱著我跟我說謝謝我帶她去美國. 去看演唱會.去歐洲渡蜜月當下聽完沒多說什麼但其實在我心中的想法是也許我一個人也會自己去看演唱會.去美國圓夢但也許一個人完成這些夢想後心中會有著更大的失落感因為若是這些事情都只有我一個人那想必會是個寂寞旅程其實是我想對妳說謝謝妳陪我一起完成了我的夢想希望未來的每一個夢想都能有妳在身邊陪伴著我
Thank you and Love you]]></description>
      <content:encoded><![CDATA[<p>今天老婆突然抱著我跟我說<br />謝謝我帶她去美國. 去看演唱會.去歐洲渡蜜月<br />當下聽完沒多說什麼<br />但其實在我心中的想法是<br />也許我一個人也會自己去看演唱會.去美國圓夢<br />但也許一個人完成這些夢想後<br />心中會有著更大的失落感<br />因為若是這些事情都只有我一個人<br />那想必會是個寂寞旅程<br />其實是我想對妳說<br />謝謝妳陪我一起完成了我的夢想<br />希望未來的每一個夢想都能有妳在身邊陪伴著我</p>
<p>Thank you and Love you</p>  <div class="more"><a href="https://david50.pixnet.net/blog/post/40184404">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F40184404"></div>]]></content:encoded>
      <pubDate>Sun, 12 Jan 2014 23:11:00 +0800</pubDate>
      <category><![CDATA[心情隨筆]]></category>
      <comments>https://david50.pixnet.net/blog/post/40184404#comments</comments>
    </item>
    <item>
      <title><![CDATA[[旅遊]美國圓夢之旅Day-1啟程]]></title>
      <link>https://david50.pixnet.net/blog/post/39784474</link>
      <guid>https://david50.pixnet.net/blog/post/39784474</guid>
      <description><![CDATA[
&nbsp;
期待了這麼久終於要踏上美國的旅程了心情老實講忐忑多過於興奮因為最擔心的就是花了這麼多時間和金錢沒有完成自己的夢想那可真是欲哭無淚了
&nbsp;
去程搭的是長榮的飛機機上的服務人員都會講中文並沒有什麼大問題就連要報關時的問題不會寫都還可以請教空姐

但到了LA時就是考驗真正開始了而且遇到的海關是個死肥佬態度真的是有夠差的不過還好他沒有刻意刁難不然以我的英文能力可能進不了關了吧 @@
到了美國也才發現不是所有東方面孔都會講中文的
這時才覺得中文原來是這麼的不通用的語言
到了美國什麼都覺得新鮮某些只能在電視或電影上才看得到的場景現在都真實的在眼前出現了
&nbsp;&nbsp;

LAX Shuttle

怎麼和課本上的News Stand長的不太一樣？

機場內的商店就佈置成這樣了

美國的Minute Maid，有很多台灣沒有的口味哦!
入關後還需從LA轉機去San Antonio轉機時因為太早就進登機門連登機門的號碼都還不知道在航廈中又不敢亂跑看到幾家賣吃的就先買了點來吃

第一次在美國的消費是Roast beef wrap，真的是又貴又難吃 @@
吃完後才去詢問得知原來登機門在另一個航廈在路上才發現了原來機場內也賣熱食當時真是開心極了^^

從沒看過的漢堡店Carl's Jr

好吃到不行的漢堡

薯條也挺不賴的
&nbsp;
不知是因為轉機過程太久還是剛才吃了冷的Roast beef wrap的關係吃到熱騰騰的漢堡時眼淚都快流出來了這輩子從沒吃過這麼好吃的漢堡可惜回程沒有再給過相同的航廈不然我一定還要再來吃一次

&nbsp;終於準備要登機了

飛機上的夜景
下飛機後就抵達San Antonio囉! ^^
&nbsp;]]></description>
      <content:encoded><![CDATA[<p><object style="display: block; margin-left: auto; margin-right: auto;" width="600" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="https://static.googleusercontent.com/external_content/picasaweb.googleusercontent.com/slideshow.swf" /><param name="flashvars" value="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F5959111658917776625%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCMH0mOO3pOiYXQ%26hl%3Dzh_TW" /><param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer" /><embed style="display: block; margin-left: auto; margin-right: auto;" width="600" height="400" type="application/x-shockwave-flash" src="https://static.googleusercontent.com/external_content/picasaweb.googleusercontent.com/slideshow.swf" flashvars="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F5959111658917776625%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCMH0mOO3pOiYXQ%26hl%3Dzh_TW" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></p>
<p>&nbsp;</p>
<p style="text-align: justify;">期待了這麼久終於要踏上美國的旅程了<br />心情老實講忐忑多過於興奮<br />因為最擔心的就是花了這麼多時間和金錢沒有完成自己的夢想<br />那可真是欲哭無淚了</p>
<p style="text-align: justify;"><br />&nbsp;<img src="https://lh4.googleusercontent.com/-bMxAIEscS-8/UrMEmbW7xRI/AAAAAAAAyk8/1t6Wdtt7TDc/s1024/P1280421.JPG" alt="" width="600" height="450" /></p>
<p>去程搭的是長榮的飛機機上的服務人員都會講中文並沒有什麼大問題<br />就連要報關時的問題不會寫都還可以請教空姐</p>
<p style="text-align: justify;"><img src="https://lh6.googleusercontent.com/-3U5h10ZH30M/UrMEuuIgF2I/AAAAAAAAymI/TJKr1PAB8lc/s1024/P1280433.JPG" alt="" width="600" height="450" /></p>
<p>但到了LA時就是考驗真正開始了<br />而且遇到的海關是個死肥佬<br />態度真的是有夠差的<br />不過還好他沒有刻意刁難<br />不然以我的英文能力可能進不了關了吧 @@</p>
<p>到了美國也才發現不是所有東方面孔都會講中文的</p>
<p>這時才覺得中文原來是這麼的不通用的語言<img src="http://s.pixfs.net/f.pixnet.net/images/emotions/tounge_smile.gif" alt="" border="0" /></p>
<p>到了美國什麼都覺得新鮮<br />某些只能在電視或電影上才看得到的場景<br /><em id="__mceDel">現在都真實的在眼前出現了</em></p>
<p>&nbsp;<em id="__mceDel">&nbsp;</em></p>
<p style="text-align: justify;"><em><img src="https://lh6.googleusercontent.com/-JUM83aOpzzw/UrMEw_vnNHI/AAAAAAAAymk/_cuifyXatQU/s1024/P1280436.JPG" alt="" width="600" height="450" /></em></p>
<p style="text-align: center;">LAX Shuttle</p>
<p style="text-align: justify;"><img src="https://lh5.googleusercontent.com/-20InIsT9mBo/UrME15FePdI/AAAAAAAAynI/-4tlOY1P6fs/s1024/P1280441.JPG" alt="" width="600" height="450" /></p>
<p style="text-align: center;">怎麼和課本上的News Stand長的不太一樣？</p>
<p style="text-align: justify;"><img src="https://lh6.googleusercontent.com/-KA11ERirmbw/UrME92efPsI/AAAAAAAAyog/7umI5wlFABQ/s720/P1280451.JPG" alt="" width="540" height="720" /></p>
<p style="text-align: center;">機場內的商店就佈置成這樣了</p>
<p style="text-align: justify;"><img src="https://lh3.googleusercontent.com/-MTn5Je37raM/UrMFCiU5-pI/AAAAAAAAypQ/bLSZPP_UxxA/s1024/P1280457.JPG" alt="" width="600" height="450" /></p>
<p style="text-align: center;">美國的Minute Maid，有很多台灣沒有的口味哦!</p>
<p>入關後還需從LA轉機去San Antonio<br />轉機時因為太早就進登機門連登機門的號碼都還不知道<br />在航廈中又不敢亂跑<br />看到幾家賣吃的就先買了點來吃</p>
<p style="text-align: justify;"><em id="__mceDel"><img src="https://lh5.googleusercontent.com/-KpjuhXoD7bo/UrMFFMP93iI/AAAAAAAAypc/aOpAaBsePw4/s720/P1280459.JPG" alt="" width="600" height="600" /></em></p>
<p style="text-align: center;"><em id="__mceDel"><em id="__mceDel"></em><em id="__mceDel"><em id="__mceDel">第一次在美國的消費是Roast beef wrap，</em><em id="__mceDel">真的是又貴又難吃 @@</em></em></em></p>
<p><em>吃完後才去詢問得知原來登機門在另一個航廈<br />在路上才發現了原來機場內也賣熱食<br />當時真是開心極了^^</em></p>
<p style="text-align: justify;"><em><img src="https://lh5.googleusercontent.com/-JZ6TIxRlP2M/UrMFzr2TFUI/AAAAAAAAysc/tUFkwjiotDg/s720/P1280490.JPG" alt="" width="600" height="600" /></em></p>
<p style="text-align: center;"><em id="__mceDel">從沒看過的漢堡店Carl's Jr</em></p>
<p style="text-align: justify;"><img src="https://lh3.googleusercontent.com/-gqojqobGHPg/UrMFUgs9nWI/AAAAAAAAyqc/n4ImuHEV9C8/s720/P1280467.JPG" alt="" width="600" height="600" /></p>
<p style="text-align: center;">好吃到不行的漢堡</p>
<p style="text-align: justify;"><img src="https://lh6.googleusercontent.com/-8Vh2k34SBEg/UrMFSZBp5WI/AAAAAAAAyqU/aBELZmWAMps/s720/P1280466.JPG" alt="" width="600" height="600" /></p>
<p style="text-align: center;">薯條也挺不賴的</p>
<p>&nbsp;</p>
<p>不知是因為轉機過程太久還是剛才吃了冷的<em id="__mceDel">Roast beef wrap的關係</em><br />吃到熱騰騰的漢堡時眼淚都快流出來了<br />這輩子從沒吃過這麼好吃的漢堡<br />可惜回程沒有再給過相同的航廈<br />不然我一定還要再來吃一次</p>
<p style="text-align: justify;"><img src="https://lh4.googleusercontent.com/-ZK4QaiIWwQ8/UrMF4vHKWRI/AAAAAAAAys0/pW4JK9LfcEE/s720/P1280493.JPG" alt="" width="600" height="600" /></p>
<p style="text-align: center;">&nbsp;終於準備要登機了</p>
<p style="text-align: justify;"><img src="https://lh6.googleusercontent.com/-YN8uTn8x2XE/UrMF9hVocuI/AAAAAAAAytQ/9YHF8SQpq_M/s720/P1280496.JPG" alt="" width="600" height="600" /></p>
<p style="text-align: center;">飛機上的夜景</p>
<p>下飛機後就抵達San Antonio囉! ^^</p>
<p>&nbsp;</p>  <div class="more"><a href="https://david50.pixnet.net/blog/post/39784474">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F39784474"></div>]]></content:encoded>
      <pubDate>Fri, 29 Nov 2013 22:28:00 +0800</pubDate>
      <category><![CDATA[心情隨筆]]></category>
      <comments>https://david50.pixnet.net/blog/post/39784474#comments</comments>
    <enclosure length="22253" type="application/x-shockwave-flash" url="https://static.googleusercontent.com/external_content/picasaweb.googleusercontent.com/slideshow.swf"/><itunes:explicit/><itunes:subtitle>&amp;nbsp; 期待了這麼久終於要踏上美國的旅程了心情老實講忐忑多過於興奮因為最擔心的就是花了這麼多時間和金錢沒有完成自己的夢想那可真是欲哭無淚了 &amp;nbsp; 去程搭的是長榮的飛機機上的服務人員都會講中文並沒有什麼大問題就連要報關時的問題不會寫都還可以請教空姐 但到了LA時就是考驗真正開始了而且遇到的海關是個死肥佬態度真的是有夠差的不過還好他沒有刻意刁難不然以我的英文能力可能進不了關了吧 @@ 到了美國也才發現不是所有東方面孔都會講中文的 這時才覺得中文原來是這麼的不通用的語言 到了美國什麼都覺得新鮮某些只能在電視或電影上才看得到的場景現在都真實的在眼前出現了 &amp;nbsp;&amp;nbsp; LAX Shuttle 怎麼和課本上的News Stand長的不太一樣？ 機場內的商店就佈置成這樣了 美國的Minute Maid，有很多台灣沒有的口味哦! 入關後還需從LA轉機去San Antonio轉機時因為太早就進登機門連登機門的號碼都還不知道在航廈中又不敢亂跑看到幾家賣吃的就先買了點來吃 第一次在美國的消費是Roast beef wrap，真的是又貴又難吃 @@ 吃完後才去詢問得知原來登機門在另一個航廈在路上才發現了原來機場內也賣熱食當時真是開心極了^^ 從沒看過的漢堡店Carl's Jr 好吃到不行的漢堡 薯條也挺不賴的 &amp;nbsp; 不知是因為轉機過程太久還是剛才吃了冷的Roast beef wrap的關係吃到熱騰騰的漢堡時眼淚都快流出來了這輩子從沒吃過這麼好吃的漢堡可惜回程沒有再給過相同的航廈不然我一定還要再來吃一次 &amp;nbsp;終於準備要登機了 飛機上的夜景 下飛機後就抵達San Antonio囉! ^^ &amp;nbsp;</itunes:subtitle><itunes:summary>&amp;nbsp; 期待了這麼久終於要踏上美國的旅程了心情老實講忐忑多過於興奮因為最擔心的就是花了這麼多時間和金錢沒有完成自己的夢想那可真是欲哭無淚了 &amp;nbsp; 去程搭的是長榮的飛機機上的服務人員都會講中文並沒有什麼大問題就連要報關時的問題不會寫都還可以請教空姐 但到了LA時就是考驗真正開始了而且遇到的海關是個死肥佬態度真的是有夠差的不過還好他沒有刻意刁難不然以我的英文能力可能進不了關了吧 @@ 到了美國也才發現不是所有東方面孔都會講中文的 這時才覺得中文原來是這麼的不通用的語言 到了美國什麼都覺得新鮮某些只能在電視或電影上才看得到的場景現在都真實的在眼前出現了 &amp;nbsp;&amp;nbsp; LAX Shuttle 怎麼和課本上的News Stand長的不太一樣？ 機場內的商店就佈置成這樣了 美國的Minute Maid，有很多台灣沒有的口味哦! 入關後還需從LA轉機去San Antonio轉機時因為太早就進登機門連登機門的號碼都還不知道在航廈中又不敢亂跑看到幾家賣吃的就先買了點來吃 第一次在美國的消費是Roast beef wrap，真的是又貴又難吃 @@ 吃完後才去詢問得知原來登機門在另一個航廈在路上才發現了原來機場內也賣熱食當時真是開心極了^^ 從沒看過的漢堡店Carl's Jr 好吃到不行的漢堡 薯條也挺不賴的 &amp;nbsp; 不知是因為轉機過程太久還是剛才吃了冷的Roast beef wrap的關係吃到熱騰騰的漢堡時眼淚都快流出來了這輩子從沒吃過這麼好吃的漢堡可惜回程沒有再給過相同的航廈不然我一定還要再來吃一次 &amp;nbsp;終於準備要登機了 飛機上的夜景 下飛機後就抵達San Antonio囉! ^^ &amp;nbsp;</itunes:summary><itunes:keywords>心情隨筆</itunes:keywords></item>
    <item>
      <title><![CDATA[[筆記]ubuntu中清除/boot中之舊版Kernel]]></title>
      <link>https://david50.pixnet.net/blog/post/38158207</link>
      <guid>https://david50.pixnet.net/blog/post/38158207</guid>
      <description><![CDATA[最近使用系統更新將核心更新到3.5.0-42開機後居然出現了/boot磁碟空間不足的警示&nbsp;
想想當時分割時還想說多給一點就給了500M的空間
沒想到居然還會發生磁不足的情況
是該慶幸我的系統很久沒重灌了還是該煩腦系統升級太頻繁了呢？

記得之前因為/boot給太小也有發生相同的情況
那時也有清過一次/boot內之舊核心
但年代久遠加上當時沒有做筆記的習慣
再加上當時想說才一個指令有什麼好記的
所以現在才會有這一篇的出現&nbsp;

首先要先確認目前所使用Kernel版本：
uname -r

輸入後會出現類似下方的文字：
3.5.0-42-generic

接下來要查看之前以安裝過了那些版本的kernel：
dpkg --get-selections|grep linux-image

輸入後會出現類似下方的文字：
linux-image-3.5.0-38-generic install
linux-image-3.5.0-39-generic install
linux-image-3.5.0-40-generic install
linux-image-3.5.0-41-generic install
linux-image-3.5.0-42-generic install
linux-image-generic-lts-quantal install

刪除不需要的舊版Kernel:
sudo apt-get purge&nbsp;linux-image-3.5.0-38-generic linux-image-3.5.0-39-generic

Enter後即將舊版Kernel刪除了

另外在安裝新版Kenel時系統會將新版Kernel的source code存放於"/usr/src"
如果真的磁碟空間不足或是太無聊想試看看也可以到“/usr/src”中使用"rm -rf"將"linux-image-3.5.0-3*"字眼的目錄刪除
刪除後舊版Kernel的source code就被刪除掉囉！&nbsp;


&nbsp;參考網址:Ubuntu 清除 /boot 中舊的核心
]]></description>
      <content:encoded><![CDATA[<p>最近使用系統更新將核心更新到3.5.0-42開機後居然出現了/boot磁碟空間不足的警示&nbsp;<img alt="" border="0" src="//s.pixfs.net/f.pixnet.net/images/emotions/confused_smile.gif" title=""><br>
想想當時分割時還想說多給一點就給了500M的空間<br>
沒想到居然還會發生磁不足的情況<br>
是該慶幸我的系統很久沒重灌了還是該煩腦系統升級太頻繁了呢？<img alt="" border="0" src="//s.pixfs.net/f.pixnet.net/images/emotions/whatchutalkingabout_smile.gif" title=""></p>

<p>記得之前因為/boot給太小也有發生相同的情況<br>
那時也有清過一次/boot內之舊核心<br>
但年代久遠加上當時沒有做筆記的習慣<br>
再加上當時想說才一個指令有什麼好記的<br>
所以現在才會有這一篇的出現&nbsp;<img alt="" border="0" src="//s.pixfs.net/f.pixnet.net/images/emotions/tounge_smile.gif" title=""></p>

<p>首先要先<strong>確認目前所使用Kernel版本：</strong><br>
<strong>uname -r</strong></p>

<p>輸入後會出現類似下方的文字：<br>
<strong>3.5.0-42-generic</strong></p>

<p>接下來要<strong>查看之前以安裝過了那些版本的kernel：</strong><br>
<strong>dpkg --get-selections|grep linux-image</strong></p>

<p>輸入後會出現類似下方的文字：<br>
<strong>linux-image-3.5.0-38-generic install</strong><br>
<strong>linux-image-3.5.0-39-generic install</strong><br>
<strong>linux-image-3.5.0-40-generic install</strong><br>
<strong><em id="__mceDel"><em id="__mceDel"><em id="__mceDel">linux-image-3.5.0-41-generic install<br>
<em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel">linux-image-3.5.0-42-generic install</em></em></em></em></em></em></em></em></em></em><br>
<em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel">linux-image-generic-lts-quantal install</em></em></em></em></em></em></em></em></strong></p>

<p><strong>刪除不需要的舊版Kernel:</strong><br>
<strong>sudo apt-get purge&nbsp;linux-image-3.5.0-38-generic linux-image-3.5.0-39-generic</strong></p>

<p>Enter後即將舊版Kernel刪除了</p>

<p>另外在安裝新版Kenel時系統會將新版Kernel的source code存放於<strong>"/usr/src"</strong><br>
如果真的磁碟空間不足或是太無聊想試看看也可以到<strong>“/usr/src”</strong>中使用<strong>"rm -rf</strong>"將<strong>"linux-image-3.5.0-3*"</strong>字眼的目錄刪除<br>
刪除後舊版Kernel的source code就被刪除掉囉！&nbsp;<img alt="" border="0" src="//s.pixfs.net/f.pixnet.net/images/emotions/wink_smile.gif" title=""></p>

<hr>
<p>&nbsp;參考網址:<a href="http://goo.gl/yfmGj7" target="_blank">Ubuntu 清除 /boot 中舊的核心</a></p>
  <div class="more"><a href="https://david50.pixnet.net/blog/post/38158207">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F38158207"></div>]]></content:encoded>
      <pubDate>Sat, 12 Oct 2013 23:27:23 +0800</pubDate>
      <category><![CDATA[Linux]]></category>
      <comments>https://david50.pixnet.net/blog/post/38158207#comments</comments>
    </item>
    <item>
      <title><![CDATA[[照片]2013.08.24探寢室長]]></title>
      <link>https://david50.pixnet.net/blog/post/32648933</link>
      <guid>https://david50.pixnet.net/blog/post/32648933</guid>
      <description><![CDATA[
地點：林口頂福凌園.新竹福源花生醬.三峽八條壽司成員：阿凱.亞祥.阿達&amp;Me]]></description>
      <content:encoded><![CDATA[<p><object width="600" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="https://static.googleusercontent.com/external_content/picasaweb.googleusercontent.com/slideshow.swf" /><param name="flashvars" value="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F5915880511794215297%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCNy0naKrhO2G2wE%26hl%3Dzh_TW" /><param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer" /><embed width="600" height="400" type="application/x-shockwave-flash" src="https://static.googleusercontent.com/external_content/picasaweb.googleusercontent.com/slideshow.swf" flashvars="host=picasaweb.google.com&amp;hl=zh_TW&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F110833475824736141280%2Falbumid%2F5915880511794215297%3Falt%3Drss%26kind%3Dphoto%26authkey%3DGv1sRgCNy0naKrhO2G2wE%26hl%3Dzh_TW" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></p>
<p>地點：林口頂福凌園.新竹福源花生醬.三峽八條壽司<br />成員：阿凱.亞祥.阿達&amp;Me</p>  <div class="more"><a href="https://david50.pixnet.net/blog/post/32648933">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F32648933"></div>]]></content:encoded>
      <pubDate>Sat, 24 Aug 2013 21:57:00 +0800</pubDate>
      <category><![CDATA[個人相簿]]></category>
      <comments>https://david50.pixnet.net/blog/post/32648933#comments</comments>
    <enclosure length="22253" type="application/x-shockwave-flash" url="https://static.googleusercontent.com/external_content/picasaweb.googleusercontent.com/slideshow.swf"/><itunes:explicit/><itunes:subtitle>地點：林口頂福凌園.新竹福源花生醬.三峽八條壽司成員：阿凱.亞祥.阿達&amp;amp;Me</itunes:subtitle><itunes:summary>地點：林口頂福凌園.新竹福源花生醬.三峽八條壽司成員：阿凱.亞祥.阿達&amp;amp;Me</itunes:summary><itunes:keywords>個人相簿</itunes:keywords></item>
    <item>
      <title><![CDATA[[筆記]Ubuntu 中合併檔案]]></title>
      <link>https://david50.pixnet.net/blog/post/32338167</link>
      <guid>https://david50.pixnet.net/blog/post/32338167</guid>
      <description><![CDATA[之前有使用mp3splt將一個mp3分割成多個mp3檔但這次分割完後才發覺居然有一首歌在轉檔時居然被分別放在兩個不同檔案中想說可以分割mp3合併應不太難才對吧果然在G大神的協助下不到幾分鐘就解決了這個問題而且還不需安裝任何套件或軟體直接使用cat這個指令就可以輕鬆達成囉!&nbsp;
首先要先切換到要合併的mp3所在的目錄中假設要合併的mp3檔案名稱為1-1.mp3及1-2.mp3即輸入：
cat 1-1.mp3 1-2.mp3 &gt; 01.mp3
即可完成檔案的合併囉!

參考網址:ubuntu上的copy /b (合併檔案)
&nbsp;
&nbsp;]]></description>
      <content:encoded><![CDATA[<p>之前有使用<a href="http://goo.gl/6NnCL" target="_blank">mp3splt</a>將<a href="http://goo.gl/qxgtw" target="_blank">一個mp3分割成多個mp3檔</a><br />但這次分割完後才發覺居然有一首歌在轉檔時居然被分別放在兩個不同檔案中<br />想說可以分割mp3合併應不太難才對吧<br />果然在<a href="http://www.google.com.tw" target="_blank">G大神</a>的協助下不到幾分鐘就解決了這個問題<br />而且還不需安裝任何套件或軟體直接使用cat這個指令就可以輕鬆達成囉!&nbsp;<img src="//s.pixfs.net/f.pixnet.net/images/emotions/teeth_smile.gif" alt="" border="0" /></p>
<p>首先要先切換到要合併的mp3所在的目錄中<br />假設要合併的mp3檔案名稱為1-1.mp3及1-2.mp3<br />即輸入：</p>
<p><strong>cat 1-1.mp3 1-2.mp3 &gt; 01.mp3</strong></p>
<p>即可完成檔案的合併囉!<img src="//s.pixfs.net/f.pixnet.net/images/emotions/wink_smile.gif" alt="" border="0" /></p>
<hr />
<p>參考網址:<a href="http://goo.gl/pon87" target="_blank">ubuntu上的copy /b (合併檔案)</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>  <div class="more"><a href="https://david50.pixnet.net/blog/post/32338167">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F32338167"></div>]]></content:encoded>
      <pubDate>Sat, 29 Jun 2013 15:34:15 +0800</pubDate>
      <category><![CDATA[Linux]]></category>
      <comments>https://david50.pixnet.net/blog/post/32338167#comments</comments>
    </item>
    <item>
      <title><![CDATA[[筆記]Setting default umask in Ubuntu 12.04]]></title>
      <link>https://david50.pixnet.net/blog/post/32081185</link>
      <guid>https://david50.pixnet.net/blog/post/32081185</guid>
      <description><![CDATA[在Ubuntu 10.10的時候就有記錄一篇更改default umask的筆記一直以來我的Ubuntu也不常升級沒想到這次升級到12.04後使用Ubuntu 10.10的方法己沒有做用的情況下只好再利用G大神的神力來尋找在Ubuntu 12.04更改default umask的方法
也不知道從啥時開始Ubuntu將default umask的設定都交給pam_umask這個moudle需要設定default umask需從 "/etc/login.defs" 這個檔案下手在終端機中輸入：
sudo madedit /et/clogin.defs
尋找UMASK後即可在讓行找到&ldquo;UMASK 022"將022更改為想要變更的權限存檔後再重新登入後新的umask即生效囉

參考資料：How to set system wide umask?
&nbsp;]]></description>
      <content:encoded><![CDATA[<p>在Ubuntu 10.10的時候就有記錄一篇<a href="http://goo.gl/YLKa0" target="_blank">更改default umask的筆記</a><br />一直以來我的Ubuntu也不常升級沒想到這次升級到12.04後<br />使用Ubuntu 10.10的方法己沒有做用的情況下<br />只好再利用<a href="http://www.google.com" target="_blank">G大神</a>的神力來尋找在Ubuntu 12.04更改default umask的方法</p>
<p>也不知道從啥時開始Ubuntu將default umask的設定都交給<a href="http://goo.gl/95sh6" target="_blank">pam_umask</a>這個moudle<br />需要設定default umask需從 <strong>"/etc/login.defs"</strong> 這個檔案下手<br />在終端機中輸入：</p>
<p><strong>sudo madedit /et/clogin.defs</strong></p>
<p>尋找UMASK後即可在讓行找到&ldquo;UMASK 022"<br />將022更改為想要變更的權限存檔後再重新登入後新的umask即生效囉<img src="//s.pixfs.net/f.pixnet.net/images/emotions/wink_smile.gif" alt="" border="0" /></p>
<hr />
<p>參考資料：<a href="http://goo.gl/XVyNR" target="_blank">How to set system wide umask?</a></p>
<p>&nbsp;</p>  <div class="more"><a href="https://david50.pixnet.net/blog/post/32081185">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F32081185"></div>]]></content:encoded>
      <pubDate>Sun, 12 May 2013 12:35:18 +0800</pubDate>
      <category><![CDATA[Linux]]></category>
      <comments>https://david50.pixnet.net/blog/post/32081185#comments</comments>
    </item>
    <item>
      <title><![CDATA[[Studio Classroom]Tim Duncan--A champion's heart]]></title>
      <link>https://david50.pixnet.net/blog/post/31995665</link>
      <guid>https://david50.pixnet.net/blog/post/31995665</guid>
      <description><![CDATA[這篇文章是2005年8月份空中英語教室內的文章當然也是有人PO在PTT上我才有機會能看到這篇文章雖然這篇文章算是歷史舊文章了但還是希望能保留這篇文章也順便學些英文囉^^

Tim Duncan--A champion's heart
提姆鄧肯--王者雄心
This NBA super star triumphs on and off the court
這位美國職籃巨星不論上場下場都很成功
&nbsp;
Growing up on St.Croix in the Virgin Islands, Tim Duncan never thought he&nbsp;would be a professional basketball player. During his childhood, Duncan was a&nbsp;competitive swimmer. Duncan only started playing basketball when Hurricane&nbsp;Hugo destroyed his practice pool in1989. He was about 13 years old at that&nbsp;time.
Two years later, NBA player Chris King saw Duncan play in a high-school&nbsp;basketball game. King was so impressed that he convinced the coach at Wake&nbsp;Forest University, King's former school, to recruit Duncan.
提姆鄧肯在維京群島的聖克洛伊成長，從未想過自己會變成一位職業籃球員。小時候，鄧肯是出色的游泳選手。1989年雨果颱風毀壞了練習泳池，那時他約十三歲。
兩年後，美國職籃球員克里斯金看到鄧肯在一場高中籃球賽中的表現，對他印象深刻，於是就說服之前就讀威克森林大學的教練網羅鄧肯。
&nbsp;
College Years
大學時光
At Wake Forest, Duncan excelled on the court. In fact, experts predicted he&nbsp;would be the NBA's No.1 draft pick if he left college after his junior year.&nbsp;But Duncan had made a pledge to his mother that he would graduate from&nbsp;college. Besides, he really enjoyed college life. He continued his studies at&nbsp;Wake Forest one more year and graduated with a degree in psychology.
That year, he was honored as college basketball's Player of the Year. And&nbsp;after graduating, he was still the No.1 NBA draft pick.
就讀威克森林大學時，鄧肯在球場表現出色。事實上，專家預言，假如他在唸完大三時離開學校，將會成為美國職籃的新秀狀元。但是鄧肯曾經向母親發誓，保證會唸完大學(鄧肯母親在他14歲時病逝)。而且他也非常喜愛大學生活。他繼續在威克森林大學讀了一年，獲得心理學學士學位。
那年，他獲得大學籃球年度球員的榮耀。畢業之後，他仍然以新秀狀元之姿進入美國職籃。
NBA all-star
美國職籃明星
For many players, the transition from college basketball to the NBA is a hard&nbsp;one. Players often take a few years to adjust to the tougher competition. If&nbsp;Duncan had a hard time, it didn't show. In 1998, the NBA named him its Rookie&nbsp;of the year.
Duncan is one of the few players who have been honored as an all-star for&nbsp;both offensive and defensive play. He not only scores for his team; he keeps&nbsp;the other team from scoring. That makes him a truly unique NBA player.
對許多球員來説，從大學籃球隊轉換到美國職籃是很辛苦的。通常他們都得花幾年的時間來適應這更加嚴苛的競爭。就算鄧肯真有過這樣艱困的調適時光，外人也看不出來。1998年，他獲得美國職籃的年度最佳新秀。
鄧肯是少數曾獲得進攻與防守明星兩項殊榮的球員。他不只為自己的球隊得分，也阻止對方得分。讓他成為真正傲視群倫的美國職籃球員。
&nbsp;
Humble champion
謙遜的冠軍
In 1999 and again in 2003, Duncan and his all-star teammate David Robinson&nbsp;helped the San Antonio Spurs win the NBA Championship. Duncan was&nbsp;particularly happy about their victory in 2003 because it was Robinson's&nbsp;final season.
Though Duncan was named MVP in both championships, he was quick to give&nbsp;credit to his coach and his teammates. This humble attitude has won Duncan&nbsp;admiration from the entire sports community. In fact, he and Robinson shared&nbsp;the 2003 Sports Illustrated Sportsman of the Year award for their selfless&nbsp;play on the court.
1999年以及2003年，鄧肯與他的明星球員隊友大衛羅賓森兩度協助聖安東尼奧馬刺隊贏得美國職籃冠軍。鄧肯對他們2003年的冠軍特別興奮，因為那是羅賓森最後一個球季。
雖然鄧肯在兩次冠軍賽中都獲選為最有價值球員，但是他卻馬上將榮耀歸功於教練與隊友。這種謙遜的態度，讓鄧肯獲得整個運動界的推崇。事實上，他和羅賓森以球場上無私的表現，共同獲得了2003年最佳運動精神獎的殊榮。
&nbsp;
Making the best of the hard times
化悲哀為力量
Along with his triumphs, Duncan, 29, has had to deal with his share of&nbsp;tragedies. In 1990, his mother died of cancer. Then 2002, his father alsodied of cancer. To honor his parents, Duncan and his wife, Amy, created the&nbsp;Tim Duncan Foundation. They host fundraiser s for cancer research. So far&nbsp;they've raised over $550,000 dollars.
Duncan also works with kids who have lost parents at an early age. And every&nbsp;time the Spurs play on their home court, he donates 40 game tickets to&nbsp;children from poor families.
When he's not playing basketball or doing charity work, Duncan visits his&nbsp;family. He really look up to his sisters and loves being around them. When he&nbsp;wants to relax, Duncan likes watching movies and surfing the Internet. Those&nbsp;hobbies are not surprising for a guy who has a reputation for being quiet.
Despite his quiet manner, Tim Duncan really stands out in the sporting&nbsp;world--and not just because he's 7 feet tall. This truly gifted athlete uses&nbsp;his big talent to make the world a better place.
在諸多勝利之餘，29歲的鄧肯仍舊必須面對他的人生悲劇。1990年，母親死於癌症。然後在2002年，父親也因癌症過世。為了紀念雙親，鄧肯和太太艾咪成立了鄧肯基金會。他們為癌症研究主持募款活動來籌募經費。到目前為止，他們已募得超過55萬美元(2005年)。
鄧肯也為幼年失親的孩子供獻心力。在每一次馬刺隊的主場比賽時，他都會捐出40張門票給窮困家庭的孩子。
打籃球及公益活動之餘，他會去探視家人。鄧肯十分尊重他的姐妹們，也樂於和她們在一起。想要放鬆時，他喜歡看電影及上網。這些嗜好對於一個以沈默寡言著稱的名人來説並不意外。
儘管態度內斂，提姆鄧肯在世界體壇仍十分醒目，這並不只因他身長七呎。這位天生的運動員用他的天賦異稟讓世界更美好。

資料來源：[NBA]Tim Duncan我中心的籃球之神沒有之一
&nbsp;]]></description>
      <content:encoded><![CDATA[<p>這篇文章是2005年8月份空中英語教室內的文章<br />當然也是有人PO在<a href="http://goo.gl/Tcs3k" target="_blank">PTT</a>上我才有機會能看到這篇文章<br />雖然這篇文章算是歷史舊文章了<br />但還是希望能保留這篇文章<br />也順便學些英文囉^^</p>
<hr />
<p>Tim Duncan--A champion's heart</p>
<p>提姆鄧肯--王者雄心</p>
<p>This NBA super star triumphs on and off the court</p>
<p>這位美國職籃巨星不論上場下場都很成功</p>
<p>&nbsp;</p>
<p>Growing up on St.Croix in the Virgin Islands, Tim Duncan never thought he&nbsp;would be a professional basketball player. During his childhood, Duncan was a&nbsp;competitive swimmer. Duncan only started playing basketball when Hurricane&nbsp;Hugo destroyed his practice pool in1989. He was about 13 years old at that&nbsp;time.</p>
<p>Two years later, NBA player Chris King saw Duncan play in a high-school&nbsp;basketball game. King was so impressed that he convinced the coach at Wake&nbsp;Forest University, King's former school, to recruit Duncan.</p>
<p>提姆鄧肯在維京群島的聖克洛伊成長，從未想過自己會變成一位職業籃球員。小時候，鄧肯是出色的游泳選手。1989年雨果颱風毀壞了練習泳池，那時他約十三歲。</p>
<p>兩年後，美國職籃球員克里斯金看到鄧肯在一場高中籃球賽中的表現，對他印象深刻，於是就說服之前就讀威克森林大學的教練網羅鄧肯。</p>
<p>&nbsp;</p>
<p>College Years</p>
<p>大學時光</p>
<p>At Wake Forest, Duncan excelled on the court. In fact, experts predicted he&nbsp;would be the NBA's No.1 draft pick if he left college after his junior year.&nbsp;But Duncan had made a pledge to his mother that he would graduate from&nbsp;college. Besides, he really enjoyed college life. He continued his studies at&nbsp;Wake Forest one more year and graduated with a degree in psychology.</p>
<p>That year, he was honored as college basketball's Player of the Year. And&nbsp;after graduating, he was still the No.1 NBA draft pick.</p>
<p>就讀威克森林大學時，鄧肯在球場表現出色。事實上，專家預言，假如他在唸完大三時離開學校，將會成為美國職籃的新秀狀元。但是鄧肯曾經向母親發誓，保證會唸完大學(鄧肯母親在他14歲時病逝)。而且他也非常喜愛大學生活。他繼續在威克森林大學讀了一年，獲得心理學學士學位。</p>
<p>那年，他獲得大學籃球年度球員的榮耀。畢業之後，他仍然以新秀狀元之姿進入美國職籃。</p>
<p><br />NBA all-star</p>
<p>美國職籃明星</p>
<p>For many players, the transition from college basketball to the NBA is a hard&nbsp;one. Players often take a few years to adjust to the tougher competition. If&nbsp;Duncan had a hard time, it didn't show. In 1998, the NBA named him its Rookie&nbsp;of the year.</p>
<p>Duncan is one of the few players who have been honored as an all-star for&nbsp;both offensive and defensive play. He not only scores for his team; he keeps&nbsp;the other team from scoring. That makes him a truly unique NBA player.</p>
<p>對許多球員來説，從大學籃球隊轉換到美國職籃是很辛苦的。通常他們都得花幾年的時間來適應這更加嚴苛的競爭。就算鄧肯真有過這樣艱困的調適時光，外人也看不出來。1998年，他獲得美國職籃的年度最佳新秀。</p>
<p>鄧肯是少數曾獲得進攻與防守明星兩項殊榮的球員。他不只為自己的球隊得分，也阻止對方得分。讓他成為真正傲視群倫的美國職籃球員。</p>
<p>&nbsp;</p>
<p>Humble champion</p>
<p>謙遜的冠軍</p>
<p>In 1999 and again in 2003, Duncan and his all-star teammate David Robinson&nbsp;helped the San Antonio Spurs win the NBA Championship. Duncan was&nbsp;particularly happy about their victory in 2003 because it was Robinson's&nbsp;final season.</p>
<p>Though Duncan was named MVP in both championships, he was quick to give&nbsp;credit to his coach and his teammates. This humble attitude has won Duncan&nbsp;admiration from the entire sports community. In fact, he and Robinson shared&nbsp;the 2003 Sports Illustrated Sportsman of the Year award for their selfless&nbsp;play on the court.</p>
<p>1999年以及2003年，鄧肯與他的明星球員隊友大衛羅賓森兩度協助聖安東尼奧馬刺隊贏得美國職籃冠軍。鄧肯對他們2003年的冠軍特別興奮，因為那是羅賓森最後一個球季。</p>
<p>雖然鄧肯在兩次冠軍賽中都獲選為最有價值球員，但是他卻馬上將榮耀歸功於教練與隊友。這種謙遜的態度，讓鄧肯獲得整個運動界的推崇。事實上，他和羅賓森以球場上無私的表現，共同獲得了2003年最佳運動精神獎的殊榮。</p>
<p>&nbsp;</p>
<p>Making the best of the hard times</p>
<p>化悲哀為力量</p>
<p>Along with his triumphs, Duncan, 29, has had to deal with his share of&nbsp;tragedies. In 1990, his mother died of cancer. Then 2002, his father alsodied of cancer. To honor his parents, Duncan and his wife, Amy, created the&nbsp;Tim Duncan Foundation. They host fundraiser s for cancer research. So far&nbsp;they've raised over $550,000 dollars.</p>
<p>Duncan also works with kids who have lost parents at an early age. And every&nbsp;time the Spurs play on their home court, he donates 40 game tickets to&nbsp;children from poor families.</p>
<p>When he's not playing basketball or doing charity work, Duncan visits his&nbsp;family. He really look up to his sisters and loves being around them. When he&nbsp;wants to relax, Duncan likes watching movies and surfing the Internet. Those&nbsp;hobbies are not surprising for a guy who has a reputation for being quiet.</p>
<p>Despite his quiet manner, Tim Duncan really stands out in the sporting&nbsp;world--and not just because he's 7 feet tall. This truly gifted athlete uses&nbsp;his big talent to make the world a better place.</p>
<p>在諸多勝利之餘，29歲的鄧肯仍舊必須面對他的人生悲劇。1990年，母親死於癌症。然後在2002年，父親也因癌症過世。為了紀念雙親，鄧肯和太太艾咪成立了鄧肯基金會。他們為癌症研究主持募款活動來籌募經費。到目前為止，他們已募得超過55萬美元(2005年)。</p>
<p>鄧肯也為幼年失親的孩子供獻心力。在每一次馬刺隊的主場比賽時，他都會捐出40張門票給窮困家庭的孩子。</p>
<p>打籃球及公益活動之餘，他會去探視家人。鄧肯十分尊重他的姐妹們，也樂於和她們在一起。想要放鬆時，他喜歡看電影及上網。這些嗜好對於一個以沈默寡言著稱的名人來説並不意外。</p>
<p>儘管態度內斂，提姆鄧肯在世界體壇仍十分醒目，這並不只因他身長七呎。這位天生的運動員用他的天賦異稟讓世界更美好。</p>
<hr />
<p>資料來源：[NBA]<a href="http://ppt.cc/FKQV" target="_blank">Tim Duncan我中心的籃球之神沒有之一</a></p>
<p>&nbsp;</p>  <div class="more"><a href="https://david50.pixnet.net/blog/post/31995665">(繼續閱讀...)</a><img src="//pixanalytics.com/pa.gif?t=front_blog_feed&document.URL=https%3A%2F%2Fdavid50.pixnet.net%2Fblog%2Fpost%2F31995665"></div>]]></content:encoded>
      <pubDate>Thu, 25 Apr 2013 20:58:56 +0800</pubDate>
      <category><![CDATA[NBA News and Translation]]></category>
      <comments>https://david50.pixnet.net/blog/post/31995665#comments</comments>
    </item>
  </channel>
</rss>