您的位置:首页 > 其它

NFM一些实用工具

2016-06-29 10:46 197 查看
   /opt/netronome/bin下的各种实用工具:
1、nfm-initd.sh命令
nfm-initd.sh脚本是启动NFE板卡和一些所需后台进程的。其配置文件为/etc/netronome.conf。
1)配置默认的流量行为。详情可以见nfmconf命令。
2)设置转发帧尺寸。最大支持9823字节的帧尺寸。默认为关闭。可以在/etc/netronome.conf文件中添加NFM_ENABLE_JUMBO_FRAMES=y,然后重启NFM。
  
2、rulesd命令的不同参数测试
rulesd后台进程可以用来,给NFE卡上的TCAM分类器,编程分类规则。
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./rulesd -r --rulesdir=/var/run   设置rulesd进程文件所在的目录为/var/run。默认也是/var/run。
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./rulesd -D –daemon      设置rulesd进程以后台方式运行。
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./rulesd -d 0     设置NFE卡ID为0,还可以设置为1、2、3,默认情况为0。
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./rulesd –k 576  设置Key size值为576,默认为576且只能设置为576。
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./rulesd  -i  --host_id  设置rulesd进程要监听的NFE卡号。
 
 
3、rules命令
rules可以编程NFE卡中的rules,keys,actions。rules命令可以生成rulesxml命令所需的xml文件。控制台中输入./rules –samples可以显示rules命令一些常用的方法。
例如:./rules -A -n "rule1" -p1 -k --ipv4_sa=172.16.1.32 -b -a PASS –M       来自IP地址 172.16.1.32的所有数据都传递给TX。
      ./rules -A -n "rule1" -p1 -k --ipv4_da=172.16.1.33 -b -a DROP –M     到目的IP 地址172.16.1.33的数据都丢弃。
 
 
4、rulesxml命令
 
 
5、lgid_read命令
lgid_read工具可以展示制定NFE卡上LGID(load balancing group ID)的配置情况。
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./lgid_read -d --device 0
输出:Load balance group destinations for NFE 0
Group 0: No destinations defined
Group 1: No destinations defined
Group 2: No destinations defined
Group 3: No destinations defined
Group 4: No destinations defined
Group 5: No destinations defined
Group 6: No destinations defined
Group 7: No destinations defined
Group 8: No destinations defined
Group 9: No destinations defined
Group 10: No destinations defined
Group 11: No destinations defined
Group 12: No destinations defined
Group 13: No destinations defined
Group 14: No destinations defined
Group 15: No destinations defined
Group 16: No destinations defined
Group 17: No destinations defined
Group 18: No destinations defined
Group 19: No destinations defined
Group 20: No destinations defined
Group 21: No destinations defined
Group 22: No destinations defined
Group 23: No destinations defined
 
 
6、rules_read命令不同参数测试
rules_read命令可以显示NFE卡上有关rules,key,action的数据。
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./rules_read -l --loglevel  INFO   设置log日志显示等级为INFO。
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./rules_read -d --device 0
Reading rules ...
cardid:                    0                    //NFE卡号0
max rules:                 32768                //最大rules数32768
key size:                  576                   //key size为576
buffering mode:            BUF_MODE_DOUBLE    //缓存模块
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./rules_read -r no   不额外显示多余信息。
7、nfmtest命令不同参数测试
nfmtest工具可以显示NFE卡的信息以及NFM的各个组成部分是否已激活。
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./nfmtest
输出如下:
Netronome Flow Manager 2.7.2 build 58 revision 7832.7a6468b6352d
Copyright (C) 2006-2011 Netronome Systems, Inc.
 
 
Checking status of host kernel modules:
* NFE messaging driver     loaded
 
Checking status of host daemons:
  Daemons for device 0
* Rules daemon             running
* IP fragment daemon       running
 
NFD version 2.7.0-2410
 
Testing NFE device 0
------------------------------------------------------------------------
 
