易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 1040|回复: 0
收起左侧

H3C交换机openflow配置 测试

[复制链接]
发表于 2022-2-21 13:51:31 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
H3C 交换机 OpenFlow 配置指南
! M4 j' r5 }7 n# y5 c目录
4 ^* B* {; W+ F/ Q( Z) |5 bConsole 连接交换机' I0 h* B7 T& @
配置 VLAN
" ^. G: X, R& X' I创建实例并映射 VLAN% Q' S* q) j( C4 A
配置控制器1的IP地址并激活实例
/ |& ~# X) z% R验证配置! s$ |! v9 |# @0 n
1. Console 连接交换机8 d6 I% _" k) |  |4 X8 z" f/ l% t0 O
笔记本连接需要一个 USB 转 RS232 串口线。
/ z' q6 L+ O4 ]% b% m! u+ _MacOS# p2 N; o; }% }' |* B
连接后,MacOS 下可以从终端查看设备状态
/ Z( o9 ]  ?6 A2 W. Y) tbash $ ls /dev/cu.usbserial-*
% m. }# ?  i0 `) A/dev/cu.usbserial-A106Z8ML
" M% S9 q, e5 j  I3 s, w' M2 B. `4 L: t
9 n! q6 d- m5 v6 @
然后可以用 screen 连接。
# K/ @3 h7 X# c3 B. }. _screen /dev/cu.usbserial-A106Z8ML
" Q5 S4 H9 w4 k& g3 K% f) X/ |5 R) f5 z4 i4 Z7 T; z
Windows0 o# o0 ^  x3 E- ^7 U4 W) d- s; v
可以用 SecureCRT 或者串口精灵之类的程序通过串口连接。
+ a( i3 m, A; F5 c4 ?* r" o连接以后,按几次 Enter,输出大概是, t% H. r8 f  i6 w6 |
<H3C>%Jan  1 21:20:28:599 2011 H3C SHELL/5/SHELL_LOGIN: TTY logged in from aux0.
/ E; |3 ]1 Y6 ^<H3C>
2 L* m) g8 L; P8 x7 {3 l1 iPress ENTER to get started.
9 ^9 s& k  f  E" G1 c8 a% p$ V<H3C>%Feb 21 14:09:42:051 2022 H3C SHELL/5/SHELL_LOGIN: Console logged in from con0.
2 V: T( {, l* A5 y$ Q# ^# }* H. x5 C/ m8 k; @: n% b  B2 R; b
2. 配置 VLAN; C3 `  F& K  _  c1 ]8 c* M/ d+ T
创建VLAN 4092和4094
. E9 V! @6 v' {9 C$ F<H3C>system-view, J/ o7 h  r) g; \& s$ ^
System View: return to User View with Ctrl+Z
: T3 v! v( J9 u' e1 g2 e[H3C]vlan 4092: d  W, G2 z5 h  n
[H3C-vlan4092]quit
4 ^8 L- B1 ~; C" i2 g" W  x, ~[H3C]vlan 4094
" U4 Q  i/ L# N5 J3 q0 @: W$ f[H3C-vlan4094]quit
" \+ U; I8 w' ^1 K% @. Z7 I! L/ w
<H3C>system-view) [5 b9 I. u) \/ m
System View: return to User View with Ctrl+Z.; i5 ?$ Y3 q5 R# y$ j
[H3C]vlan 4092; B+ A% M# k( T- _! J
[H3C-vlan4092]quit
) D9 D( A; O% z0 s[H3C]vlan 4093
# k( K. W+ L" A3 f  q% H  X[H3C-vlan4093]quit
1 {: w% c# j. E1 \; P1 u[H3C]no# q, e- D: V9 Q* ^
[H3C]no vla9 _; I* B$ E1 c  b" Q, s
[H3C]no vlan 4093+ ^5 ~( h. |$ ^, b+ G3 T# }1 ?
[H3C]vlan
* q3 M# |; d% k6 B' s; |4 x[H3C]vlan 4094% O! r. p- ~5 D$ V; M
[H3C-vlan4094]quit3 T5 n2 y7 c, L1 x9 ]
[H3C]  I, u& i3 k2 @" b5 U; w

; w3 r! D' U% @( O/ A6 R# I! X" C[H3C]display vlan! W: u1 o) w; g! z7 A: }9 B8 A8 Q: M
Total VLANs: 33 w& l" F" Y" ^( q; z
The VLANs include:: d2 V8 x$ n+ F: q  [7 R: N
1(default), 4092, 4094
/ W2 k4 ]# N9 [3 K% L[H3C]
) P9 [3 ~+ ~/ v9 B" o* d! T4 e$ I" V; H7 ^5 M
创建VLAN接口1并配置IP地址
. F  x8 m  _+ H# b4 ~1 S* R/ c上图是官方文档中的例子
7 c3 K; e" J' N/ P3 G6 J0 I3 Z% x- k[H3C]interface Vlan-interface 1
/ A+ N. v% @7 q) \+ W
' t7 O$ w! f: c- k. |[H3C-Vlan-interface1]undo shutdown
$ d7 P/ d: P% O1 D( ^[H3C-Vlan-interface1]ip1 N0 L- x/ L( L4 r/ l& h  N8 v
[H3C-Vlan-interface1]ip address 192.168.7.1 24
. y7 t+ E! \: c' v7 T. M[H3C-Vlan-interface1]quit! N' ?, ]7 [) n; a* Z; a. u8 z
; b7 i6 t. [  s7 O4 ~
6 T6 @: j8 b" l7 V/ O, `" ~
. o0 u; L7 ]3 j! f: E+ W
[H3C]interface Vlan-interface 11 v1 Y  S: i( i" ~; f* u
/ O+ u6 _/ t% @1 G% D, D
' P6 B8 N8 g8 |7 ~$ |. P

( F& d7 l0 m# v
5 a, \+ [4 e9 @7 z& O2 ?[H3C-Vlan-interface1]undo shutdown# y6 W) [7 _# P( ?5 d3 J
* c, j  k% c% G" O
[H3C-Vlan-interface1]ip address 192.168.7.1 24
; x6 D* U" J' G2 W[H3C-Vlan-interface1]quit0 T2 g7 U' K  n8 o
[H3C]' t9 o6 E6 f& t
/ t4 L: \1 `. J3 x/ Q/ e( }
设置完以后,将控制器所在PC的IP地址设置为 192.168.49.49,可以通过 ping 测试是否连通。6 S& g8 a1 a) D
[H3C]ping 192.168.7.490 d6 W- r4 S' N2 y% U- g* W7 q5 B
Ping 192.168.49.49 (192.168.7.49): 56 data bytes, press CTRL_C to break2 ^* D' d3 T3 p6 n! J
56 bytes from 192.168.7.49: icmp_seq=0 ttl=64 time=1.897 ms- r4 W2 \6 j9 B9 Y6 b6 j, h
56 bytes from 192.168.7.49: icmp_seq=1 ttl=64 time=1.268 ms
" U/ Y/ Q# L. R# m56 bytes from 192.168.7.49: icmp_seq=2 ttl=64 time=1.627 ms
: [% A. H* v" R56 bytes from 192.168.7.49: icmp_seq=4 ttl=64 time=1.855 ms
+ w7 p1 B; d9 Z- R( y8 C--- Ping statistics for 192.168.7.49 ---7 e6 ^+ @# {' g& f7 s+ B
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss' X: g3 Y% X2 M7 L: o  }4 E* G. A) y
round-trip min/avg/max/std-dev = 1.170/1.563/1.897/0.297 ms
4 G' C" s/ [, E5 }8 _2 ^5 G) [
( v, p$ q1 R1 {" V# `[H3C]%Jan  1 21:47:00:208 2011 H3C PING/6/PING_STATISTICS: Ping statistics for 192.168.7.49: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.170/1.563/1.897/0.297 ms.3 B" U0 W9 O; g# Q6 ?* q
) i" h0 B1 g; v. v' v

, Q8 ^) ?' C- g4 D
  j% V- C( \2 g) m! x- h( D, {3. 创建 OpenFlow 实例并映射 VLAN
- }$ D; L" W4 T0 f7 i' ^% v' R<H3C> system-view
8 g  f3 b; m4 d[H3C] openflow instance 1
' b7 e( W, H5 d6 Q. ^[H3C-of-inst-1] classification vlan 4092 mask 4093
- O/ G) n* E: f" [6 E! e7 l6 \4 [; o3 u0 ^

' S9 E! Q4 ^* \2 }6 P: t2 f; N$ ?0 V. |3 A5 b- T- b2 m
<H3C>system-view! V% s8 f  k: P2 k
System View: return to User View with Ctrl+Z./ g- }7 M/ Q' R' J/ v& z& S! W
5 e+ T1 Z% ]5 p& b
[H3C]openflow instance 1
4 n" H) }+ c! v, X4 M2 M1 s8 N& k# }9 M% U. V
[H3C-of-inst-1]classification vlan 4093 mas) {9 v- T' N  {  k8 a7 s, P
[H3C-of-inst-1]classification vlan 4093 mask 4094
; w  W$ S6 C9 T7 u[H3C-of-inst-1]classification vlan 4093 mask 4093
/ ^. N: L% R. Q! X5 E! m2 H6 O, {+ T8 R: \8 X6 d5 a' _
配置端口
1 |" {$ y; e, ]1 B; `- v: t8 y
! Z0 I3 C7 `  l, q3 c4 Q[H3C]interface Ten-GigabitEthernet 1/0/1
! B- O7 n$ M/ N! T+ j- ?# o  C[H3C-Ten-GigabitEthernet1/0/1] port type trunk
8 w/ `" C+ H; Q2 e: |8 K[H3C-Ten-GigabitEthernet1/0/1] port trunk permit vlan 4092
# L, @9 s0 V9 n' Q+ W# o7 p[H3C-Ten-GigabitEthernet1/0/1] quit
* ]9 n& z$ L! S! b" G
, Z) g1 F* ?! o  w6 s0 _( m# X- f) c7 u6 w
我们需要把希望 OpenFlow 管理的端口加入 vlan 4092 中。9 I; {) J. [1 O+ c& X/ [
其中 1/0/1 用于连接控制器,1/0/2 保留。- v( B( E6 e/ L' B/ c' E1 E
<H3C> system-view
# M8 `  ~! S7 b4 {0 T4 Y[H3C] vlan 40924 ?6 J' p# X( v
[H3C-vlan4092] port Ten-GigabitEthernet 1/0/3 Ten-GigabitEthernet 1/0/4 ... Ten-GigabitEthernet 1/0/48
# D- n" _+ u& v$ N: G, k1 a& B[H3C-vlan4092] quit' _8 A- P7 m1 z

, M" b* _4 D) ]9 ^3 V! m4 ^% Q4. 配置控制器1的IP地址并激活实例6 o+ {- _% \7 r: E0 {
[H3C-of-inst-1] controller 1 address ip 192.168.7.49
9 l7 K7 l- `, B/ _9 z[H3C-of-inst-1] active instance
" ?- C* c9 N: U) J
% a+ i! |/ U$ A+ S0 J, d5. 验证配置
, B9 S* A' Q  B. g+ E8 @( R<H3C-of-inst-1> display openflow instance 1
- k! K( {  B8 i/ M3 `" Z( mInstance 1 information:
# F& @4 Y, b2 w$ @# C3 W$ l0 r4 TConfiguration information:
! C9 c% j4 @+ r- x5 d4 d* U& b7 H8 Q# U Description   : --, ~/ G- n; K2 d6 H% T0 y
Active status : Active
/ z4 _7 x1 o0 ?9 ^& G Inactive configuration:
. ~* E' T" u2 E6 h( i  None2 b2 g$ p$ N! e. Z: p
Active configuration:# K+ r7 s  ^4 J& u" e4 d
  Classification: VLAN, total VLANs(1)
; {; t+ {' o: ^' ]   4092. _7 b. z" a# V! ^# N
  In-band management VLAN, total VLANs(0)
5 c  A# c' s- t; x5 n( _& g   Empty VLAN6 j" y8 n. m+ x5 a# W
  Connect mode: Multiple
% ~- a: h$ Q+ D2 e2 A  MAC address learning: Enabled
( h; {, o" [) W$ L& s  TCP DSCP value: 64
  L3 G+ N) x" ?& n( _  Flow table:: K4 V1 ?1 ]4 B3 }3 S) p/ _
   Table ID(type): 0(Extensibility), count: 9' q( q* L5 A' R: L2 a
  Flow-entry max-limit: 65535
& }% }- J5 A2 O2 h  Datapath ID: 0x000188df9eeaaaaa" H7 B, `3 e2 b2 W  f
  Default table-miss: Drop
! m' K8 q! x# |. x$ y' M  Forbidden port: None
; G! c$ R8 V% V2 e; [. Z; j6 x1 ~  Qinq Network: Disabled4 U  a, ~% R# L3 ?- O# u1 M" ^0 `8 a
  TCP connection backup: Enabled
# k1 @6 ]: Q! d' [* DPort information:
  @2 A; ?: d  W# }* C) W Ten-GigabitEthernet1/0/1
3 I* A8 Z3 }. n! v) r# v. U$ H Ten-GigabitEthernet1/0/3
8 Y/ D" g  r( `8 a) H4 ?" [+ y Ten-GigabitEthernet1/0/4
' f) N: Q2 J: S% z1 y. i ...8 E8 M" P: D$ j& ~6 S
Ten-GigabitEthernet1/0/47
. h+ O) a4 R; k9 z& U Ten-GigabitEthernet1/0/48
- s/ i" Z2 m" o3 \% h8 f/ w% b7 lActive channel information:
, T5 A  ]( ?7 H- t, R- l. a Controller 1 IP address: 192.168.7.49 port: 6633
$ |; D- j9 F5 ]2 t9 q' x& R4 p5 h1 Y1 Y5 `
然后就可以在 PC 上启动控制器,等待交换机连接。
6 P. B0 J9 P3 v  M+ |3 l* `% z: a/ x( A, m5 L' Z
5 R; F7 q' c: e" ?9 H: J
[H3C]display openflow instance 1  l: y/ l0 X1 o+ o
Instance 1 information:3 q7 `/ k7 S  l3 Y/ l6 K4 ^
Configuration information:
4 C; W) t, A* Q$ K Description   : --' f" B7 h9 m8 A3 }1 k3 `
Active status : Inactive
# A$ D+ W' F4 e- b. x1 d* f Inactive configuration:1 C5 @- P, `7 M- o3 K
  Classification: VLAN, total VLANs(2)
0 Y5 i! W" s( {, V3 A' h. C, ?   4092, 4094
, `1 o& s- a# \: o' n, B  In-band management VLAN, total VLANs(0)
  \8 _8 }  a& t1 x# ]% _7 W   Empty VLAN
2 O$ g  E# M8 z5 e/ Z: v  Connect mode: Multiple
9 ]' P& c0 \  a- W! _4 v4 l  MAC address learning: Enabled
0 z4 V  E6 u& m7 r  U  TCP DSCP value: 10$ B# y$ [+ o  }
  Flow table:( f8 y9 |: H4 l9 T0 o
   Table ID(type): 0(Extensibility)
, O( y$ P9 g5 R: s9 I2 P5 E  Flow-entry max-limit: 65535
* D8 t* c" M, T  k- A  Datapath ID: 0x0001a699068a01004 x# u( y7 o7 S( e; d7 }' A* c' |; D
  Default table-miss: Drop
% ^4 M. @: i9 s# Q4 F3 o/ B  Forbidden port: None' W' A" I; U! l" l1 c0 c
  Qinq Network: Disabled
/ N3 D; _5 F% I7 b7 W/ a1 F# m  TCP connection backup: Enabled" G6 E0 T4 l  O' c; E7 o5 }2 l
Active configuration:
5 b( T: v' l% o2 P# E  None
- V' g: t% v8 i! ^
, b3 j8 f' M1 t
# F6 z1 F1 ]2 I
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:31 , Processed in 0.046841 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表