flow record NETFLOW-RECORD
match ipv4 tos
match ipv4 protocol
match ipv4 source address
match ipv4 destination address
match transport source-port
match transport destination-port
collect transport tcp flags
collect interface input
collect counter bytes long
collect counter packets long
collect counter bytes permanent
collect counter packets permanent
collect timestamp sys-uptime first
collect timestamp sys-uptime last
!
flow exporter NETFLOW-EXPORTER
destination 192.168.88.100
source Vlan300
transport udp 9996
!
flow monitor NETFLOW-MONITOR
exporter NETFLOW-EXPORTER
cache timeout active 60
record NETFLOW-RECORD
!
sampler NETFLOW-FLOWSAMPLER
mode random 1 out-of 500
!
interface GigabitEthernet1/0/1
ip flow monitor NETFLOW-MONITOR sampler NETFLOW-FLOWSAMPLER input
(繼續閱讀...)
2018年3月16日
2018年2月2日
Cisco NX-OS CLI - Part2
| Cisco IOS CLI | Cisco NX-OS CLI |
|---|---|
| Configuring a Routed Interface |
| interface gigabitethernet 1/1
ip address 192.168.1.1 255.255.255.0
no shutdown
| interface ethernet 1/1
ip address 192.168.1.1/24
no shutdown
|
|---|
| Configuring a Switched Interface (VLAN 10) |
| vlan 10 interface gigabitethernet 1/1
switchport
switchport mode access
switchport access vlan 10
no shutdown
| vlan 10 interface ethernet 1/1
switchport
switchport mode access
switchport access vlan 10
no shutdown
|
|---|
| Configuring a Switched Virtual Interface (SVI) |
| Cisco IOS Software does not have the ability to enable or disable SVI interfaces using the feature command. interface vlan 10
ip address 192.168.1.1 255.255.255.0
no shutdown
| feature interface-vlan interface vlan 10
ip address 192.168.1.1./24
no shutdown
|
|---|
| Configuring a Switched Trunk Interface |
| interface GigabitEthernet 1/1
switchport
switchport trunk encapsulation dot1q
switchport trunk native vlan 2
switchport trunk allowed vlan 10,20
switchport mode trunk
no shutdown
| interface ethernet 1/1
switchport mode trunk
switchport trunk allowed vlan 10,20
switchport trunk native vlan 2
no shutdown
|
|---|
| Configuring a Routed Trunk Sub-Interface |
| interface gigabitethernet 1/1
no switchport
no shutdown
interface gigabitethernet1/1.10
encapsulation dot1Q 10
ip address 192.168.1.1 255.255.255.0
no shutdown
| interface ethernet 1/1
no switchport
no shutdown
interface ethernet 1/1.10
encapsulation dot1q 10
ip address 192.168.1.1/24
no shutdown
|
|---|---|
Cisco NX-OS CLI - Part1
| Cisco IOS CLI | Cisco NX-OS CLI |
|---|---|
| Default User Prompt |
| c6500> | n7000# |
|---|
| Entering Configuration Mode |
| c6500# configure terminal | n7000# configure terminal |
|---|
| Saving the Running Config to the Startup Config (nvram) |
| c6500# write memory
or
c6500# copy running-config startup-config
| n7000# copy running-config startup-config |
|---|
| Erasing the startup config (nvram) |
| c6500# write erase | n7000# write erase |
|---|
| Installing a License |
| Cisco IOS Software does not require a license file installation. | n7000# install license bootflash:license_file.lic |
|---|
| Interface Naming Convention |
| interface Ethernet 1/1
interface FastEthernet 1/1
interface GigabitEthernet 1/1
interface TenGigabitEthernet 1/1
| interface Ethernet 1/1 |
|---|
| Default VRF Configuration (management) |
| Cisco IOS Software doesn’t enable VRFs by default. | vrf context management |
|---|
| Configuring the Software Image Boot Variables |
| boot system flash sup-bootdisk:s72033-ipservicesk9_wan-mz.122-33.SXH1.bin | boot kickstart bootflash:/n7000-s1-kickstart.4.0.4.bin sup-1
boot system bootflash:/n7000-s1-dk9.4.0.4.bin sup-1
boot kickstart bootflash:/n7000-s1-kickstart.4.0.4.bin sup-2
boot system bootflash:/n7000-s1-dk9.4.0.4.bin sup-2
|
|---|
| Enabling Features |
| Cisco IOS Software does not have the functionality to enable or disable features. | feature ospf |
|---|
| Enabling TELNET (SSHv2 is recommended) |
| Cisco IOS Software enables TELNET by default. | feature telnet |
|---|---|
| Configuring the Console Timeout |
| line console 0
exec-timeout 15 0
login
| line console
exec-timeout 15
|
|---|---|
| Configuring the VTY Timeout and Session Limit |
| line vty 0 9
session-limit 10
exec-timeout 15 0
login
| line vty
session-limit 10
exec-timeout 15
|
|---|
2017年11月2日
Enable SSHv2 on Cisco Router & Switch
Steps to enable SSHv2 on Cisco Router & Switch
1. Define the hostname
2. configure the domain name
3. Specifies the RSA key pair to use for using SSH.
R2(config)#ip ssh rsa key-pair name {key-pair name}
By doing so SSH version 1.5 is deactivated
4. For SSH Version 2, the modulus size must be at least 768 bits.
R2(config)# crypto key generate rsa usage-keys label {keypair-name} modulus 768
4. Enable SSH version 2
5. Check the version with "show ip ssh"
(繼續閱讀...)
1. Define the hostname
2. configure the domain name
3. Specifies the RSA key pair to use for using SSH.
R2(config)#ip ssh rsa key-pair name {key-pair name}
By doing so SSH version 1.5 is deactivated
4. For SSH Version 2, the modulus size must be at least 768 bits.
R2(config)# crypto key generate rsa usage-keys label {keypair-name} modulus 768
4. Enable SSH version 2
5. Check the version with "show ip ssh"
2016年11月20日
Cisco Troubleshooting Command
terminal length 0
sh run
sh ver
sh vtp status
sh vtp password
sh vlan
sh int status
sh int description
sh ip int bri
sh spanning-tree
sh spanning-tree sum
sh spanning-tree root
sh cdp neighbors
sh cdp entry * protocol
sh cdp neighbors detail
sh lldp
(繼續閱讀...)
sh run
sh ver
sh vtp status
sh vtp password
sh vlan
sh int status
sh int description
sh ip int bri
sh spanning-tree
sh spanning-tree sum
sh spanning-tree root
sh cdp neighbors
sh cdp entry * protocol
sh cdp neighbors detail
sh lldp
(繼續閱讀...)
2016年9月30日
2016年8月29日
Cisco BGP 調整Weight 與Local_PREF
透過route-map調整Weight 與Local_PREF的值,來達到控制連出路徑的功能
router bgp 65002
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 65051
neighbor 1.1.1.1 ebgp-multihop 2
neighbor 1.1.1.1 soft-reconfiguration inbound
neighbor 1.1.1.1 route-map changelocal in
!
ip prefix-list any-route seq 5 permit 0.0.0.0/0 le 32
!
ip prefix-list google-local-140 seq 5 permit 12.0.0.0/8 le 32
!
ip prefix-list google-local-50 seq 5 permit 8.0.0.0/8 le 32
!
ip prefix-list google-route seq 5 permit 8.0.0.0/8 le 32
!
(繼續閱讀...)
router bgp 65002
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 65051
neighbor 1.1.1.1 ebgp-multihop 2
neighbor 1.1.1.1 soft-reconfiguration inbound
neighbor 1.1.1.1 route-map changelocal in
!
ip prefix-list any-route seq 5 permit 0.0.0.0/0 le 32
!
ip prefix-list google-local-140 seq 5 permit 12.0.0.0/8 le 32
!
ip prefix-list google-local-50 seq 5 permit 8.0.0.0/8 le 32
!
ip prefix-list google-route seq 5 permit 8.0.0.0/8 le 32
!
(繼續閱讀...)
2016年8月25日
BGP_LAB實作
因為工作的需要,最近又開始了下班回家做LAB的人生Orz.....開始複習起了BGP協定,只不過這次是用Unified Networking Lab的Cisco模擬器來建立BGP LAB,搭配bgpsimple這隻BGP程式來產生上游ISP(AS65000) Internet Transit的BGP route送給LAB裡面的Router,以下為實作架構圖,練習建立eBGP peer和iBGP peer,個人覺得BGP最難的不是設定的方式,而是整個背後運作的原理啊!!!(繼續努力K書中~)
ISP-BGP-PE#show running-config
version 15.2
service timestamps debug datetime localtime
service timestamps log datetime localtime
!
hostname ISP-BGP-PE
!
boot-start-marker
boot-end-marker
!
2016年8月14日
2016年8月1日
IPv6 LAB 實作
實作架構圖

