Successfully reported this slideshow.
IPv6 mrtg 流量監測 中央大學 電算中心  楊素秋 民國  100 年  11 月
OUTLINE <ul><li>1. IPv6 Network </li></ul><ul><li>2.  SNMP/MIBs and IPv6 </li></ul><ul><li>3.  Cisco router  之 IPv6 MIB OI...
1.  建構  IPv6 Network <ul><li>Different types of networks </li></ul><ul><ul><li>Dual stack IPv6 & IPv4 networks </li></ul><...
1.  建構  IPv6 Network (cont.) <ul><li>桃園區網  IPv6  建置實做 </li></ul><ul><ul><li>啟動 IPv6 routing </li></ul></ul><ul><ul><li>設定 ...
1.  建構  IPv6 Network (cont.)
1.  建構  IPv6 Network (cont.) <ul><li>Is IPv6 ready ? </li></ul><ul><ul><li>Hardware </li></ul></ul><ul><ul><ul><li>Router/...
1.  建構  IPv6 Network (cont.) <ul><li>IPv6 address </li></ul><ul><ul><ul><li>Linux </li></ul></ul></ul><ul><ul><ul><ul><li>...
1.  建構  IPv6 Network (cont.) <ul><li>IPv6  測試網站 (www server) </li></ul><ul><ul><li>audp.tyc.edu.tw, showroom.twnic.net.tw ...
1.  建構  IPv6 Network (cont.)
1.  建構  IPv6 Network (cont.)
<ul><li>SNMP and IPv6 </li></ul><ul><ul><li>Cisco: </li></ul></ul><ul><ul><ul><li>SNMP over IPv6 is available in 12.0(27)S...
2.  SNMP/MIBs and IPv6 (cont.) <ul><li>IPv6 MIBs status </li></ul><ul><ul><li>MIBs are essential for the network managemen...
3.  Cisco router  之 IPv6 MIB Get some ipv6 traffic param. # show interface accounting ”    GigabitEthernet2/8 ###  國立中央大學 ...
3.  Cisco router  之 IPv6 MIB (cont.) IP-MIB.oid .  iso (1)  .  org (3)  .  dod (6)  .  internet (1)  .  mgmt (2)  .  mib-2...
   3. Cisco router  之 IPv6 MIB (cont.) IPV6-MIB.oid (6509 router : Not implement) &quot;ipv6IfEntry&quot;   &quot;1.3.6.1....
