Monday, January 28, 2008

[CCIE] ผ่าน CCIE (R/S) LAB แล้วววววววว

หลังจากสอบครั้งแรกเมื่อ 5 ตุลาคม 2550 ผลออกมา FAIL
พอกลับจากญี่ปุ่นก็อ่านหนังสือ ทำ lab ใหม่อีกครั้งเน้น Multicast กับ QoS
วันที่ 23 มกราคม 2551 ไปสอบ lab อีกครั้ง มั่นใจกว่าครั้งแรกผลออกมา PASS ครับ
ตั้งใจจะสอบ Track Service Provider อีกตัวไม่รู้ว่าจะทำได้หรือเปล่า แต่ก็จะลองสอบดูครับ

Sunday, January 20, 2008

[Cisco] ต้องการ clear tcp connection (bgp, line vty) ของตัว router

วิธี clear tcp connection

R1#sh tcp brief
TCB Local Address Foreign Address (state)
65DA2FF8 160.1.12.1.22 160.1.12.2.55667 ESTAB
R1#cle
R1#clear tcp tcb 65DA2FF8
[confirm]
[OK]
R1#sh tcp brief
R1#

Friday, January 11, 2008

[Cisco] Reflexive Access-list

ต้องการเขียน access-list คล้ายๆ firewall คือต้องมี packet initial ออกจากขา inside router ไป outside ก่อน แล้วถึงจะ permit packet ที่กลับเข้ามา
interface s0
des ** outside **
ip add x.x.x.x y.y.y.y
ip access-group ACL_IN in
ip access-group ACL_OUT out
ip access-list extended ACL_IN
permit tcp any any eq bgp
permit tcp any eq bgp any
permit icmp any any
evaluate REFLEX
ip access-list extended ACL_OUT
permit ip any any REFLEX
referrence:

[Cisco] OSPF เลือก best path

OSPF เลือก bestpath
step1: เลือก type ของ route
1. O Intra Area ( ภายใน area เดียวกัน)
2. IA Inter Area ( ระหว่าง area )
3. E1 External type 1 ( จาก route ที่เกิดจากการ redistribute type 1)
4. E2 External type 2 (จาก router ที่เกิดจากการ redistribute type 2 และ default การ redistribute จะเป็น type 2 )
step2: เลือกค่า cost น้อย
ตัวอย่าง สมมติว่ามี route 192.168.1.0/24 มา 2 ทาง โดย
1. path แรกเป็น type E1 มี cost 100
2. path ที่สองเป้น type E2 มีค่า cost 10
จะเลือก path ใดระหว่าง path 1 หรือ 2 ????

[Cisco] BGP เลือก Best path

GP เลือก Best path มีขั้นตอนคือ

ให้จำคำย่อ
W L L A O M N I
ข้อสำคัญข้อแรกของทุก routing ของการเลือก best path คือ ip next hop จะต้องมีอยู่จริงใน routing
W = Weight (propietary cisco ใช้เฉพาะภายใน router ตัวเดียวเท่านั้น)
L = local preferrence (default เป็น 100)
L = local inject ( route ที่เกิดจากการ inject เข้า BGP ของตัวเอง)
A = AS-path ( เลือก path ที่สั้นที่สุด)
O = Origin code โดยจะเลือกค่า i <>
M = ค่า MED หรือ metric เลือกค่าน้อย
N = Neighbor type เลือก eBGP ก่อน iBGP
I = เอาค่า cost IGP metric ค่าที่น้อยที่สุดของ next hop
ถ้ามีการ config maximum-path และทุกขั้นตอนมีค่าเท่ากัน ก็จะ load-balance
แต่ถ้าไม่มีการ config maximum-path
1.จะเลือก router-id ค่าน้อย
2.ถ้ามีการ config route-reflect ให้เลือก prefix ที่มาจาก cluster-list ที่สั้นที่สุด
3.เลือก neighbor ip address ค่าน้อย
ถ้าเท่ากันทุกขั้นตอนจะ load-balance

[Cisco] BGP สร้างเงื่อนไขในการ advertise

ต้องการสร้างเงื่อนไขในการ advertise network A โดยตรวจสอบก่อนว่า network B นั้นมีอยู่ใน BGP หรือไม่ถ้าไม่มีให้ advertise network A

