- 9月 07 週四 201700:09
[旅遊]沖繩4天3夜4G Wi-Fi分享器及7淘卡使用心得
- 5月 31 週三 201715:00
[筆記]Linux - dd convert and copy a file
dd 在manual裡的解釋是convert and copy a file
語法:dd if=輸入檔案 of=輸出檔案 選項
最常使用的大概就是光碟或硬碟的複製
ubuntu@ubuntu ~ $ sudo dd if=/dev/sda1 of=/dev/sdb1 #將第一顆硬碟的第一個磁區複製到第二顆硬碟的第一個磁碟。
- 5月 29 週一 201715:00
[筆記]Cisco基本指令-VTP
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
- 5月 26 週五 201715:00
[筆記]Cisco基本指令-分割子介面(Sub-Interface)
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 網段為 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 #查看介面狀態 Interface IP-Address OK? Method Status Protocol FastEthernet0/0 192.168.100.254 YES manual up up FastEthernet0/0.10 192.168.10.254 YES manual up up #新增的子介面已建立起來了 FastEthernet0/1 unassigned YES unset administratively down down Vlan1 unassigned YES unset administratively down down Router#configure terminal #進入全域模式 Enter configuration commands, one per line. 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 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 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 Router(config-subif)#end #切換回enable模式 %SYS-5-CONFIG_I: Configured from console by console Router#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 192.168.100.254 YES manual up up FastEthernet0/0.10 192.168.10.254 YES manual up up FastEthernet0/0.20 192.168.20.254 YES manual up up FastEthernet0/0.30 192.168.30.254 YES manual up up FastEthernet0/0.40 192.168.40.254 YES manual up up #子介面及IP均設定完成 FastEthernet0/1 unassigned YES unset administratively down down Vlan1 unassigned YES unset administratively down down
- 5月 24 週三 201715:39
[筆記]Linux-Access Control List(ACL)
ACL(Access Control List):主要的目的是在Linux系統提供傳統的檔案及目錄存取權限之外,另外開放更細部權限設定功能。
啟用ACL:
由於Linux POSIX ACL 預設是關閉,因此需要透過檔案系統的啟用才能用此功能
ubuntu@ubuntu:~$ vim /etc/fstab #編輯/etc/fstab LABEL=cloudimg-rootfs /home ext4 defaults,acl 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-- #其他使用者權限
- 5月 19 週五 201715:00
[筆記]Cisco基本指令-VLAN

VLAN(Virtual Local Area Network)虛擬區域網路,是以邏輯連線取代區域網路所定義的實體連線,VLAN提供了邏輯分割區域網路的方法來切割LAN,也可控制LAN的大小,讓管理時更加有彈性。
Access Port & Trunk Port
每個Switch Port有兩種運作模式,一種是Access Mode,另一種是Trunk Mode,當設定為Access Mode時該Port只能指派給一個VLAN,也只允許所屬VLAN的封包通過,如果是Trunk Port,則允許任何VLAN封包通過(在預設情況下)。
查看VLAN狀態:show vlan brief
Switch#show vlan brief #先查看目前VLAN狀態 VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 Fa0/5, Fa0/6, Fa0/7, Fa0/8 Fa0/9, Fa0/10, Fa0/11, Fa0/12 Fa0/13, Fa0/14, Fa0/15, Fa0/16 Fa0/17, Fa0/18, Fa0/19, Fa0/20 Fa0/21, Fa0/22, Fa0/23, Fa0/24 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active
建立VLAN
- 5月 17 週三 201715:00
[筆記]Linux協助管理指令
Linux中有許多指令是方便管理者快速管理系統的小工具,也可將這些指令在運用在script中以增加管理者的方便性。
echo
echo是個很常用的指令,可將輸入的文字顯示在營幕上也可利用">"或">>"將輸入的文字寫入檔案,也可叫出變數內容。
將輸入的文字顯示在營幕
ubuntu@ubuntu:~$ echo Hi Welcome Hi Welcome
輸入的文字寫入檔案
ubuntu@ubuntu:~$ echo abc >echotest.txt #將abc導入echotest.txt ubuntu@ubuntu:~$ ls echotest.txt #echotest.txt被建立了 ubuntu@ubuntu:~$ cat echotest.txt #顯示echotest.txt檔案內容 abc
- 5月 12 週五 201715:00
[筆記]Cisco DHCP Relay(IP Helper)
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網段,所以必需要此網段加入路由表中
- 5月 10 週三 201715:00
[筆記]Quota磁碟配額
磁碟配額(quota)在以前上課時就有上過了,但久沒用都忘的差不多了,這次考網乙也有考到,所以再抓來複習一下,順便做個筆記以防以後還要用到囉!![]()
修改/etc/fstab檔
ubuntu@ubuntu:/home$ sudo vim /etc/fstab LABEL=cloudimg-rootfs /home ext4 defaults,usrquota,grpquota 0 0 #在要啟用quota之分割區(/home)第4個欄位最後(defaults後)加入usrquota,grpquota /swapfile swap swap defualts 0 0 存檔後離開 重新掛載分額區
ubuntu@ubuntu:/home$ sudo mount -o remount /home #重新掛載要啟用quota之分割區
- 5月 05 週五 201715:00
[筆記]Cisco基本指令-Port Security
啟用port-security
啟用port-security前需先將switchport mode由dynimic改為access,若無更改則會出現錯誤訊息。
Switch(config)#interface FastEthernet 0/1 進入FastEthernet0/1介面設定 Switch(config-if)#switchport port-security 啟用port-secruity Command rejected: FastEthernet0/1 is a dynamic port. 啟用失敗 Switch(config-if)#switchport mode access 將switchport mode更改為存取埠(access)模式 Switch(config-if)#switchport port-security 啟用port-secruity 更改完後FastEthernet0/1介面即啟用port-security
查看port-security狀態
Switch#show port-security interface fastEthernet 0/1 查看FastEthernet0/1介面port-security設定 Port Security : Enabled Port Security已啟用 Port Status : Secure-down 因尚未連接設備所以是Secure-down Violation Mode : Shutdown Aging Time : 0 mins Aging Type : Absolute SecureStatic Address Aging : Disabled Maximum MAC Addresses : 1 Total MAC Addresses : 0 Configured MAC Addresses : 0 Sticky MAC Addresses : 0 Last Source Address:Vlan : 0000.0000.0000:0 因尚未連接設也未記錄MAC Address Security Violation Count : 0
在FastEthernet0/1接上設備後再查看port-security狀態