12/28/2018

EOS - CPU monitor session

monitor session 1 source Ethernet3/1
monitor session 1 destination Cpu

wa463.vtepB2(config)#show monitor sess

Session 1
------------------------
Source Ports:
  Both:        Et3/1
Destination Ports:
    Cpu :  active (mirror0) <<< use this interface to tcpdump


wa462.vtepB1#bash tcpdump -nvvi mirror0 udp
tcpdump: listening on mirror0, link-type EN10MB (Ethernet), capture size 262144 bytes
20:56:32.121346 44:4c:a8:a5:11:40 > 44:4c:a8:97:8c:51, ethertype IPv4 (0x0800), length 164: (tos 0x0, ttl 63, id 47642, offset 0, flags [DF], proto UDP (17), length 150)
    200.255.200.34.62729 > 200.255.200.56.4789: VXLAN, flags [I] (0x08), vni 2000
00:1c:73:ff:3c:30 > 44:4c:a8:97:72:b7, ethertype IPv4 (0x0800), length 114: (tos 0x0, ttl 64, id 32537, offset 0, flags [none], proto ICMP (1), length 100)

12/27/2018

Arista EOS Tips - alias

1. Multiple line alias
alias ccc
10 clear arp
20 clear mac add dyn
30 bash clear

2. Alias argument
alias da bash tcpdump -nvvvi %1 arp

12/18/2018

Arista EOS: VARP - GARP

If you have the following VARP configuration:

ip virtual-router mac-address 00:00:33:33:44:44
ip virtual-router mac-address advertisement-interval 1
interface Vlan2000
   ip address 20.0.134.14/16
   ip virtual-router address 20.0.134.1

You will see the incoming GARP every 1 sec (collecting by "bash tcpdump -nvvi vlan2000 -w arp.cap")



Arista EOS
  • Use opcode=2 (reply) as GARP 
  • SrcMAC = vMAC, DstMAC = all FF
  • Send/Target MAC/IP = vMAC/vIP
  • You see 2 GARP in 1 sec because of 2 mlag peers 


12/17/2018

FB: A Billion user load balancer

https://www.usenix.org/conference/lisa16/conference-program/presentation/shuff
  • A 2016 presentation by PE - Patrick Shuff
  • Tb of egress traffic leaving FB routers, 85% from outside US
FB Req Flow vs Architecture
  • Client - DNS AAAA req for facebook.com
  • Client - Router
  • Router - ECMP to L4LB(ipvs)
  • L4LB(ipvs) - Http GET to L7LB(proxygen)
  • L7LB(proxygen) - Http GET to HHVM (websever)
  • Router + L4LB + L7LB + HHVM = a cluster/DC
  • Data flow:
    • router/ECMP --> L4LB (ipvs) --> L7LB(proxygen) --> HHVM
    • L4LB = 10+             
    • L7LB = 100+
    • HHVM = 1000+
  • And L4LB/L7LB/HHVM are NOT dedicted servers or devices. All x86 servers dynamically allocated. 
L4/L7 LB:
  • L4LB (ipvs) + xBGP, a python BGP dameon to talk to TOR to announce 
    • ipv4:/32, 
    • ipv6:/64
  • Router to L4LB, just ECMP hash
  • L4LB to L7LB, hash + state table
  • 要考虑两种failures
    • 1) L4LB down, 新的L4LB用同样的hash,到原来的HHVM;
    • 2) L7LB down, TCP breaks, L4LB hash到不同的L7LB, 如果L7LB back up, 因为有state table,不会影响TCP
  • DSR = direct server access
    • return traffic bypass the L4LB, L7LB to router. 
    • L4LB ==ipInip== L7LB
    • 然后L7LB直接 original ipv4 packet back to client. 和微软很像
Speed up 
  • 用PoP early terminates客户TCP/SSL handshake,这样加快链接建立的速度,而不是到DC
  • Pop has direct SSL connections to DC. 
  • 需要看TCP (3-way), SSL (4-way)
DNS
  • Real time monitor


Arista DCS-7050QX-32S-F enable eth1-4

On the DCS-7050QX-32S-F, there are 4x10G SFP on the front panel. This 4 ports share the hardware with Eth5/1-4. So to switch the hardware of eth5/1 to eth1-4 of 10G, use this command

ck475.vtepX4(config)#hardware port-group 1 select ?
  Et1-4    Activate ports Et1-4
  Et5/1-4  Activate ports Et5/1-4

Arista EOS MLAG - domain name must be matched

snp262.vtepA1#sh run | sec mlag config
mlag configuration
   domain-id vtepA
   local-interface Vlan4094
   peer-address 200.255.134.2
   peer-link Port-Channel2000

snp263.vtepA2(config-mlag)#sh run sec mlag config
mlag configuration
   domain-id vtepA2  <<<<< a typo in mlag domain-name
   local-interface Vlan4094
   peer-address 200.255.134.1
   peer-link Port-Channel2000
   reload-delay mode lacp standby

snp263.vtepA2#sh mlag det | grep State
State                           :            inactive
Peer State                      :             unknown
State changes                   :                   3

snp263.vtepA2(config)#mlag config
snp263.vtepA2(config-mlag)#domain-id vtepA
snp263.vtepA2(config-mlag)#end

After correcting it, the mlag is up

snp263.vtepA2#sh mlag det | grep State
State                           :             primary
Peer State                      :           secondary
State changes                   :                   4

12/03/2018

Arista EOS BGP wait-for-install and wait-for-convergence

"update wait-for-install"

Quite straightforward feature, update the prefixes until they are installed in hardware
  • Obviously, this prevents packet loss. Without this feature, routers start to advertise prefixes when hardware forwarding not ready yet. When its peers start to flood traffic to it, the only thing it can do is to drop them. 
  • Very useful when working with MLAG, which requires the routers to put Mlag downstream interface to hold state during initialization. 

"update wait-for-convergence"
Where to use them:
  • On MLAG or L2/L3 boundary,  ONLY use wait-for-install
  • On spine, use both

FB: Eng Egress with Edge Fabric

https://research.fb.com/wp-content/uploads/2017/08/sigcomm17-final177-2billion.pdf?

PR's BGP connection types:
  • Transit: private link with dedicated b/w
  • Peers:
    • private peer: dedicated PN ?~= transit ?
    • public: via public fabric
    • route server: prefix redirected by RS and traffic via public fabric
How prefixes are preferred:
  • Prefer peer routes over transit (via local_pref), as_path tiebreaker
    • In/egress traffic over same path
  • If still tie, private peer > public > route server peer, using MED
    • to avoid cross-congestion over fabric
BGP multi-path vs. ECMP
  • Cisco BGP multipath doc
  • Requirement of path characteristics to be multipath
    • Weight
    • local_pref
    • as_path length
    • origin
    • MED
    • one of these:
      • neighbor AS or sub-as
      • as_path
BGP limitation
  • Not capacity-aware + ECMP
    • unbalances links get equal load
  • Static bgp policy likely optimizes traffic, but
    • as-path != performance
Avoid congestion
  • Input:
    • Prefix via BMP, BGP only has 1 best
    • controller does best selection
    • sFLOW, IPFIX, traffic info
    • SNMP, interface info
  • Output, via BGP update by using higher local_pref
Performance-based routing
  • servers set DSCP
  • PBR on PRs, 1 DSCP - 1 route (table?)
  • PR ISIS-SR/MPLS to ASW
  • eBPF - extended berkley packet filter
    • change pkt egress this server
to be continued.....

How to check # of BGP attributes

Check BGP export/shadown table

First enable "sflow extension bgp" then run command - "show bgp export-table path-attribute" or "show bgp shadown-table bgp-attribute" if older releases

bn302.17:01:15#show bgp export-table path-attribute
Bgp Attribute Info Table
key             nextHop  origin  pathFlags  originatorId  aspType  med  localPref  asPathAttrInfoId  commListId  extCommListId
 64        210.100.22.1       0         16             0        2    0          0                 3  4294967295     4294967295
 80  2000:210:255:254::       0          0    3539992321        1    0        100        4294967295  4294967295     4294967295
 88        210.100.11.1       0         24    3539992321        1    0        100                 2  4294967295     4294967295
 56        210.100.22.1       2         16             0        2    0          0                 2  4294967295     4294967295
 20  2000:210:100:32::1       0         48             0        2    0          0                 1  4294967295     4294967295

A new command:
bn302.17:01:08#bash smash -p ar/Smash/routing/bgp/export/pathAttrTableInfo/default/pathAttrEntry | egrep '^bucket' | wc -l
23

MAC 11:11:xx:.... is not valid MAC address

On IXIA if you configured MAC/Eth address to be 11:11:00:02:01:01, the switch doesn't take them.

Thanks Paul Lavelle for the why :-) 

The least significant bit of the first byte is known as the IG bit. An IG bit of 0 indicates that this is a unicast MAC address, an IG bit of 1 indicates a multicast or broadcast address. It is illegal to use a multicast source MAC address in ARP replies.

References:


I use a simple trick: If you are manually setting a MAC address on Ixia, make sure the first byte of the address is an even number :) 

12/02/2018

Arista EOS - customized CLI

https://www.arista.com/assets/data/pdf/Whitepapers/Arista_EOS_parser.pdf

Arista EOS CLI is implemented in Python, so you can customize the CLI yourself. Of course it is limited to simple output instead of complicated contents.  

Step 1: Modify the CLI script

bn303.17:40:17#bash

Arista Networks EOS shell

[admin@bn303 ~]$ cd /usr/lib/python2.7/site-packages/CliPlugin/
[admin@bn303 CliPlugin]$ vi RoutingBgpShowCli.py
[admin@bn303 CliPlugin]$ sudo vi RoutingBgpCli.py

Step 2: save the new CLI script and load up during boot

copy the modified to /mnt/flash
the /usr/lib is file system in memory, unsustainable after reboot. 
vi /mnt/flash/rc.eos, so copy the save script to the location

11/30/2018

Arista EOS, SSO support starts from 4.20.5F

On Sand platform, 7500R/E series. And 4.20.5F was released around Arp 2018. (bl)

We have 2 commands to check if system is sso-ready:
  • wait-for-warmup checks for any agent to be not ready
  • show redundancy stat is to ensure sso stage participating agents to be warm
And better to run these 2 commands on both sup:


bn302.10:49:50#wait-for-warmup
bn302.10:51:11#show redundancy states
  my state = ACTIVE
peer state = STANDBY HOT
      Unit = Primary
   Unit ID = 1

Redundancy Protocol (Operational) = Stateful Switchover
Redundancy Protocol (Configured) = Stateful Switchover
Communications = Up
switchover completion timeout = 120.0 seconds (default)
Not ready for switchover (Agents not ready in standby supervisor)
Agents not ready =
   Sand

  Last switchover time = 10:00:13 ago
Last switchover reason = Supervisor has control of the active supervisor lock
bn302.10:51:16#sess peer-supervisor wait-for-warmup

bn302.10:51:29#sess peer-supervisor show redu stat
  my state = STANDBY HOT
peer state = ACTIVE
      Unit = Secondary
   Unit ID = 2

Redundancy Protocol (Operational) = Stateful Switchover
Redundancy Protocol (Configured) = Stateful Switchover
Communications = Up
switchover completion timeout = 120.0 seconds (default)
Not ready for switchover (Agents not ready in standby supervisor)
Agents not ready =
   Sand

11/29/2018

Arista Linux Essential (2)