Ex.
router bgp 100
network 10.10.10.0 mask 255.255.255.0
neighbor 172.16.1.1 remote-as 200
neighbor 172.16.1.1 advertise-map ADVERTISE non-exist-map NON-EXIST
ip prefix-list NETWORK_A permit 10.10.10.0/24
ip prefix-list CHECK_NETWORK_B permit 192.168.1.0 mask 255.255.255.0
route-map ADVERTISE permit 10
match ip address prefix NETWORK_A
route-map NON-EXIST permit 10
match ip address prefix CHECK_NETWORK_B
จากตัวอย่างเรามีการตรวจสอบ BGP routing table ก่อนว่ามี network 192.168.1.0/24 อยู่หรือเปล่า ถ้าไม่มีจะทำการ Advertise 10.10.10.0/24 แต่ถ้ามีจะไม่ advertise

[Cisco] Legacy QoS (guarantee bandwidth)

thank you h**p://awanetwork.blogspot.com/2007/09/custom-queueing.html

QoS | Custom Queueing

CQ implementation WRR, up to 16 user queues, threshold based on number of bytes. Service use Round-robin we need requires configuration. CQ is used to create a bandwidth reservation in output queue of an interface. So no direction option on applied to the interface, fact that queueing is always outbound.

I have simple sample of CQ, objective is guaranteed the following amount of bandwidth that traffic leaving its Ethernet interface. I want 3 traffic define are ftp, telnet www and default for else logical. Each queue would be guaranteed bandwidth in a ratio of 5:2:2:1 on a total value 16000 bytes or 128 kbps, which results in 8000/16000, 3200/16000, 3200/16000, 1600/16000. With the CQ if there is traffic of type A and B waiting to be sent, but no traffic of type C, type A and B are not limited to a maximum of 50% and 20%. Instead A and B are guaranteed a minimum of 50% and 20% in the case of congestion.

#final running-config

...
queue-list 1 protocol ip 1 tcp ftp
queue-list 1 protocol ip 2 tcp telnet
queue-list 1 protocol ip 3 tcp www
queue-list 1 default 4
queue-list 1 queue 1 byte-count 8000
queue-list 1 queue 2 byte-count 3200
queue-list 1 queue 3 byte-count 1600

interface FastEthernet0/0
ip address 192.168.0.1 255.255.255.0
duplex auto
speed auto
custom-queue-list 1
...


#step-by-step configuring define queue (required)
R1(config)#queue-list ?
<1-16> Queue list number

R1(config)#queue-list 1 ?
default Set custom queue for unspecified datagrams
interface Establish priorities for packets from a named interface
lowest-custom Set lowest number of queue to be treated as custom
protocol priority queueing by protocol
queue Configure parameters for a particular queue
stun Establish priorities for stun packets

R1(config)#queue-list 1 protocol ?
aarp AppleTalk ARP
appletalk AppleTalk
arp IP ARP
bridge Bridging
bstun Block Serial Tunnel
cdp Cisco Discovery Protocol
clns ISO CLNS
clns_es ISO CLNS End System
clns_is ISO CLNS Intermediate System
cmns ISO CMNS
compressedtcp Compressed TCP (VJ)
decnet DECnet
decnet_node DECnet Node
decnet_router-l1 DECnet Router L1
decnet_router-l2 DECnet Router L2
dlsw Data Link Switching (Direct encapsulation only)
http HTTP
ip IP
ipv6 IPV6
ipx Novell IPX
llc2 llc2
pad PAD links
pppoe PPP over Ethernet
qllc qllc protocol
rsrb Remote Source-Route Bridging
snapshot Snapshot routing support
stun Serial Tunnel

R1(config)#queue-list 1 protocol ip ?
<0-16> queue number

R1(config)#queue-list 1 protocol ip 1 ?
fragments Prioritize fragmented IP packets
gt Classify packets greater than a specified size
list To specify an access list
lt Classify packets less than a specified size
tcp Prioritize TCP packets 'to' or 'from' the specified port
udp Prioritize UDP packets 'to' or 'from' the specified port


R1(config)#queue-list 1 protocol ip 1 tcp ?
<0-65535> Port number
bgp Border Gateway Protocol (179)
chargen Character generator (19)
cmd Remote commands (rcmd, 514)
daytime Daytime (13)
discard Discard (9)
domain Domain Name Service (53)
drip Dynamic Routing Information Protocol (3949)
echo Echo (7)
exec Exec (rsh, 512)
finger Finger (79)
ftp File Transfer Protocol (21)
ftp-data FTP data connections (20)
gopher Gopher (70)
hostname NIC hostname server (101)
ident Ident Protocol (113)
irc Internet Relay Chat (194)
klogin Kerberos login (543)
kshell Kerberos shell (544)
login Login (rlogin, 513)
lpd Printer service (515)
nntp Network News Transport Protocol (119)
pim-auto-rp PIM Auto-RP (496)
pop2 Post Office Protocol v2 (109)
pop3 Post Office Protocol v3 (110)
smtp Simple Mail Transport Protocol (25)
sunrpc Sun Remote Procedure Call (111)
syslog Syslog (514)
tacacs TAC Access Control System (49)
talk Talk (517)
telnet Telnet (23)
time Time (37)
uucp Unix-to-Unix Copy Program (540)
whois Nicname (43)
www World Wide Web (HTTP, 80)