ISP_Router#show running-config
Building configuration...
Current configuration : 839 bytes
!
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname ISP_Router
!
ip cef
ipv6 unicast-routing
!
ipv6 cef
!
interface GigabitEthernet0/0
ip address 210.61.79.50 255.255.255.252
duplex auto
speed auto
ipv6 address 2001:B034:700:400::1:2/112
ipv6 enable
!
2016年2月29日
2015年6月15日
Cisco Switch 自動備份設定檔
Cisco Switch可利用tftp方式將show run後的結果,儲存於tftp server上,可供日後快速還原設定。在每台要自動備份設定檔Cisco Switch上面,利用kron排程指令,設定每天的凌晨5:30將config檔,以tftp的方式,轉送到tftp server上面,紅色字的地方代表設備的名稱存檔,依實際需求更改。以下為設定範例
先設定排程指令與tftp server IP
config t
kron policylist
backup
cli write
cli show run | redirect tftp://192.168.0.50/ DemoSW .cfg
exit
設定排程指令執行的時間
kron occurrence backup at 05:30 recurring
policylist
backup
end
存檔並顯示排程設定
write
show kron schedule
(繼續閱讀...)
先設定排程指令與tftp server IP
config t
kron policylist
backup
cli write
cli show run | redirect tftp://192.168.0.50/ DemoSW .cfg
exit
設定排程指令執行的時間
kron occurrence backup at 05:30 recurring
policylist
backup
end
存檔並顯示排程設定
write
show kron schedule
(繼續閱讀...)
2015年5月9日
Cisco Switch 端口限速
低階端Cisco Switch只能針對Inbound流量限速
流量限速設定方式如下
先在Global端啟用Qos功能
mls qos
(繼續閱讀...)
流量限速設定方式如下
先在Global端啟用Qos功能
mls qos
----------------------------------------------
5M範本
----------------------------------------------
設定ACL指定來源IP
ip access-list extended ACL_5M
permit ip any any
指定CLASS套用ACL範本,標記封包
class-map match-all CLASS_5M
match access-group name ACL_5M
指定policy套用CLASS,並指定限制速度
(此處限速5M,並且允許Burst 100KB,多出來的封包會Drop掉)
policy-map POLICY_5M
class CLASS_5M
police 5000000 100000 exceed-action drop
對要限速的端口做限速5M
interface GigabitEthernet0/2
service-policy input POLICY_5M
2014年11月9日
2014年7月27日
OSPF的7種鄰居狀態
OSPF路由器在完全鄰居之前,所經過的幾個狀態:
1. Down:此狀態還沒有與其他路由器交換信息。首先從其ospf接口向外發送hello分組,還並不知道DR(若為廣播網絡)和任何其他路由器。發送hello分組是,使用組播地址224.0.0.5。
2. Attempt:只適於NBMA網絡,在NBMA網絡中鄰居是手動指定的,在該狀態下,路由器將使用HelloInterval取代PollInterval來發送Hello包。
3. Init:在DeadInterval裡收到了Hello包,2-Way通信還沒有建立起來的狀態。
(繼續閱讀...)
1. Down:此狀態還沒有與其他路由器交換信息。首先從其ospf接口向外發送hello分組,還並不知道DR(若為廣播網絡)和任何其他路由器。發送hello分組是,使用組播地址224.0.0.5。
2. Attempt:只適於NBMA網絡,在NBMA網絡中鄰居是手動指定的,在該狀態下,路由器將使用HelloInterval取代PollInterval來發送Hello包。
3. Init:在DeadInterval裡收到了Hello包,2-Way通信還沒有建立起來的狀態。
(繼續閱讀...)
2014年4月1日
地雷般的Cisco EtherChannel
在設定調整Cisco EtherChannel Trunk port新增允許通過的allow Vlan時,沒有直接在Port-Channel上變更,而是先對它下面所屬同一群組的port先調整允許通過的allow Vlan,分別加入後,就發生了上面的狀況,造成EtherChannel Group整條link down斷掉,直到對Port-Channel也加入相同設定後,Port-Channel才link up起來,查了一下資料才發現,Port-Channel起來後只要是介面的相關設定,都要在Port-Channel上變更,不可在單一的所屬同一群組的port做個別調整,否則會造成Port-Channel link down。怪不得網路上,大家都建議port-channel設定時,最好是先關掉或拔線,等設定完成後,再接上,否則也很容易發生spanning tree loop的問題。
(繼續閱讀...)
2013年8月29日
解決Cacti流量圖偵測不準問題
Cacti流量超過 120M bps 時,流量圖會變得異常,偵測不準,大多發生在使用Giga的網路環境中,原因為32bit 跟 64bit計算方式,FE 100M 使用 2^32 次方採用 32 bit,GE 1G 使用 2^64 次方採用 64 bit
解決方式為在 Create流量圖時,在Select a graph type要選In/Out Bits(64-bit Counters ),不是原本的In/Out Bits,在 SNMP也須改 SNMP v2,因為 v1不支援 64 bit,選了64-bit Counters後,統計流量便可準確偵測在Giga網路環境的流量。

(繼續閱讀...)
解決方式為在 Create流量圖時,在Select a graph type要選In/Out Bits(64-bit Counters ),不是原本的In/Out Bits,在 SNMP也須改 SNMP v2,因為 v1不支援 64 bit,選了64-bit Counters後,統計流量便可準確偵測在Giga網路環境的流量。

(繼續閱讀...)
2013年4月28日
Tomato OpenVPN Server Connect By Android Phone
最近將分享器裝上Tomato firmware後,想讓它成為VPN Server方便在外面使用不安全的wifi上網時,可以連回家中的網路再出去,或是讓手機去撥VPN連回家中,Android手機預設有support PPTP、L2TP/IPSec的VPN撥號,但若要support SSL VPN的話,要另外裝OpenVPN for Android這個app才能連線,但對於VPN來說,SSL VPN的listen port可以改為TCP 443 port避過一些有限制的網路使用,使用上較有彈性,優缺點可以參考這裡有說明
下面為在Tomato(VPN Server)與Android Phone(VPN Client)使用OpenVPN的方法
(研究了三天才實作出來0rz....)
Step 1:先建立OpenVPN所需的Root CA、Server Key、Client Key、Diffie Hellman參數
這個部分需要一台有安裝OpenVPN軟體的電腦來建立這些東西,我是在Linux上建立這些東西,沒有Linux機器的人,也可以利用Windows電腦裝OpenVPN來建立這些東西
# apt-get install openvpn 安裝OpenVPN套件
#cd /usr/share/doc/openvpn/examples/easy-rsa/2.0 利用easy-rsa來建立相關的CA & KEY
#vi vars 修改CA範例檔部分參數
export KEY_COUNTRY="TW"
export KEY_PROVINCE="Taiwan"
export KEY_CITY="自行設定"
export KEY_ORG="自行設定"
export KEY_EMAIL="自行設定"
Step 2:Linux上執行vars來建立相關檔案
#Source ./vars
#./clean-all 先清空此台Linux上的所有key
#./build-ca 建立CA
#./build-key-server YourServer(名稱自訂)建立server憑證
#./build-key Yourclient(名稱自訂)建立Client憑證
#./build-dh(安全性愈高製作時間愈久)Diffie Hellman參數
Step 3:分享器Tamoto UI裡面,點選VPN Tunnelling-->OpenVPN Server
依順序設定如下,其中Advanced頁面中的Custom Configuration額外再輸入
script-security 3
auth-user-pass-verify /etc/verify.sh via-env
(繼續閱讀...)
下面為在Tomato(VPN Server)與Android Phone(VPN Client)使用OpenVPN的方法
(研究了三天才實作出來0rz....)
Step 1:先建立OpenVPN所需的Root CA、Server Key、Client Key、Diffie Hellman參數
這個部分需要一台有安裝OpenVPN軟體的電腦來建立這些東西,我是在Linux上建立這些東西,沒有Linux機器的人,也可以利用Windows電腦裝OpenVPN來建立這些東西
# apt-get install openvpn 安裝OpenVPN套件
#cd /usr/share/doc/openvpn/examples/easy-rsa/2.0 利用easy-rsa來建立相關的CA & KEY
#vi vars 修改CA範例檔部分參數
export KEY_COUNTRY="TW"
export KEY_PROVINCE="Taiwan"
export KEY_CITY="自行設定"
export KEY_ORG="自行設定"
export KEY_EMAIL="自行設定"
Step 2:Linux上執行vars來建立相關檔案
#Source ./vars
#./clean-all 先清空此台Linux上的所有key
#./build-ca 建立CA
#./build-key-server YourServer(名稱自訂)建立server憑證
#./build-key Yourclient(名稱自訂)建立Client憑證
#./build-dh(安全性愈高製作時間愈久)Diffie Hellman參數
Step 3:分享器Tamoto UI裡面,點選VPN Tunnelling-->OpenVPN Server
依順序設定如下,其中Advanced頁面中的Custom Configuration額外再輸入
script-security 3
auth-user-pass-verify /etc/verify.sh via-env
(繼續閱讀...)
2013年4月21日
開啟Asus RT-N12 B1 的Tomato pppoe relay
Tomato 韌體預設未將pppoe relay功能加入,需自行安裝rp-pppoe-relay套件在JFFS上面才可以使用此功能
Step1:連入Web管理介面,打開JFFS功能
Administration-->JFFS Enable,啟用後要選下方的格式化/清除,否則無法 mount JFFS磁碟
CLI mode下輸入df -h查看是否已正確mount JFFS磁碟
root@Tomato:/tmp/home/root# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 5.2M 5.2M 0 100% /
tmpfs 14.0M 288.0K 13.7M 2% /tmp
devfs 14.0M 0 14.0M 0% /dev
/dev/mtdblock3 1.8M 196.0K 1.6M 11% /jffs
Step 2:安裝rp-pppoe-relay套件
# mkdir -p /tmp/pppoe
#cd /tmp/pppoe
# wget http://kamikaze.openwrt.org/8.09.2/brcm-2.4/packages/rp-pppoe-relay_3.10-1_mipsel.ipk
# tar xzf rp-pppoe-relay_3.10-1_mipsel.ipk
# tar xzf data.tar.gz
# cp usr/sbin/pppoe-relay /jffs
# cd /
# rm -rf /tmp/pppoe
# /jffs/pppoe-relay -S vlan 1 -C br0
注意:vlan1在我的機器是設定為Wan端,Lan端為br0,需依實際狀況修改對應的Vlan
(繼續閱讀...)
Step1:連入Web管理介面,打開JFFS功能
Administration-->JFFS Enable,啟用後要選下方的格式化/清除,否則無法 mount JFFS磁碟
CLI mode下輸入df -h查看是否已正確mount JFFS磁碟
root@Tomato:/tmp/home/root# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 5.2M 5.2M 0 100% /
tmpfs 14.0M 288.0K 13.7M 2% /tmp
devfs 14.0M 0 14.0M 0% /dev
/dev/mtdblock3 1.8M 196.0K 1.6M 11% /jffs
Step 2:安裝rp-pppoe-relay套件
# mkdir -p /tmp/pppoe
#cd /tmp/pppoe
# wget http://kamikaze.openwrt.org/8.09.2/brcm-2.4/packages/rp-pppoe-relay_3.10-1_mipsel.ipk
# tar xzf rp-pppoe-relay_3.10-1_mipsel.ipk
# tar xzf data.tar.gz
# cp usr/sbin/pppoe-relay /jffs
# cd /
# rm -rf /tmp/pppoe
# /jffs/pppoe-relay -S vlan 1 -C br0
注意:vlan1在我的機器是設定為Wan端,Lan端為br0,需依實際狀況修改對應的Vlan
(繼續閱讀...)
訂閱:
文章 (Atom)