Useful Utilities
  • Date/time
    • date +%Y%m%d-%H%M%S
    • Epoch - Linux born time
  • Sort
    • du -s /var/* | sort -n
    • -n: numeric order
  • Cut
    • cut -d: -f:1,6 /etc/password
    • -c: cut columns
  • Diff:
    • Cli -p15 -c "show run" | diff -y -w -B --suppress-common-lines - /mnt/flash/startup-config
    • -B --ingore-blank-lines
    • -y --side-by-side
    • -w --ignore-all-space
  • regexp:
    • greedy vs lazy, ? at the end of pattern
  • grep = global reg exp print
    • -i: ignore case
    • -v: inverse, not-matching
    • -A: print # lines AFTER matching
    • -B: print # lines BEFORE matching
  • sed = powerful stream editor
    • remove quotes: sed -e 's/"//g'
    • reverse ip address:
      • echo "10.20.30.40" | sed -e 's/\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)/\4.\3.\2.\1/'
      • reverse A-record to fwd record
  • awk
    • awk -F: '{print $1, $6}
    • alias shmc show int | awk '/^[A-Z]/ { intf=$1 } 
  • tar
    • tar czvf config.1.gz config.1

[admin@bn303 etc]$ Cli -p15 -c "show run" | diff -y -w -B --suppress-common-lines - /mnt/flash/startup-config
! Command: show running-config        | ! Startup-config last modified at  Wed Nov 28 17:01:44 2018 b
! device: bn303 (DCS-7512N, EOS-4.20.1F)       | ! device: bn303 (DCS-7512N, EOS-4.20.10M)

Arista Linux Essentials (1)

From the course - "Arista Linux Essentials"

Linux Flavors

  • Linux Distribution = Distro
    • Generally includes:
      • Kernel
      • Package manager
      • GNU tools and libraries
      • Documentation
      • GUI
  • Debian
    • All Ubuntu are Debian distro
  • Gentoo
    • For power users
    • ChromeOS is based on Gentoo
  • Android:
    • Uses a Linux Kernel
    • NO GNU tools and libraries, like glibc
  • SUSE
  • Fedora:
    • Red Hat, CentOS
    • Oracle's Unix OS
      • Not Linux anymore because changing kernel 
    • Arista EOS is Fedora Core
      • No change in kernel
      • ver 18 or 21 now
Bootup

  • Boot Loaders:
    • Same on all computers
    • Multi-stage
  • First: BIOS/POST
    • Stored in ROM or NVRAM
    • Initialize system hw
  • MBR (Master Boot Record, Boot Loader) 
    • Not OS-specific
    • Examples: Coreboot, LILO, GRUB
    • @arista switch, Aboot = a mini linux
    • Point to VBR
  • VBR (Volume Boot Record) .... OS Boot .... Kernel
  • OS Boot
    • dmesg display kernel message buffer
Arista Boot:
  • Power On:
    • BIOS
  • Active partition
    • Aboot -> init
    • init -> boot-config
    • ctrl - C to stop Aboot calls kexec
  • EOS Kernel:
    • Aboot calls kexec
EOS Boot Stages
  • EOS Stage 1:
    • /mnt/flash/persist
    • boot hooks - patch, bug fix here
    • not change kernel, change boot
  • Hw Init:
    • FRU initialize
    • Cell type config - module/fixed, supervisor
    • hw device tree
  • EOS Stage 2:
    • Kernel modules
    • ProcMgr
    • SysDB
    • Launcher
Init/runLevel:
  • scripts in /etc/init.d
  • init <runlevel>
Package Management:
  • wget - a web client to download files
    • in aboot
  • curl - more protocol support, http/ftp/imap/scp/....
    • not in aboot
  • Package Managers:
    • different distros use different manager
    • Debian/Ubuntu
      • uses dpkg
      • format is .deb
      • advanced tool apt, manage dependencies
      • apt-get, manage installation
    • Fedors (EOS) 
      • uses rpm
      • format is .rpm
      • yum manage dependencies
      • as Fedora 18, yum is replaced by dnf
  • sudo dnf install sysstat

Python Notes (3) - Beautiful Python Code by Raymond Hettinger

https://www.youtube.com/watch?v=OSGv2VnC0go

Faster and prettier code:

1. Looping backwards
for color in reversed(colors):
    print color

2. Looping over collection and indices
for i, color in enumerate(colors):
    print i, ":", color

3. Zip of 2 lists
for name, color in zip(names, colors):
    print name, ":", color

! zip has higher memory req, prone to cache miss;
! in python 3.x, using izip instead of zip

4. Sorted list
for color in sorted(colors):
for color in sorted(colors, reverse=True):

def compare_length(c1, c2):
    if len(c1) &lt; len(c2): return -1
    if len(c1) &gt; len(c2): return 1
    return 0

for color in sorted(colors, cmp=compare_length):
for color in sorted(colors, key=len):

Looping over a dict with keys and values:
for k,v in d.items():     # req. memory to store list
for k,v in d.iteritems(): # use iterator instead of mem

Counting with dict
d ={}
for color in colors:
    d[color] = d.get(color, 0) + 1

d = defaultdict(int)
for color in colors:
    d[color] += 1

Grouping with dictionaries:
# group the list by length
names = ['Raymond', 'Rachel', 'Matthew', 'Roger', 'Betty']

#old
d = {}
for name in names:
    key = len(name)
    if key not in d:
        d[key] = []
    d[key].append(name)

#1
d = {}
for name in names:
    key = len(name)
    d.setdefault(key, []).append(name)

#2
d = defaultdict(list)
for name in names:
    key = len(name)
    d[key].append(name)

Function calls with keyword arguments
twitter_search('@obama', False, 20, True)

twitter_search('@obama', retweets=False, numtweets=20, 
               popular=True)


Packing/Unpacking = simultaneous state updates
x, y, dx, dy = ( x + dx *t,
                 y + dy *t,
                 influence(m,x,y),
                 influence(m,x,y))

Concatenating strings
', '.join(names)

Updating sequences
names = ['Raymond', 'Rachel', 'Matthew', 'Roger', 'Betty']

del names[0]
names.pop(0)
names.insert(0, 'mark')

#==&gt;
names = deque(['Raymond', 'Rachel', 'Matthew', 'Roger', 'Betty'])

del names[0]
names.popleft()
names.appendleft('mark')

Python Notes (2)

1. Sort: 
  • sorted() vs list.sort()
    • Sorted() returns a new list vs list.sort() does in place. 
    • list.sort() only for list. But sorted() for all iterables. 
  • key function and (reverse=True)
  • Sorted by multiple elements, like by first item then 2nd. 
>>> p = [[1,2,3],[3,2,1],[2,4,6],[1,2,5],[1,3,7],[3,1,0],[1,7,2]]
>>> p.sort(key=lambda x:(x[0], x[2]))
>>> p
[[1, 7, 2], [1, 2, 3], [1, 2, 5], [1, 3, 7], [2, 4, 6], [3, 1, 0], [3, 2, 1]]
  • Sorted by reversed plus asc
>>> p = [[1,2,3],[3,2,1],[2,4,6],[1,2,5],[1,3,7],[13,1,0],[-1,7,2]]
>>> p.sort(key=lambda x:(-x[0], x[2]))
>>> p
[[13, 1, 0], [3, 2, 1], [2, 4, 6], [1, 2, 3], [1, 2, 5], [1, 3, 7], [-1, 7, 2]]


2. SET:

1) No duplicate
2) No order
3) Sets contain only hashable items, for __contain__ method
4) Sets have operator like "-"

_set = set([1,2,3,3]) # (1,2,3)


s1 = set([1,2,3,4])
s2 = set([2,3,5])

l1 = [1,2,3,4]
l2 = [2,3,5]
s1 - s2
set([1, 4])


l1 - l2
Error

3. Variable length arguments in function call

positional argument with unknown number of arguments
def __func__(*args):
    for count, item in enumerate(args):
        print '{0}. {1}'.format(count, thing)

named arguments
def __func__(**kwargs):
    for name, value in kwargs.items():
        print '{0} = {1}' % (name, value)

TCL:
proc __proc__ {first args} {}

4. How to re-import python module in interactive mode
>>> from myrange import *
>>> for i in myrange(1,3,1):
...     print i
...
1 <<<<< extra print out due to debug print
1
2

$ more myrange.py
class myrange:
    def __init__(self, start, end, step):
        self.start = start
        self.end = end
        self.step = step
        print self.step   <<<< need to remove this

Change the py file, and do 2 steps



>>> import myrange   <<< need to import module for reload()
>>> reload(myrange)
<module 'myrange' from 'myrange.py'>
>>> from myrange import *
>>> for i in myrange(1,3,1):
...     print i
...
1  <<<< corrected
2

5. Python class class/instance/internal variables

啥叫class/instance/internal variables? 
- classVar 是Object之间share,一个改,大家都改,也叫Static variable
- instanceVar,所以叫Self.instanceVar,就是object自己本地
- internal,就不说了

class Obj(object):
    classVar = [10,20,30]
    def __init__(self):
        self.instanceVar = [1,2,3]
        internalVar = [100,200,300]

o1 = Obj()
o2 = Obj()

o1.instanceVar.append(11)
o1.instanceVar.append(12)
o2.instanceVar.append(21)
o2.instanceVar.append(22)

print o1.instanceVar
print o2.instanceVar

o1.classVar.append(111)
o2.classVar.append(222)
print o1.classVar
print o2.classVar

Python Notes (1)

1. Python FAQ:
https://docs.python.org/2.7/faq/programming.html

2. Python module search path
https://docs.python.org/2.7/tutorial/modules.html#the-module-search-path

If you do an "import syslib", how does the python locate the library?


1. local directory <<<< surprised?!

2. PYTHONPATH

so if you have a locally mistaken syslib.py or syslib.pyc under the local directory, you gonna break this import. And if you see something wanky, print cmd.__file__ will be helpful (or cmd.__version__)


3. Python Set
https://docs.python.org/3/tutorial/datastructures.html#sets
  • {} and set() can be used to create set
  • But to create an empty one, must use set(), not {} which is to create a dictionary. 
  • set_ = {0}
4. 3 Ways to delete an element in a list
1) most efficient - del List[idx]
2) less efficient if need to have the element - List.pop(idx)
3) lest effificient - slice, List[:i] + List[i+1:]

5. Python reduce, filter
>>> l = [1,2,3,4]
>>> reduce( (lambda x,y: x*10+y), l)
1234
>>> reduce( (lambda x,y: x*100+y), l)
1020304
>>> l = range(1, 100, 5)
>>> l
[1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86, 91, 96]
>>> filter(lambda x:x%4, l)

[1, 6, 11, 21, 26, 31, 41, 46, 51, 61, 66, 71, 81, 86, 91]

6. Python Naming Convention

http://legacy.python.org/dev/peps/pep-0008/#code-lay-out
  • limit all lines to 79,docstring/comment to 72
class Rectangle(Blob):

    def __init__(self, width, height,
                 color='black', emphasis=None, highlight=0):
        if (width == 0 and height == 0 and
                color == 'red' and emphasis == 'strong' or
                highlight &gt; 100):
            raise ValueError("sorry, you lose")
        if width == 0 and height == 0 and (color == 'red' or
                                           emphasis is None):
            raise ValueError("I don't think so -- values are %s, %s" %
                             (width, height))
        Blob.__init__(self, width, height,
                      color, emphasis, highlight)

  • Module: short, 
    • all-lower-case name, like pystock.py
  • Class: CapWords, like 
    • StockHist, StockInfo, StockERHist
  • Function: 
    • lower_case_with_underscore
  • Method and instance: 
    • lower_case_with_underscore
  • Constants: 
    • ALL_CAPITALS_WITH_UNDERSCORE
  • Internal attribute: 
    • _single_leading_underscore
    • NOT imported. 
  • empty sequence = FALSE, so 
    • YES: if not seq:... 
    • NO: if len(seq)
  • Attributes: 
    • self.lower_case_with_underscore



11/16/2018

SR Policy Architecture

https://datatracker.ietf.org/doc/html/draft-filsfils-spring-segment-routing-policy-06.txt

SR Policy包括什么?
  1. ID of SR Policy = <headend, color, endpoint>
  2. 1个Policy可以有多个Candidate Path, 一个CP可以有多个SID-lists, 可以有weight for LB
  3. Protocol origin of CP 
    • 10: PCEP; 
    • 20: BGP SR; 
    • 30: Local, CLI/Yang...
  4. Originator of CP, 160b = 20B
    • = 4B AS# + 16B Addr (128b) 
    • 如果Addr是v4,就放在最后4B
  5. Discriminator of CP, default 0, 这个是啥?一个就是seq#,作为tie-breaker
  6. ID of CP = <protoOrig, originator, discrimator>
  7. pref of CP = 100
  8. Valid of CP, 就是SID是valid
  9. Active CP
    • higher origin id
    • lower originator ip
    • higher discriminator
  10. SR policy还可以有priority,就是有topology change, 先算那个
SR Policy 例子:
  • 1个policy, <headend, color, endpoint>
  • 2个CP,CP1 is active 因为preference 200
  • CP1有两个SID-List, 都installed in HW, 而且ECMP
验证 CP
  • An explicit CP with SID-list = 应该是指静态CP
    • 为空
    • Weight = 0
    • 1st SID不能resolve
    • non-1st SID of type 3~11 into MPLS Label or SRv6 SID? 什么意思
    • 挺多的,还有最后一个不是prefix SID
  • Dynamic CP
Binding SID
  • 非常关键的一个概念
  • = CP,SR的无缝衔接?
  • 可以代表任何的interface, tunnel. 
Steering:
  • 这个是很关键的概念
  • Headend可以steer traffic,以下方式:
    • local BSID
    • Per-dest, 需要BGP
    • Per-flow?
    • PBR
  • 如果SR Policy失效,就fall back to 普通的routing
  • SR Policy可以是Drop
BSID Steering
  • <B, L2, L3> 变成 <S1, S2, S3, L2, L3> 如果S1不是PHP
Per-Dest Steering:
  • 这个一个是最常见的
  • BGP routes <prefix, N, ext-color-C, VPN-Label-V>
  • Valid SR Policy - <endPt = N, color = C> of SID-list <S1, S2, S3> and BSID B
  • 如果都met,NH != N, 而是=SR policy P of BSID B. 
  • 收到prefix pkt, push <S1, S2, S3, V> label
  • 一个BGP update里面可以有多个color, 如果有对应的policy with colors, 最终只有一个FIB,因为higher color prefered

10/31/2018

sum dropped pkts in "show platform jericho counter drop"

bn302.12:51:12#show platform jericho counters drops | grep "Counts Match" | awk '{print $9}' | awk '{sum += $1} END {print sum}'
52508425

10/30/2018

EOS: collect data and save to flash

bash dmesg | gzip > /mnt/flash/dmesg-$HOSTNAME-$(date +%Y-%m-%d_%H-%M).gz

show tech-support | gzip > /mnt/flash/shtech-$HOSTNAME-$(date +%Y-%m-%d_%H-%M).gz

show log sys | cat > /mnt/flash/shlogsys-$HOSTNAME-$(date +%Y-%m-%d_%H%M).txt

show agent log | gzip > /mnt/flash/shagentlog-$HOSTNAME-$(date +%Y-%m-%d_%H-%M).gz

show agent qt | gzip > /mnt/flash/shagentqt-$HOSTNAME-$(date +%Y-%m-%d_%H-%M).gz


10/25/2018

Arista EOS: Change the default shape and bandwidth of CoPP class

The purpose of CoPP is to protect the CPU from unnecessary or malicious packets. Arista EOS has a default CoPP set with pre-defined bandwidth and shape.

R1#sh policy-map type control-plane copp-system-policy
Service-policy input: copp-system-policy
  Number of units programmed: 8
  Hardware programming status: Successful

  Class-map: copp-system-arp-inspect (match-any)
       shape : 250000 kbps
       bandwidth : 25000 kbps
<....>

Most of the class names are intuitive, some need a little explanation. 
  • l3destmiss - unicast routed packets but no ARP info, need ARP resolution. 
  • l3lpmoverflow - ip broadcast destined to router???
  • linklocal - multicast packets to 224.0.0.*
  • l3slowpath - header option
How to change:

bn302.15:27:12(config)#policy-map type control-plane copp-system-policy
bn302.15:27:29(config-pmap-control-plane-copp-system-policy)#class copp-system-l3destmiss
bn302.15:27:43(config-pmap-c-control-plane-copp-system-policy-copp-system-l3destmiss)#shape kbps 999999
bn302.15:27:49(config-pmap-c-control-plane-copp-system-policy-copp-system-l3destmiss)#bandwidth kbps 88888

Policy map changes are applied when existing configuration mode. Use 'abort' to ignore any changes. 

How to verify:

bn302.16:47:57#show policy-map interface control-plane copp-system-policy
....
  Class-map: copp-system-l3destmiss (match-any)
       shape : 999999 kbps
       bandwidth : 88888 kbps

bn302.15:29:48(config-cp)#sh platform jericho copp mapping | egrep 'Shape|destmiss'
                         Class name   SysPhyPort First Voq# Total Voqs Bandwidth(kbps) Shape(kbps)
             copp-system-l3destmiss           36       1680       0-40             250        2500

10/23/2018

Arista EOS Tunneling (3) - IPinIP

IP-in-IP format:
  • Size = 20B, just an ip header, 
  • Protocol# = 4
Digram and configuration:


Verification:

R4.cd681#sh ip decap-group
NOTE: "D" column indicates dynamic entries
D | Name         | Type           | Info               | Version | Address Type
--|--------------|----------------|--------------------|---------|-------------
  | ipinip       | IP-in-IP       | 100.20.255.4       | IPv4    |

R4.cd681#show platform trident l3 shadow tunnel encap raw
EGR IP Tunnel:
--------------------------------------------------------------------------------
maxEntries: 512, numEntries: 1
EGR_IP_TUNNEL Address: 0xd72817a4, magic:aeaeaeae, maxEntries: 512, numEntries: 1

EGR_IP_TUNNEL[2]:  0x01  | 0x1 0x0 0x0 0x100000 0x9053fc11 0x9053fc0d 0x1 0x0


R4.cd681#show platform trident l3 shadow tunnel encap
EGR IP Tunnel:
--------------------------------------------------------------------------------
Unit    Id       TnlType       EntType       TTL       DscpSel              SrcIp           DstIp
0        2             0          IPV4        64             1       100.20.255.4    100.20.255.3

R4.cd681#show nexthop-group
ipip
  Id         1
  Type       ipInIp
  Size       1
  TTL        64
  Source IP  100.20.255.4 (Loopback20)
  Entries (left most label is the top of the stack)
    0  100.20.255.3
         Via 100.20.34.3, Ethernet31  (100.20.255.3/32)
         00:1c:73:54:27:cb, Ethernet31