R1(config)#queue-list 1 protocol ip 1 tcp ftp ?


#step-by-step configuring specify queue (optional)
R1(config)#queue-list 1 ?
default Set custom queue for unspecified datagrams
interface Establish priorities for packets from a named interface
lowest-custom Set lowest number of queue to be treated as custom
protocol priority queueing by protocol
queue Configure parameters for a particular queue
stun Establish priorities for stun packets

R1(config)#queue-list 1 queue ?
<0-16> queue number

R1(config)#queue-list 1 queue 1 ?
byte-count Specify size in bytes of a particular queue
limit Set queue entry limit of a particular queue

R1(config)#queue-list 1 queue 1 byte-count ?
<1-16777215> size in bytes

o use byte-count for average number of bytes
o use limit for maximum number of packet

#step-by-step configuring applied on interface (required)
R1(config-if)#?
Interface configuration commands:
...
custom-queue-list Assign a custom queue list to an interface
...

R1(config-if)#custom-queue-list ?
<1-16> Custom queue list number

R1(config-if)#custom-queue-list 1 ?


#monitor or verify CQ (optional)
R1#sh int f0/0
FastEthernet0/0 is up, line protocol is up
Hardware is Gt96k FE, address is c200.02d4.0000 (bia c200.02d4.0000)
Internet address is 192.168.0.1/24
MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Half-duplex, 10Mb/s, 100BaseTX/FX
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output 00:00:03, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: custom-list 1
Output queues: (queue #: size/max/drops)
0: 0/20/0 1: 0/20/0 2: 0/20/0 3: 0/20/0 4: 0/20/0
5: 0/20/0 6: 0/20/0 7: 0/20/0 8: 0/20/0 9: 0/20/0
10: 0/20/0 11: 0/20/0 12: 0/20/0 13: 0/20/0 14: 0/20/0
15: 0/20/0 16: 0/20/0
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes
Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog
0 input packets with dribble condition detected
92 packets output, 9553 bytes, 0 underruns
0 output errors, 0 collisions, 2 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier
0 output buffer failures, 0 output buffers swapped out

R1#sh queueing ?
interface
custom custom queueing list configuration
fair fair queueing configuration
priority priority queueing list configuration
random-detect random early detection configuration
| Output modifiers


R1#sh queueing custom ?
| Output modifiers


R1#sh queueing custom
Current custom queue configuration:

List Queue Args
1 4 default
1 1 protocol ip tcp port ftp
1 2 protocol ip tcp port telnet
1 3 protocol ip tcp port www
1 1 byte-count 8000
1 2 byte-count 3200
1 3 byte-count 1600

[Cisco] Object tracking w/ SLA

กรณีต้องการตรวจสอบ static route และ nexthop ว่าสามารถ reachable ได้หรือเปล่า

ip sla monitor 1 <-- id 1 type echo protocol ipIcmpEcho 192.168.1.1 <------ check next-hop 192.168.1.1 can reachable ( ping ) frequency <-- option สำหรับ ระยะเวลาในการ Monitor แต่ละรอบเวลา( interval ) ip sla monitor schedule 1 life forever start-time now <----- start operation id 1 track 1 rtr 1 <-- track id 1 ให้มีการอ้างอิง ip sla monitor 1 ip route 1.1.1.1 255.255.255.255 fast0/0 192.168.1.1 track 1 <-- มีการ config static route โดยชี้ next-hop ออกทาง interface f0/0 -> 192.168.1.1 และก่อนที่จะ install เข้าไปใน routing table ให้ตรวจสอบ track id 1 ว่า state up หรือไม่

#sh track 1 <-- display track id 1 operation state
#sh ip sla monitor operational-state 1 <-- display operation-state sla id 1
#sh ip sla monitor configuration 1 <-- display configuration sla id 1 detail

[Cisco] ทำ acl สำหรับ ตรวจสอบ mac-address และ ip address

Dynamic ARP Inspection

vlan 500
name CLIENT
ip arp inspection vlan 500
ip arp inspection validate src-mac ip
ip arp inspection filter ARP1 vlan 500 static

arp access-list ARP1
permit ip host 192.168.1.1 mac host 0010.8ba1.aabb

interface GigabitEthernet1/0/12
switchport access vlan 500
switchport mode access
end