Checking status of NFE ports:
  Link State: A value of U is link up, D is down.
  Force State: an F is link forced, A is autonegotiate.
  NFE port link status:
    port          0 1
    state         D D
    forced        A A
* NFE port status          not operational
 
Checking status of NFD message and buffer pools:
NFE 0 buffer pool 0 is 46% consumed by NPU, 0% consumed by userspace.
NFE 0 buffer pool 1 is 39% consumed by NPU, 0% consumed by userspace.
NFE 0 buffer pool 2 is 42% consumed by NPU, 0% consumed by userspace.
NFE 0 buffer pool 3 is 42% consumed by NPU, 0% consumed by userspace.
 
Checking status of microengines:
* Microengines             running
 
Checking status of Network Processor daemons:
* NFM message daemon       running
* TCAM message daemon      running
Device 0 is fully operational.
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./nfmtest –d  0    只检测NFE卡0
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./nfmtest -r --skip_rulesd   不检测rules daemon。
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./nfmtest -r --skip_fragd  不检测
IP frag daemon。
 
还有-n --skip_nfm 参数,不检测NFM message daemon;-t --skip_tcamd,不检测TCAM daemon;-m –skip_tcam,不检测NFE卡上的TCAM硬件;-l –skip_ls    不检测Link Status。
 

  8、nfm_ipfragd命令不同参数测试 

 

9、nfmconfig命令不同参数的测试
nfmconfig命令可以在NFM运行时配置默认的流量行为。例如:
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./nfmconfig -R  PASS  可以将处理数据包的默认行为配置为输出到Tx,即没有TCAM rules适用于此数据包时,采用默认行为。还可以设置为DROP、VIA_HOST、LOADBALANCE_VIA_HOST默认时为PASS。
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./nfmconfig -E  DROP   可以将有误的数据包设置为丢弃掉。还可以设置为DELIVER。默认时为DROP。
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./nfmconfig -l --loglevel
nfe.present          = 1
ports.min            = 1
ports.max            = 2
nfe 0 ports.hw_min   = 0
nfe 0 ports.hw_max   = 1
ports.switch_tag     = 0 (off)
nfm.reuse_syn        = 1 (RESET)
nfm.lb_tuple         = TWO_TUPLE
nfm.lb_hash          = 0 (FLETCHER)
nfm.errored_packet   = 1 (DELIVER)
nfm.default_rule     = 1 (PASS)
nfm.valhalla_action  = 0x0000000000000000
nfm.mpls_depth       = 6
me version word      = 0x02070003
me revision word     = 0x00001e98
Microcode supports jumbo frames.
-l –loglevel 可以配置log日志等级,分为OFF、FATAL、ERROR、WARN、INFO、DEBUG、ALL或者自己定义的级别。ALL Level是最低等级的,用于打开所有日志记录。
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./nfmconfig  -I --platform_init  初始化主机与NFM有关的后台进程,自动检测Bump port 的配置。
 
在/opt/netronome下新建了一个文件bump_port_confg,执行:
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./nfmconfig -I --platform_init -o /opt/netronome/bump_port_confg
初始化主机与NFM有关的后台进程,将检测到的Bump port 配置写入到/opt/netronom/bump_port_confg文件。
查看此文件中内容:



 

root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./nfmconfig -S IGNORE  设置reuse SYN为IGNORE。还可以设置为RESET。默认为IGNORE。
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./nfmconfig  -M  6  设置MPLS depth值为6。还可以设置为1~5之间任意值。默认时为6。
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./nfmconfig -T TWO_TUPLE   设置
LB参数为TWO_TUPLE。还可以设置为ONE_TUPLE、THREE_TUPLE、FIVE_TUPLE默认为TWO_TUPLE。
 
root@ubuntu-PowerEdge-R720:/opt/netronome/bin# ./nfmconfig  –H  FLETCHER 设置LB hash为FLETCHER。还可以设置为JENKINS,默认为FLETCHER。
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: