<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest topics for the forum "網路設備管理 Network Device Management"]]></title>
		<link>https://www.andowson.com/forums/show/26.page</link>
		<description><![CDATA[The newest discussed topics in the forum "網路設備管理 Network Device Management"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>自動備份 Cisco 3750G-24TS-S1U 網路設定檔</title>
				<description><![CDATA[ 由於公司資安規定需要定期備份網路設備的網路設定檔，如果每個月都要進到console介面去操作一次，輸入一堆指令也是滿花時間的； 
<br>
另外一個作法是登入命令列界面，然後手動去下copy startup-config tftp://${tftp.host} 這個指令，雖然是比較快速了些，但總是感覺多一件事情在身上，到時要是別的事忙起來，還是怕會忘記。 
<br>
<br>
由於懶惰是人的天性，所以總是會想如何把事情自動化，於是我就想用ant的telnet task來自動登入Cisco Switch並執行copy startup-config指令，方法大致如下： 
<br>
1.在備份用的主機上架設TFTP Server 
<br>
2.下載及安裝JRE、Ant 1.7.1及telnet task所需之commons-net套件。 
<br>
3.編輯一個build.xml及一個build.properties檔案 
<br>
4.執行 ant cisco看是否可正常備份 
<br>
5.寫一個shell script檔將該ant指令包裝起來 
<br>
6.設定/etc/crontab自動執行該shell script檔 
<br>
<br>
由於手邊只有Linux主機可以當備份主機使用，底下再簡單說明一下上述步驟 
<br>
1.安裝TFTP Server可以參考這篇 
<br>
[url]http://www.andowson.com/posts/list/544.page[/url]，安裝完成後，手動建立一個/tftpboot的目錄，並把tftpboot的根目錄(Base Directory)設定777 
<br>
<br>
2.將把下載來的ant zip檔解壓縮到/root/cisco底下，設定環境變數ANT_HOME指向安裝的目錄，並在PATH變數加上$ANT_HOME/bin。然後把commons-net的jar檔放到ANT_HOME的lib目錄下。 
<br>
<br>
3.可以參考底下兩個範例，將這兩個檔案存到/root/cisco目錄下 
<br>
build.xml範例如下： 
<br>
[code=xml] 
<br>
&lt;?xml version="1.0" encoding="Big5" ?&gt; 
<br>
<br>
&lt;project name="backup" default="cisco" basedir="."&gt; 
<br>
 &lt;description&gt;Network Switch Config Backup&lt;/description&gt; 
<br>
<br>
 &lt;!-- Enable access to build.properties variables --&gt; 
<br>
 &lt;property file="build.properties" /&gt; 
<br>
 &lt;property name="backup.root.dir" value="/root/cisco" /&gt; 
<br>
 &lt;property name="cisco.backup.dir" value="${backup.root.dir}/${cisco.ip}" /&gt; 
<br>
 &lt;property name="tftp.root" value="/tftpboot" /&gt; 
<br>
<br>
 &lt;!-- Init --&gt; 
<br>
 &lt;target name="init" description="Create backup directory"&gt; 
<br>
 &lt;tstamp&gt; 
<br>
 &lt;format property="TODAY" pattern="yyyyMMdd" /&gt; 
<br>
 &lt;/tstamp&gt; 
<br>
 &lt;property name="cisco.cfg" value="cisco_${TODAY}.cfg" /&gt; 
<br>
 &lt;mkdir dir="${backup.root.dir}" /&gt; 
<br>
 &lt;mkdir dir="${backup.root.dir}/${cisco.ip}" /&gt; 
<br>
 &lt;touch file="${tftp.root}/${cisco.cfg}"/&gt; 
<br>
 &lt;chmod file="${tftp.root}/${cisco.cfg}" perm="ugo+rwx"/&gt; 
<br>
 &lt;/target&gt; 
<br>
<br>
 &lt;!-- Backup cisco Config --&gt; 
<br>
 &lt;target name="cisco" depends="init" description="Backup cisco config"&gt; 
<br>
 &lt;property name="cisco.cfg" value="cisco_${TODAY}.cfg" /&gt; 
<br>
 &lt;telnet server="${cisco.ip}"&gt; 
<br>
 &lt;read timeout="5"&gt;Username: &lt;/read&gt; 
<br>
 &lt;write&gt;${cisco.username}&lt;/write&gt; 
<br>
 &lt;read timeout="5"&gt;Password: &lt;/read&gt; 
<br>
 &lt;write&gt;${cisco.password}&lt;/write&gt; 
<br>
 &lt;read timeout="5"&gt;&gt;&lt;/read&gt; 
<br>
 &lt;write&gt;enable&lt;/write&gt; 
<br>
 &lt;read timeout="5"&gt;Password: &lt;/read&gt; 
<br>
 &lt;write&gt;${enable.password}&lt;/write&gt; 
<br>
 &lt;read timeout="5"&gt;#&lt;/read&gt; 
<br>
 &lt;write&gt;copy startup-config tftp://${tftp.host}/${cisco.cfg}&lt;/write&gt; 
<br>
 &lt;read timeout="30"&gt;Address or name of remote host [${tftp.host}]?&lt;/read&gt; 
<br>
 &lt;write&gt;${tftp.host}&lt;/write&gt; 
<br>
 &lt;read timeout="30"&gt;Destination filename [${cisco.cfg}]?&lt;/read&gt; 
<br>
 &lt;write&gt;${cisco.cfg}&lt;/write&gt; 
<br>
 &lt;read timeout="30"&gt;bytes/sec)&lt;/read&gt; 
<br>
 &lt;write&gt;exit&lt;/write&gt; 
<br>
 &lt;/telnet&gt; 
<br>
 &lt;move file="${tftp.root}/${cisco.cfg}" todir="${cisco.backup.dir}" /&gt; 
<br>
 &lt;/target&gt; 
<br>
<br>
&lt;/project&gt; 
<br>
[/code] 
<br>
<br>
build.properties範例如下：請視您真正的情況修改對應的參數值，下列例子中我們的TFTP主機IP是172.16.38.1，Cisco Switch的IP是172.16.38.254。 
<br>
[code] 
<br>
tftp.host=172.16.38.1 
<br>
cisco.ip=172.16.38.254 
<br>
cisco.username=admin 
<br>
cisco.password=admin 
<br>
enable.password=cisco 
<br>
[/code] 
<br>
<br>
4.開啟一個shell命令列視窗，然後切換到build.xml及build.properties所存放的目錄/root/cisco下，接著執行 
<br>
ant cisco 
<br>
<br>
5.將上述動作編輯成一個backup_config.sh 
<br>
backup_config.sh: 
<br>
[code=bash] 
<br>
#!/bin/bash 
<br>
ANT_HOME=/root/cisco/apache-ant-1.7.1 
<br>
JAVA_HOME=/usr/java/latest 
<br>
PATH=$PATH:$ANT_HOME/bin:$JAVA_HOME/bin 
<br>
ant cisco 
<br>
[/code] 
<br>
<br>
6.編輯 /etc/crontab，並設定backup_config.sh執行的頻率。 
<br>
# 每個月備份網路設備的網路設定 (2011.11.18 by Andowson) 
<br>
30 5 23 * * root /root/cisco/backup_config.sh &gt; /var/log/backup_config.log 2&gt;&amp;1]]></description>
				<guid isPermaLink="true">https://www.andowson.com/posts/preList/566/1178.page</guid>
				<link>https://www.andowson.com/posts/preList/566/1178.page</link>
				<pubDate><![CDATA[Fri, 18 Nov 2011 19:19:21]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>回覆:請問誰有Alteon Application Switch的中文技術文件嗎？</title>
				<description><![CDATA[ 哇！真是如獲『至寶』，版大謝謝您了。感謝您。非常感謝您啊！]]></description>
				<guid isPermaLink="true">https://www.andowson.com/posts/preList/459/939.page</guid>
				<link>https://www.andowson.com/posts/preList/459/939.page</link>
				<pubDate><![CDATA[Fri, 17 Dec 2010 13:54:44]]> GMT</pubDate>
				<author><![CDATA[ pan21]]></author>
			</item>
			<item>
				<title>回覆:[轉載]Juniper防火牆配置備份</title>
				<description><![CDATA[ pan21您好: 
<br>
 我沒用過Checkpoint Secure Platform，可能沒辦法PO什麼文章上來，另外，建議要談別種品牌的防火牆設備，還是另開一個新主題討論比較好，以免模糊了原主題的焦點。]]></description>
				<guid isPermaLink="true">https://www.andowson.com/posts/preList/385/935.page</guid>
				<link>https://www.andowson.com/posts/preList/385/935.page</link>
				<pubDate><![CDATA[Thu, 16 Dec 2010 13:10:55]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>解決使用Alteon 2216設定HTTPS服務負載平衡卻出現找不到網站的現象</title>
				<description><![CDATA[ 前陣子對公司一個網站加上HTTPS的負載平衡設定，當時是使用delay binding+insert mode cookie-based persistence作設定，結果卻出現一個怪異現象，就是可以用telnet去連443 port，但是在瀏覽器網址上輸入https://網址，卻是找不到網站。 
<br>
首先，我懷疑是未認證的SSL憑證有問題，於是到這家[url=http://www.instantssl.com/ssl-certificate-products/free-ssl-certificate.html]Instant SSL[/url]去申請一個免費90天的憑證來裝。結果還是不行。 
<br>
再來，看了一下原廠的[url=http://www116.nortel.com/docs/bvdoc/alteon/appl_switch/asos_23.0.2_asem_4.0.2/320507-A_02.pdf]文件[/url]，發現有個SSL Session ID-Based Persistence的方式，於是將persistence binding改成選擇SSL Session ID方式，果然這樣子就可以了。 
<br>
<br>
參考文件： 
<br>
http://www116.nortel.com/docs/bvdoc/alteon/appl_switch/asos_23.0.2_asem_4.0.2/320507-A_02.pdf]]></description>
				<guid isPermaLink="true">https://www.andowson.com/posts/preList/361/689.page</guid>
				<link>https://www.andowson.com/posts/preList/361/689.page</link>
				<pubDate><![CDATA[Mon, 16 Nov 2009 19:06:40]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>[轉貼]IP/Subnet子網路切割表示法</title>
				<description><![CDATA[ 以前讀網路概念時，看到IP/Subnet的教學，我的直覺就是「無趣」，因為一方面自己用不到，二來是幹嘛推算這些無聊的二進位？尤其IP /Subnet表示法，為何不用「*」號等DNS hostname這樣直覺的表示法呢？發明人是否故意要考驗初學者的腦袋轉換速度？因此，我當時僅讀個概念，根本沒把背後所代表的深層知識理解。後來在研究所[url=http://web.ntpu.edu.tw/~juang/class.htm]莊東穎老師[/url]教的「系統與網路」課程時接觸到它，當時仍用IP暴力AND運算法混過去，直到現在研究Proftpd的Class設定，必須針對連線來源IP的子網路作權限區別，才再次重新拆解這種表示法的概念。假如當時的書本寫得像這樣簡單明瞭，腦袋瓜子就容易吸收了... 
<br>
<br>
在IPv4的協定下，IP位址是由4個8位元組成的數字來表達，如200.1.1.130。一個IP位址分為網路位址(Network Address)+主機位址(Host Address)，依網路位址所佔的位元數不同而分為A/B/C/D級網路。IP數字的0及255是預設的主機及廣播位址無法使用，所以每個數字可用的 IP位址變化只有254個(256-2)，這也就是一般C級網段的Gateway IP都預設x.x.x.254的緣故。IPv4的位址因為ABCD型網段的配法而無法完全應用到254四次方那樣多的可用IP值，隨著世界上主機數遞增，IP位址漸漸不夠用了！在IPv6的應用尚未完全普及之時，就得利用切分子網路(Subnet)的方式來有效分配IP位址。 
<br>
<br>
某台網路主機，它的IP及子網路表示法為200.1.1.130/28，從這樣簡短的字句，你該立刻看出什麼呢? 
<br>
<br>
1.子網路的遮罩位址為何? 
<br>
該數字28是代表遮罩IP位址的網路位址所佔位元數，即：11111111.11111111.11111111.11110000，遮罩位元為1者是讓 IP通過(合法)，0者為阻擋，所以從上述的32位元分布，我們得知它的網段型態是屬於C型位址，因此十進位的遮罩位址就是 255.255.255.240(只需要求算右邊那四個1)，即 128 + 64 + 32 + 16 = 240 
<br>
<br>
2.可切成幾個子網路? 
<br>
數字1是讓IP通過，所以只要注意1的位元變化組合(因為後面的0怎麼變化都會被擋住)，(1111)= 2^4 = 16，共有16種變化。 
<br>
<br>
3.每個子網段有幾個IP值? 
<br>
子網路ip數為 256/16 = 16 (有效IP為14，因為頭尾IP要去除) 
<br>
<br>
4.每個子網路的IP起迄位址? 
<br>
200.1.1.0-15，200.1.1.16-31，200.1.1.32-48，...，200.1.1.240-255 
<br>
例如，主機IP為200.1.1.130/28的所在子網路起迄IP為: 130/16 = 8， 16 * 8 = 128，故在 200.1.1.128-143。 
<br>
<br>
假如上述你都了解的話，讓我們反過來思考，用子網路IP起迄位址，反推出它的IP/Subnet表達格式？例如，我們要讓某C級網段(192.83.184.*)下的IP合法通過，這組子網路該怎麼用IP/Subnet格式表示呢? 
<br>
<br>
首先，第四個IP值不遮封，因此遮罩IP位址的2進位是: 11111111.11111111.11111111.00000000 (255.255.255.0)，其網路位址位元數共24個，因此寫法是: 192.83.184.0/24，依此類推，B級網段就是192.84.0.0/16，全部開放就是: 0.0.0.0/0。所以，從IP位址的二進位表示法的位元分布，就可看出其背後的隱藏資訊，只要您能了解這些概念就可直接看出來，不需再作 IP(192.83.184.0)轉二進位的運算(江湖一點訣)。]]></description>
				<guid isPermaLink="true">https://www.andowson.com/posts/preList/316/593.page</guid>
				<link>https://www.andowson.com/posts/preList/316/593.page</link>
				<pubDate><![CDATA[Tue, 28 Apr 2009 15:28:39]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>負載平衡交換器設定：Insert mode cookie-based persistence</title>
				<description><![CDATA[ 謝謝老大的分享，受教 
<br>
不過，這個 solution 應該只能用在 HTTP 的服務，一般 TCP 的服務好像沒辦法 
<br>
透過 ab 去作壓力測試 ab -n 50000 -c 200 <a class="snap_shots" href="http://203.66.125.200/" target="_blank">http://203.66.125.200/</a>
<br>
效能似乎也沒甚麼影響，似乎不錯 
<br>
<br>
增加前： 
<br>
ap Server 1: 
<br>
Complete requests: 50000 
<br>
Failed requests: 5866 
<br>
ap Server 2: 
<br>
Complete requests: 50000 
<br>
Failed requests: 5944 
<br>
ap Server 3: 
<br>
Complete requests: 50000 
<br>
Failed requests: 6050 
<br>
ap Server 4: 
<br>
Complete requests: 50000 
<br>
Failed requests: 5375 
<br>
ap Server 5: 
<br>
Complete requests: 50000 
<br>
Failed requests: 5280 
<br>
ap Server 6: 
<br>
Complete requests: 50000 
<br>
Failed requests: 5334 
<br>
<br>
增加後： 
<br>
ab Server 1: 
<br>
Complete requests: 50000 
<br>
Failed requests: 5655 
<br>
ab Server 2: 
<br>
Complete requests: 50000 
<br>
Failed requests: 5949 
<br>
ab Server 3: 
<br>
Complete requests: 50000 
<br>
Failed requests: 5835 
<br>
ab Server 4: 
<br>
Complete requests: 50000 
<br>
Failed requests: 5375 
<br>
ab Server 5: 
<br>
Complete requests: 50000 
<br>
Failed requests: 5494 
<br>
ab Server 6: 
<br>
Complete requests: 50000 
<br>
Failed requests: 5365 
<br>
<br>
<br>]]></description>
				<guid isPermaLink="true">https://www.andowson.com/posts/preList/193/402.page</guid>
				<link>https://www.andowson.com/posts/preList/193/402.page</link>
				<pubDate><![CDATA[Sat, 28 Jun 2008 03:43:44]]> GMT</pubDate>
				<author><![CDATA[ ofather]]></author>
			</item>
	</channel>
</rss>