3. Cisco router  之 IPv6 MIB (cont.) RFC4293  (   rfc-2011) (6509 router : Not implement) IpIfStatsEntry ::= { ipIfStatsIP...
3. Cisco router  之 IPv6 MIB (cont.) OLD-CISCO-INTERFACES-MIB.oid  (Cisco-SMI or SNMPV2-SMI) &quot;locIfipInPkts&quot;  &qu...
3. Cisco router  之 IPv6 MIB (cont.) CISCO-SWITCH-ENGINE-MIB .   iso (1)  .  org (3)  .  dod (6)  .  internet (1)  .  priva...
SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.1.1006 = Counter32: 3540473092 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.1.2006 = Coun...
4.  區網  IPv6 mrtg  流量監看 <ul><ul><li>Extract interface traffic (with Expect) </li></ul></ul><ul><ul><li>Connect to router <...
4.  區網  IPv6 mrtg  流量監看 (cont.) <ul><ul><li>A. Extract traffic (through expect) </li></ul></ul>#!/bin/bash RSYNC=/usr/bin/...
4.  區網  IPv6 mrtg  流量監看 (cont.) <ul><ul><li>TYRC IPv6 traffic </li></ul></ul>Giga 2/8  ( 中央大學 ) NCU Giga 2/9  ( 中原大學 ) CYC...
4.  區網  IPv6 mrtg  流量監看 (cont.) FileReader fileReader = new FileReader(&quot;Data/10211200&quot;); String patternStr = &qu...
4.  區網  IPv6 mrtg  流量監看 (cont.) <ul><ul><ul><li>a) Extract Traffic Counters (2011-10-21 11:00 ) </li></ul></ul></ul>Interf...
4.  區網  IPv6 mrtg  流量監看 (cont.) if ( stat_if  && stat_ipv6 ) { temp_if = if_index.split(&quot;s+&quot;); // System.out.pri...
4.  區網  IPv6 mrtg  流量監看 (cont.) <ul><ul><ul><li>b)  Extract Traffic Counters to  database </li></ul></ul></ul>ID  Interfac...
4.  區網  IPv6 mrtg  流量監看 (cont.) <ul><li>Display/Record  the traffic </li></ul>
4.  區網  IPv6 mrtg  流量監看 (cont.) <ul><li>Mrtg traffic graph </li></ul><ul><ul><li>Install Mrtg </li></ul></ul><ul><ul><ul><...
4.  區網  IPv6 mrtg  流量監看 (cont.) ## FileName:  smurf.conf # Created by … WorkDir: /opt/apache-tomcat-6.0.32/webapps/ROOT/sm...
4.  區網  IPv6 mrtg  流量監看 (cont.) # Multi Router Traffic Grapher -- Sample Configuration File # Global configuration WorkDir...
4.  區網  IPv6 mrtg  流量監看 (cont.) mrtg.ipv6_28.sh #!/bin/bash #  提供 ipv6 inoctet/outoctet to mrtg configure y=`date +%Y` d=`...
4.  區網  IPv6 mrtg  流量監看 (cont.) ## # m h  dom mon dow  command ## 0  12 * * *  /usr/sbin/ntpdate -s ntp2.usno.navy.mil > /...
4.  區網  IPv6 mrtg  流量監看 (cont.) http://ayang.tyc.edu.tw/mrtg/
<ul><li>SNMP MIB for IPv6 Traffic </li></ul><ul><ul><li>Vender’s network products </li></ul></ul><ul><ul><li>IOS version  ...
5.  結語 (cont.)  <ul><ul><li>Extract interface traffic (with Expect) </li></ul></ul><ul><ul><li>Connect to router (with Exp...
感謝你的耐心聆聽 ! Q&A
Upcoming SlideShare
Loading in …5
×

I pv6 mrtg_20111025

468 views

Published on

IPv6_mrtg

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

I pv6 mrtg_20111025

  1. 1. IPv6 mrtg 流量監測 中央大學 電算中心 楊素秋 民國 100 年 11 月
  2. 2. OUTLINE <ul><li>1. IPv6 Network </li></ul><ul><li>2. SNMP/MIBs and IPv6 </li></ul><ul><li>3. Cisco router 之 IPv6 MIB OID </li></ul><ul><li>4. 區網 IPv6 mrtg 流量監看 </li></ul><ul><li>5. 結語 </li></ul>
  3. 3. 1. 建構 IPv6 Network <ul><li>Different types of networks </li></ul><ul><ul><li>Dual stack IPv6 & IPv4 networks </li></ul></ul><ul><ul><li>IPv6 only networks (few of them) </li></ul></ul><ul><li>Important to keep in mind </li></ul><ul><ul><li>Dual stack is not for ever </li></ul></ul><ul><ul><li>One IP stack should be removed… one day </li></ul></ul><ul><ul><li>No reasons for network admins to face twice the amount of work􀂄 </li></ul></ul>
  4. 4. 1. 建構 IPv6 Network (cont.) <ul><li>桃園區網 IPv6 建置實做 </li></ul><ul><ul><li>啟動 IPv6 routing </li></ul></ul><ul><ul><li>設定 DNSv6 </li></ul></ul><ul><ul><li>設定 DHCPv6 </li></ul></ul><ul><ul><li>啟動 6to4 tunneling </li></ul></ul>
  5. 5. 1. 建構 IPv6 Network (cont.)
  6. 6. 1. 建構 IPv6 Network (cont.) <ul><li>Is IPv6 ready ? </li></ul><ul><ul><li>Hardware </li></ul></ul><ul><ul><ul><li>Router/Switch </li></ul></ul></ul><ul><ul><ul><li>Firewall </li></ul></ul></ul><ul><ul><ul><li>Wireless AP </li></ul></ul></ul><ul><ul><ul><li>End system </li></ul></ul></ul><ul><ul><li>Application </li></ul></ul><ul><ul><ul><li>httpd, SMTP, DNS , ssh, ftp, news, whois, ntp </li></ul></ul></ul><ul><ul><ul><li>VoIP, multimedia streaming, Printing, Chat, Mysql </li></ul></ul></ul>
  7. 7. 1. 建構 IPv6 Network (cont.) <ul><li>IPv6 address </li></ul><ul><ul><ul><li>Linux </li></ul></ul></ul><ul><ul><ul><ul><li>Defaut enable IPv4/IPv6 </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Can configure tun6to4 </li></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>/etc/sysconfig/network-scripts/ifup-ipv6 </li></ul></ul></ul></ul></ul><ul><ul><ul><li>Windows 7 </li></ul></ul></ul><ul><ul><ul><ul><li>Defaut enable IPv4/IPv6 </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Defaut enable Teredo tunneling </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Configure tun6to4 automatically </li></ul></ul></ul></ul><ul><ul><ul><li>Windows XP </li></ul></ul></ul><ul><ul><ul><ul><li>Ipv6 install (tun6to4) </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Configure IPv6 Manually ( netsh >) </li></ul></ul></ul></ul>
  8. 8. 1. 建構 IPv6 Network (cont.) <ul><li>IPv6 測試網站 (www server) </li></ul><ul><ul><li>audp.tyc.edu.tw, showroom.twnic.net.tw </li></ul></ul><ul><ul><ul><li>Show the remote/client ipv6 address </li></ul></ul></ul><ul><ul><ul><ul><li>IPv4/IPv6 enable </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Tun6to4 enable </li></ul></ul></ul></ul><ul><ul><li>mrtgv6.tanet.edu.tw </li></ul></ul><ul><ul><ul><li>MRTG traffic monitoring for TANET backbone </li></ul></ul></ul><ul><ul><ul><ul><li>IPv6 enable </li></ul></ul></ul></ul><ul><ul><li>Media Server </li></ul></ul><ul><ul><ul><li>Ipv6.pku6.edu.cn & other mms links </li></ul></ul></ul>
  9. 9. 1. 建構 IPv6 Network (cont.)
  10. 10. 1. 建構 IPv6 Network (cont.)
  11. 11. <ul><li>SNMP and IPv6 </li></ul><ul><ul><li>Cisco: </li></ul></ul><ul><ul><ul><li>SNMP over IPv6 is available in 12.0(27)S </li></ul></ul></ul><ul><ul><ul><li>More features available from 12.0(30)S </li></ul></ul></ul><ul><ul><ul><li>Will become available in 12.3(14)T </li></ul></ul></ul><ul><ul><li>Juniper, Hitachi, 6wind: </li></ul></ul><ul><ul><ul><li>SNMP over IPv6 is available </li></ul></ul></ul>   2. SNMP/MIBs and IPv6
  12. 12. 2. SNMP/MIBs and IPv6 (cont.) <ul><li>IPv6 MIBs status </li></ul><ul><ul><li>MIBs are essential for the network management </li></ul></ul><ul><ul><li>SNMP-based applications are widely used </li></ul></ul><ul><ul><ul><li>but others exist too (NetFlow, XML…) </li></ul></ul></ul><ul><ul><li>SNMP rely upon MIBs … </li></ul></ul><ul><ul><ul><li>Need to have MIBs to collect IPv6information </li></ul></ul></ul><ul><li>Cisco router MIB </li></ul><ul><ul><li>IP-MIB, IPv6-MIB </li></ul></ul><ul><ul><li>RFC4293, … </li></ul></ul>
  13. 13. 3. Cisco router 之 IPv6 MIB Get some ipv6 traffic param. # show interface accounting ”   GigabitEthernet2/8 ### 國立中央大學 ###         Protocol    Pkts In   Chars In   Pkts Out  Chars Out                  IP 1654364275530 1003146055719738 885231569418 590190241240774                  DEC MOP          0          0      48709    6283461                   ARP     305354   18321240     739678   82843936                     IPv6   17637976 9652740892 3709526564 4112091137764 GigabitEthernet2/9 TYC-to-CYCU (140.135.0.0)                 Protocol    Pkts In   Chars In   Pkts Out  Chars Out                  IP 772909362921 366967798769448 580600995235 312548112347136                  DEC MOP          0          0      48711    6283719                  ARP      24395    1463700      69849    7823088                  IPv6         57       5554     154624   26273960
  14. 14. 3. Cisco router 之 IPv6 MIB (cont.) IP-MIB.oid . iso (1) . org (3) . dod (6) . internet (1) . mgmt (2) . mib-2 (1) . ip (4) . ipTrafficStats (31) (6509 router : Not implement) &quot;ipIfStatsEntry&quot; &quot;1.3.6.1.2.1.4.31.3.1&quot; “ ipIfStatsIPVersion&quot; &quot;1.3.6.1.2.1.4.31.3.1.1&quot; “ ipIfStatsIfIndex&quot; &quot;1.3.6.1.2.1.4.31.3.1.2&quot; … &quot;ipIfStatsInOctets&quot; &quot;1.3.6.1.2.1.4.31.3.1.5&quot; &quot;ipIfStatsHCInOctets&quot; &quot;1.3.6.1.2.1.4.31.3.1.6&quot; … &quot;ipIfStatsOutOctets&quot; &quot;1.3.6.1.2.1.4.31.3.1.32&quot; &quot;ipIfStatsHCOutOctets&quot; &quot;1.3.6.1.2.1.4.31.3.1.33&quot;
  15. 15.    3. Cisco router 之 IPv6 MIB (cont.) IPV6-MIB.oid (6509 router : Not implement) &quot;ipv6IfEntry&quot; &quot;1.3.6.1.2.1.55.1.5.1&quot; &quot;ipv6IfIndex&quot; &quot;1.3.6.1.2.1.55.1.5.1.1&quot; &quot;ipv6IfDescr&quot; &quot;1.3.6.1.2.1.55.1.5.1.2&quot; &quot;ipv6IfIdentifier&quot; &quot;1.3.6.1.2.1.55.1.5.1.6&quot; … . &quot;ipv6IfStatsEntry&quot; &quot;1.3.6.1.2.1.55.1.6.1&quot; &quot;ipv6IfStatsInReceives&quot; &quot;1.3.6.1.2.1.55.1.6.1.1“ … &quot;ipv6IfStatsOutForwDatagrams&quot; &quot;1.3.6.1.2.1.55.1.6.1.10&quot; &quot;ipv6IfStatsOutRequests&quot; &quot;1.3.6.1.2.1.55.1.6.1.11“ …
  16. 16. 3. Cisco router 之 IPv6 MIB (cont.) RFC4293 (  rfc-2011) (6509 router : Not implement) IpIfStatsEntry ::= { ipIfStatsIPVersion InetVersion , ipIfStatsIfIndex InterfaceIndex, ipIfStatsInReceives Counter32, ipIfStatsHCInReceives Counter64, ipIfStatsInOctets Counter32, ipIfStatsHCInOctets Counter64, ipIfStatsInHdrErrors Counter32, ipIfStatsInNoRoutes Counter32, ipIfStatsInAddrErrors Counter32, … . ipIfStatsOutOctets Counter32, ipIfStatsHCOutOctets Counter64, … . , ipIfStatsRefreshRate Unsigned32 }
  17. 17. 3. Cisco router 之 IPv6 MIB (cont.) OLD-CISCO-INTERFACES-MIB.oid (Cisco-SMI or SNMPV2-SMI) &quot;locIfipInPkts&quot; &quot;1.3.6.1.4.1.9.2.2.1.1.42&quot; &quot;locIfipOutPkts&quot; &quot;1.3.6.1.4.1.9.2.2.1.1.43&quot; &quot;locIfipInOctets&quot; &quot;1.3.6.1.4.1.9.2.2.1.1.44&quot; &quot;locIfipOutOctets&quot; &quot;1.3.6.1.4.1.9.2.2.1.1.45 &quot; ------------------------------------------ SNMPv2-SMI::enterprises.9.2.2.1.1.45.82 = Counter32: 2223932009 SNMPv2-SMI::enterprises.9.2.2.1.1.45.83 = Counter32: 2411945666 SNMPv2-SMI::enterprises.9.2.2.1.1.45.84 = Counter32: 0 SNMPv2-SMI::enterprises.9.2.2.1.1.45.85 = Counter32: 2121510125 SNMPv2-SMI::enterprises.9.2.2.1.1.45.86 = Counter32: 3949812438 SNMPv2-SMI::enterprises.9.2.2.1.1.45.87 = Counter32: 497226196 SNMPv2-SMI::enterprises.9.2.2.1.1.45.88 = Counter32: 0 SNMPv2-SMI::enterprises.9.2.2.1.1.45.89 = Counter32: 2595499782 SNMPv2-SMI::enterprises.9.2.2.1.1.45.90 = Counter32: 1402998647 SNMPv2-SMI::enterprises.9.2.2.1.1.45.110 = Counter32: 0 SNMPv2-SMI::enterprises.9.2.2.1.1.45.111 = Counter32: 83559617 SNMPv2-SMI::enterprises.9.2.2.1.1.45.112 = Counter32: 2700879959
  18. 18. 3. Cisco router 之 IPv6 MIB (cont.) CISCO-SWITCH-ENGINE-MIB . iso (1) . org (3) . dod (6) . internet (1) . private (4) . enterprises (1) . cisco (9) . ciscoMgmt (9) . ciscoSwitchEngineMIB (97) . cseMIBObjects (1) . cseL3Objects (4) -- cseL3Objects (4) + -- cseL3StatsTable (1) - -- cseL3VlanStatsTable (2) | - -- cseL3VlanStatsEntry (1) object Details | | -- cseL3VlanIndex (1) | | -- cseL3VlanInPkts (2) | | -- cseL3VlanInOctets (3) | | -- cseL3VlanOutPkts (4) | | -- cseL3VlanOutOctets (5) | | -- cseL3VlanInUnicastPkts (6) | | -- cseL3VlanInUnicastOctets (7) | | -- cseL3VlanOutUnicastPkts (8) | | -- cseL3VlanOutUnicastOctets (9) |
  19. 19. SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.1.1006 = Counter32: 3540473092 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.1.2006 = Counter32: 1649206378 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.1.3021 = Counter32: 3278444802 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.1.4008 = Counter32: 2865104007 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.1.5006 = Counter32: 1692158510 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.2.1006 = Counter64: 7828674924853378 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.2.2006 = Counter64: 5894807785811313 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.2.3021 = Counter64: 109506806884008 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.2.4008 = Counter64: 5713000850624076 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.2.5006 = Counter64: 1415152122007054 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.3.1006 = Counter32: 0 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.3.2006 = Counter32: 0 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.3.3021 = Counter32: 0 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.3.4008 = Counter32: 0 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.3.5006 = Counter32: 0 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.4.1006 = Counter32: 0 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.4.2006 = Counter32: 0 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.4.3021 = Counter32: 0 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.4.4008 = Counter32: 0 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.4.5006 = Counter32: 0 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.5.1006 = Gauge32: 130943 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.5.2006 = Gauge32: 76630 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.5.3021 = Gauge32: 106838 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.5.4008 = Gauge32: 130944 SNMPv2-SMI::enterprises.9.9.97.1.4.1.1.5.5006 = Gauge32: 2 3. Cisco router 之 IPv6 MIB (cont.)
  20. 20. 4. 區網 IPv6 mrtg 流量監看 <ul><ul><li>Extract interface traffic (with Expect) </li></ul></ul><ul><ul><li>Connect to router </li></ul></ul><ul><ul><li>CLI command </li></ul></ul><ul><ul><ul><li>Show interface accounting </li></ul></ul></ul><ul><li>Extract IPv4/IPv6 traffic </li></ul><ul><li>Appfuse Display/Record the traffic </li></ul><ul><li>Mrtg traffic monitoring </li></ul>
  21. 21. 4. 區網 IPv6 mrtg 流量監看 (cont.) <ul><ul><li>A. Extract traffic (through expect) </li></ul></ul>#!/bin/bash RSYNC=/usr/bin/rsync LOCALPATH=/home/yang VAR=$(expect -c&quot; spawn telnet 203.72.x.x expect Username send “test123r&quot; expect Password send “test123ncur&quot; expect &quot;$&quot; send &quot; show interface account r&quot; send ” r” send ” r” Expect –timeout 1 “ ) Echo “$VAR”
  22. 22. 4. 區網 IPv6 mrtg 流量監看 (cont.) <ul><ul><li>TYRC IPv6 traffic </li></ul></ul>Giga 2/8 ( 中央大學 ) NCU Giga 2/9 ( 中原大學 ) CYCU Giga 2/15 ( 萬能科大 ) VNU Giga 3/1 ( 開南大學 ) KNU Giga 3/2 ( 索尼電信 ) Sonet (IPv6 addr: 2404:80:400:102::2/64) Giga 3/6 ( 清雲科大 ) CYU Vlan 10 區網主幹 Vlan 11 縣網中心 ( 中華電信 ) Vlan 12 高中職主幹 Vlan 16 TANET_IPv6 Vlan 21 縣網中心 ( 亞太 ) Vlan 31 縣網中心 ( 中華電信 ) Vlan 350 ISP 電信業界 Vlan 227 區網測試網
  23. 23. 4. 區網 IPv6 mrtg 流量監看 (cont.) FileReader fileReader = new FileReader(&quot;Data/10211200&quot;); String patternStr = &quot;Tunnel|FastEthernet|GigabitEthernet|Vlan&quot;; String patternStr_ipv6 = &quot; IPv6&quot;; Scanner scan = new Scanner(fileReader);//get user input while (scan.hasNext()) { String passwordStr = scan.nextLine(); Pattern p = Pattern.compile(patternStr); Pattern p6 = Pattern.compile(patternStr_ipv6); Matcher m = p.matcher(passwordStr); Matcher m6 = p6.matcher(passwordStr); if ( m.find()) { if_index=passwordStr; stat_if = true; } if ( m6.find()) { ip_traffic=passwordStr; stat_ipv6=true; } if ( stat_if && stat_ipv6 ) { temp_if = if_index.split(&quot;s+&quot;); temp_ipv6 = ip_traffic.split(&quot;s+&quot;); System.out.println( temp_if[0] + &quot; :: &quot; + temp_ipv6[3] + &quot; &quot; + temp_ipv6[5]); stat_if = false ; stat_ipv6 = false ; } }
  24. 24. 4. 區網 IPv6 mrtg 流量監看 (cont.) <ul><ul><ul><li>a) Extract Traffic Counters (2011-10-21 11:00 ) </li></ul></ul></ul>Interface_ID InputOctets OutOctets ----------------------------------------------------------------- Vlan10 :: 20509776220 829193654452 Vlan11 :: 4266841630 371246825404 Vlan12 :: 169620231 25007101534 Vlan16 :: 184232151670 1405461604259 Vlan21 :: 235144926 29029034 Vlan31 :: 44247533065 1681292557522 Vlan227 :: 274562953 48790185465 Vlan350 :: 255545589 770282374 Vlan1412 :: 6032228 38751256 Gigabitt2/8 :: 9653687956 4316870814743 Gigabit2/9 :: 5554 26619570 Gigabit2/11 :: 1323101265 1105750541193 Gigabitt2/15 :: 31513818 4299670725 Gigabitt3/1 :: 105892439 38049219071 Gigabit3/2 :: 33287808 69682180 Gigabit3/6 :: 293889430 440506626293 Gigabitt7/7 :: 132738532 27774817831 Fast9/48 :: 12864 29033660 Tunnel2002 :: 1848864657481 1250252945233
  25. 25. 4. 區網 IPv6 mrtg 流量監看 (cont.) if ( stat_if && stat_ipv6 ) { temp_if = if_index.split(&quot;s+&quot;); // System.out.println( if_index); // System.out.println( temp_if); temp_ipv6 = ip_traffic.split(&quot;s+&quot;); // System.out.println( ip_traffic); // System.out.println( temp_if); out.write( temp_if[0] + &quot; :: &quot; + temp_ipv6[3] + &quot; &quot; + temp_ipv6[5] + &quot;n&quot;); // System.out.println( temp_if[0] + &quot; :: &quot; + temp_ipv6[2] + &quot; &quot; + temp_ipv6[3]); stat_if = false ; stat_ipv6 = false ; query1 = &quot; insert into counter (ip, in_counter, out_counter,time) values (?,?,?,?)&quot;; preparedStatement1 = connection.prepareStatement(query1); preparedStatement1.setString(1,temp_if[0]); preparedStatement1.setString(2,temp_ipv6[3]); preparedStatement1.setString(3, temp_ipv6[5]); // java.sql.Date sqlDate = new java.sql.Date(new java.util.Date().getTime()); preparedStatement1.setString(4,cur_time); preparedStatement1.executeUpdate(); } //end_if_ipv6 } // end_while scan.close(); out.close();
  26. 26. 4. 區網 IPv6 mrtg 流量監看 (cont.) <ul><ul><ul><li>b) Extract Traffic Counters to database </li></ul></ul></ul>ID Interface Input Output Date ---------------------------------------------------------------------- | 741 | Vlan10 | 20571164866 | 829200762932 | 10241850 | | 742 | Vlan11 | 4272996247 | 377461803123 | 10241850 | | 743 | Vlan12 | 183440033 | 25548984550 | 10241850 | | 744 | Vlan16 | 184913813451 | 1414980825672 | 10241850 | | 745 | Vlan21 | 237832956 | 29306814 | 10241850 | | 746 | Vlan31 | 44251484788 | 1732140191214 | 10241850 | | 747 | Vlan227 | 276781227 | 49016205422 | 10241850 | | 748 | Vlan350 | 258482708 | 774947781 | 10241850 | | 749 | Vlan1412 | 6108980 | 39152930 | 10241850 | | 750 | GigabitEthernet2/8 | 9654431653 | 4413250509581 | 10241850 | | 751 | GigabitEthernet2/9 | 5554 | 26896840 | 10241850 | | 752 | GigabitEthernet2/11 | 1327541852 | 1128645499515 | 10241850 | | 753 | GigabitEthernet2/15 | 31830084 | 4501406597 | 10241850 | | 754 | GigabitEthernet3/1 | 256466203 | 39515807937 | 10241850 | | 755 | GigabitEthernet3/2 | 33287808 | 69682180 | 10241850 | | 756 | GigabitEthernet3/6 | 301228108 | 464918940437 | 10241850 | | 757 | GigabitEthernet3/16 | TANet | IPv6 | 10241850 | | 758 | GigabitEthernet7/7 | 132925744 | 27775934890 | 10241850 | | 759 | FastEthernet9/48 | 12864 | 29311100 | 10241850 | | 760 | Tunnel2002 | 1848864657481 | 1250252945233 | 10241850 | | 761 | Vlan10 | 20571286162 | 829200776832 | 10241900 | | 762 | Vlan11 | 4273009579 | 377475816328 | 10241900 | | 763 | Vlan12 | 183472973 | 25549085768 | 10241900 | | 764 | Vlan16 | 184915135286 | 1415000279212 | 10241900 | |
  27. 27. 4. 區網 IPv6 mrtg 流量監看 (cont.) <ul><li>Display/Record the traffic </li></ul>
  28. 28. 4. 區網 IPv6 mrtg 流量監看 (cont.) <ul><li>Mrtg traffic graph </li></ul><ul><ul><li>Install Mrtg </li></ul></ul><ul><ul><ul><li>Download Mrtg-2.17.2 </li></ul></ul></ul><ul><ul><ul><li>Install libgd2 </li></ul></ul></ul><ul><ul><ul><ul><li>apt-get -y install libgd2-xpm-dev build-essential </li></ul></ul></ul></ul><ul><ul><ul><li>Install Mrtg-2.17.2 </li></ul></ul></ul><ul><ul><li>Configure mrtg.cfg </li></ul></ul><ul><ul><li>Configure crontab </li></ul></ul><ul><ul><ul><li>Per 10-minutes </li></ul></ul></ul>
  29. 29. 4. 區網 IPv6 mrtg 流量監看 (cont.) ## FileName: smurf.conf # Created by … WorkDir: /opt/apache-tomcat-6.0.32/webapps/ROOT/smurf Options[_]: growright, nopercent Language: UTF-8 Target[smurf_km]:.1.3.6.1.2.1.2.2.1.11. 65 &.1.3.6.1.2.1.2.2.1.17. 65 :publicxx@203.72.x.x: SetEnv[smurf_km]: MRTG_INT_DESCR=&quot; 金門縣網 &quot; MaxBytes[smurf_km]: 125000000 Title[smurf_km]: IP Packets : TANET_Km PageTop[smurf_km]: <H3>IP Packets : TANET- 金門縣網 GE 3/7</H3> YLegend[smurf_km]: IP Packet Count Target[smurf_mts]:.1.3.6.1.2.1.2.2.1.11. 66 &.1.3.6.1.2.1.2.2.1.17. 6 6:publicxx@203.72.x.x: SetEnv[smurf_mts]: MRTG_INT_DESCR=&quot; 連江縣網 &quot; MaxBytes[smurf_mts]: 125000000 Title[smurf_mts]: IP Packets : TANET_MTS PageTop[smurf_mts]: <H3>IP Packets : TANet-- 連江縣網 GE 3/8</H3> YLegend[smurf_mts]: IP Packet Count Mrtg.conf 例
  30. 30. 4. 區網 IPv6 mrtg 流量監看 (cont.) # Multi Router Traffic Grapher -- Sample Configuration File # Global configuration WorkDir: /opt/apache-tomcat-6.0.20/webapps/ROOT/mrtg WriteExpires: Yes Language: utf8 Title[^]: Traffic Analysis for IPv6 links Target[giga28]: `/home/mrtg-2.17.2/bin/mrtg.ipv6_28.sh` MaxBytes[giga28]: 10000000000 Options[giga28]: growright, nopercent YLegend[giga28]: Bits per second ShortLegend[giga28]: LegendO[giga28]: &nbsp; IPv6 Output LegendI[giga28]: &nbsp; IPv6 Input Title[giga28]: IPv6 Traffic for GigabitEther 2/8 link PageTop[giga28]: <H1> GigabitEther 2/8</H1> <TABLE> <TR><TD>System:</TD> <TD>TYRC GigabitEther 2/8</TD></TR> </TABLE> Target[giga29]: `/home/mrtg-2.17.2/bin/mrtg.ipv6_29.sh` MaxBytes[giga29]: 10000000000 Options[giga29]: growright, nopercent YLegend[giga29]: Bits per second ShortLegend[giga29]: LegendO[giga29]: &nbsp; IPv6 Output LegendI[giga29]: &nbsp; IPv6 Input Title[giga29]: IPv6 Traffic for GigabitEther 2/9 link PageTop[giga29]: <H1> GigabitEther 2/9</H1> <TABLE> <TR><TD>System:</TD> <TD>TYRC GigabitEther 2/9</TD></TR> </TABLE> <ul><ul><li>mrtg.cfg </li></ul></ul>
  31. 31. 4. 區網 IPv6 mrtg 流量監看 (cont.) mrtg.ipv6_28.sh #!/bin/bash # 提供 ipv6 inoctet/outoctet to mrtg configure y=`date +%Y` d=`date +%m%d%H` m=`date +%M` m=`expr $m / 10` d=&quot;$d&quot;&quot;$m&quot;&quot;0&quot; # 1. ipv6 inoctet/outoct echo `cat /home/Expect/IPv6/$d | grep GigabitEthernet2/8 |awk '{print $3}'` echo `cat /home/Expect/IPv6/$d | grep GigabitEthernet2/8 |awk '{print $4}'` # 2. UpTime & interface name UPtime=`/usr/bin/uptime | awk '{print $3 &quot; &quot; $4 &quot; &quot; $5}'` echo $UPtime echo &quot;GigabitEthernet2/8&quot;
  32. 32. 4. 區網 IPv6 mrtg 流量監看 (cont.) ## # m h dom mon dow command ## 0 12 * * * /usr/sbin/ntpdate -s ntp2.usno.navy.mil > /dev/null & ## # Probe IPv6 Traffic from TYRC router */10 * * * * /home/Expect/expect.sh >> /home/Expect/log_ ## # Extract IPv6 inOctet/outOctet counter for each interfaces */10 * * * * /home/Expect/run.sh >> /home/Expect/logs/expect ## # Cron execute mrtg 8-58/10 * * * * env LANG=C /home/mrtg-2.17.2/bin/mrtg /home/mrtg-2.17.2/bin/mrtg.cfg ## crontab
  33. 33. 4. 區網 IPv6 mrtg 流量監看 (cont.) http://ayang.tyc.edu.tw/mrtg/
  34. 34. <ul><li>SNMP MIB for IPv6 Traffic </li></ul><ul><ul><li>Vender’s network products </li></ul></ul><ul><ul><li>IOS version of the product </li></ul></ul><ul><li>Vender’s SNMP MIB search service </li></ul><ul><ul><li>Cisco :: SNMP Object Navigator </li></ul></ul><ul><ul><ul><li>http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?objectInput=1.3.6.1.4.1.9.9.97+&translate=Translate&submitValue=SUBMIT&submitClicked=true </li></ul></ul></ul>5. 結語
  35. 35. 5. 結語 (cont.) <ul><ul><li>Extract interface traffic (with Expect) </li></ul></ul><ul><ul><li>Connect to router (with Expect) </li></ul></ul><ul><ul><ul><li>CLI command </li></ul></ul></ul><ul><ul><ul><ul><li>Show interface accounting </li></ul></ul></ul></ul><ul><li>Extract IPv4/IPv6 traffic </li></ul><ul><li>Appfuse Display/Record the traffic </li></ul><ul><li>IPv6 mrtg traffic monitoring </li></ul><ul><ul><li>http://ayang.tyc.edu.tw/mrtg/ </li></ul></ul>
  36. 36. 感謝你的耐心聆聽 ! Q&A

×