下面是局域网的焦点交流机(三层交流)和二层交流之间的端口聚合的操作实例:1 w ^: l! h: ^$ Z$ i' f
5 ~- u0 p, y* ]# {) o u& S7 k 29509 ]. x+ P0 }+ j5 w6 h1 ?% u7 T
Switch>en
3 k+ _4 t& h: W Switch#conf t0 G6 S. \. i, T& |
Enter configuration commands, one per line. End with CNTL/Z.
) _# U( p3 Y. h( G) t Switch(config)#int f0/1
8 B$ o( t+ R( m" v0 ~ Switch(config-if)#channel-group 1 mode on: k; W+ U1 D/ V* c6 S) h
%LINK-5-CHANGED: Interface Port-channel 1, changed state to up
# ^% I6 P0 a/ I) p2 Z %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to upSwitch(config-if)#int f0/2) d: u' U' \, P7 n$ k
Switch(config-if)#channel-group 1 mode on
9 |# w$ S$ K, e: w2 s. S% S2 Z8 T 3560
; r" o# t, |4 [& ]) \ Switch(config)#int port-channel 1- b! Y% C7 _9 @+ o( z9 ]1 Y
Switch(config-if)#exit" Z/ D8 o- | ]. E$ d/ I
Switch(config)#ip routing(默认已经启用了路由功能)1 n& w6 O# z( k& N3 ^- u7 |% S
Switch(config)#int port-channel 1
- h) ~% X% G8 n j+ I0 F8 v( } Switch(config-if)#no switchport
) o6 p* y# ?1 j) ? [ Switch(config-if)#ip add 1.1.1.1 255.0.0.0* w6 Z; K M/ o4 _) v
Switch(config-if)#no shut
0 C e6 r& c8 ?& Z) Q7 O Switch(config-if)#exit( [3 q! v# U& K) n& }8 x4 G
Switch(config)#int f0/1; B$ A5 ^" F, u" \+ M! m% l
Switch(config-if)#no switchport
% d8 s0 b( A- `: l6 | %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down3 \ B; w: E# e. v! T
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upSwitch(config-if)#) r& _+ _' c! K' Q9 b0 a. W/ `, N
Switch(config-if)#no ip add2 |4 K$ C/ f5 m/ ^0 W0 v8 P
Switch(config-if)#channel-group 1 mode ?
+ S4 u7 V1 R ]' N, ]; U active Enable LACP unconditionally: V/ ~# A/ ]6 x2 c5 P
auto Enable PAgP only if a PAgP device is detected8 z- {+ T; ?! K2 `; K2 p
desirable Enable PAgP unconditionally
( U% H2 l6 L: ?! }3 f& ` on Enable Etherchannel only
: |: t: T6 I- G% @3 g; b) |% A. t passive Enable LACP only if a LACP device is detected( ^& A0 V3 N+ O* H: p
Switch(config-if)#channel-group 1 mode on1 l* v6 t8 v9 j0 U8 p
%LINK-5-CHANGED: Interface Port-channel 1, changed state to up
( X$ k1 i5 V( P2 F %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to upSwitch(config-if)#
u# M6 O6 P! `3 [0 T L0 j- v( Q8 n Switch(config-if)#int f0/2
8 c! f' [9 }. @: H# v Switch(config-if)#no switchport
+ ^9 j7 f: E7 S& g5 X" G %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down! Y& D- V/ I, m+ z$ o/ S
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to upSwitch(config-if)#no ip add
9 {* g7 t& }% i. z% R Switch(config-if)#no ip address, C: q, ]" v0 N# _5 k/ j3 s* m
Switch(config-if)#channel-group 1 mode on* _( B2 ]3 O$ e, Z/ ~, ?( k n" J0 K
Switch(config-if)#exit/ B7 @+ Y* G# [
Switch(config)#int f0/3* r8 @) Z* N B" g$ o5 d i
Switch(config-if)#no switchport
; E8 i3 a9 }0 R- {6 K* z& \ %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down! D* h F, w: w$ \, ^ f& H/ p
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to upSwitch(config-if)#ip add 2.2.2.1 255.0.0.0
. ]0 d0 I6 F' _$ P0 ^! V0 d- U v4 n Switch(config-if)#no shut; {# w; h( y9 X" t9 k/ S7 R1 E0 ~9 _
端口聚合可使流量在多条物理链路上负载平衡,同时也起到了链路的备份浸染。可是在某些设备里,应注重聚合链路两头接口的速度,工作模式,例如在快以中,可将各个端口设置为speed 100,duplex full。 ) c: ?9 a0 T) X! O4 R2 j1 s7 H+ k
4 E. b1 T( U( a' \, h, D+ J) e line con 0
5 Z+ B/ n1 B6 @% S9 @ line aux 0
1 a) _/ a$ ^: @0 i$ w line vty 0 4
" R. |5 q0 K% f3 V0 D1 c login
7 [2 I/ z$ s, y4 B3 Y( x0 M" T/ d D !# V5 s; u- g9 U) o2 j
endRouterB#sh run
! p8 [. d& o& e# F5 [+ f Building configuration...Current configuration:
# p, o& H- Q( A4 m3 i5 z* v% m !
3 c: ?3 Q, l P' c6 _$ ]1 W: u) n version 11.2
; r5 U: m0 [* Y( B: e no service password-encryption8 w$ E& v$ F4 _0 u# E
no service udp-small-servers
# n3 |# h7 f5 L8 I% g- k0 T4 ~: e no service tcp-small-servers
2 H1 ?5 \$ M6 N' K0 |1 z# e !
. S, j3 n# o& z2 ?: @3 Z U' K7 A hostname RouterB
$ C4 _) `3 |7 F* ?3 t" Z !' k5 g% V0 @+ K" m* a" _
!5 l b& Q* p) ]4 c4 _
!0 ~/ J; T! r+ B) [! ?! M/ w$ V" ^
interface Ethernet0
+ g' J' v R6 A2 {6 _6 H n: W ip address 172.16.30.1 255.255.255.0. P6 q9 i: C7 n2 [4 |5 s+ ~
!7 g3 Z- b- r7 t! n- h& \% `' ] p" e
interface Serial0
2 ~9 ?0 @* U8 p( p' s' P ip address 172.16.20.2 255.255.255.0
! `* X$ y$ i) \$ z9 l& }7 @ clockrate 56000, a$ e* ^% C2 U6 }
!$ R, D% h( x* E+ p% r, ] ~. O
interface Serial1! B9 X( \: o5 `7 v; D$ @( o
ip address 172.16.40.1 255.255.255.06 j2 G2 r% u) g ^" H9 X, ~* h7 {
clockrate 56000
& g) `9 _" i. } B c !
# e% G- N5 @) `: ^7 v no ip classless8 N0 B( _% n# r9 K) K( [1 Q
ip route 172.16.10.0 255.255.255.0 172.16.20.1! `: W+ | @' X9 ~: P' S
ip route 172.16.50.0 255.255.255.0 172.16.40.2
0 u! I/ r9 _1 c, R/ x2 { !3 s7 G \3 z! U7 ?
!
% U! ?1 j; t1 p line con 0
8 t$ K5 A0 r5 M; r, `+ Y line aux 0
! R+ `: V3 L+ f" _/ y" E line vty 0 4
; L& F3 N* w/ C9 k/ x login
" E) x: J) z3 A" _1 \+ }5 R !
- y7 u7 k5 r# n7 ^ end
' r4 J6 V9 Y2 M8 c9 X RouterC#sh run0 ~7 c3 @7 C: M a
Building configuration...Current configuration:5 I1 W/ b6 Z& F
!0 G# R& O: m) e6 V
version 11.2
k/ h5 D4 r* X* w+ C, r no service password-encryption( _3 X, Q1 Y4 i) e+ b
no service udp-small-servers% }& c" L1 F+ y! `4 k, L
no service tcp-small-servers$ ~% b4 {& @0 [' Q5 L$ c
!2 N) }& f7 K/ H) ~) M. Q
hostname RouterC( A' }+ C/ M+ B
!3 C3 W/ M1 d1 c' S: g% W- |! k; S
! e; C* g4 ` q$ O) K. _' J2 j
!. w5 v% \. D3 f
interface Ethernet0
7 g0 I. v5 M3 ? ip address 172.16.50.1 255.255.255.0
( a( y! i. ^8 ~4 V, r1 H5 c0 O/ v8 j !
/ c# O: L4 _# Y1 r interface Serial0
# W2 L# x7 i/ k( y1 T9 R ip address 172.16.40.2 255.255.255.0
- b @$ g, S5 j i" b* s no fair-queue3 B, t2 \9 ]4 l y1 Y8 a
!' I. D" c" D4 ?: l: \; ~" L
interface Serial1
% U# H N# F8 [+ o no ip address
% G0 g7 H: r/ p6 E; `' { shutdown
5 l$ O/ r0 g. V3 D, Z& w# B& w6 ~, N !
T. R. m! L- O) X ! N- j" c6 A5 ?7 \( t% z& O( Z
no ip classless
2 Z3 O* S5 [3 F ip route 172.16.10.0 255.255.255.0 172.16.40.1# B) F# \# [, |+ d8 n) M
ip route 172.16.20.0 255.255.255.0 172.16.40.1
2 H, T" h3 F( g* G8 s4 Z ip route 172.16.30.0 255.255.255.0 172.16.40.1
, x. m8 z5 K, l8 N4 ?& V- z !6 d$ ~3 u# p+ ?2 s
!
" Q# k7 f7 K: [ line con 0
1 c: h2 @* N+ K1 Y line aux 0
& X/ y+ y8 T4 ]' E6 J; X line vty 0 4- D; Z& r$ x. b* ], E
login5 K0 O% ?# v# i, ~
!
% C5 a3 G' k$ j0 {) B/ ^ endDefault IP Routing Running-configRouterA#sh run9 e) u: f4 u/ n9 }
Building configuration...Current configuration:
# L9 Z+ f/ {8 M% _ !
+ k) I3 C' `6 H7 I% V e& u& J version 11.2
; _; v }' z) |% |9 N8 I) ^# a no service password-encryption
4 Z& z2 T* x8 l" x" B9 o; C no service udp-small-servers8 |/ B& C' ~' w& o6 P
no service tcp-small-servers </p> !
* W4 A8 k+ Y% r% N2 w3 e hostname RouterA
6 y+ e* A! m$ X5 X% v7 v6 D !
# I, n+ P7 ]# }" n !
! M# {& B1 b+ r+ M+ u7 P !3 W: Q& e) w8 `: Q# Z% Q
interface Ethernet0
2 V; A/ S8 F6 M! @8 c ip address 172.16.10.1 255.255.255.0: h5 X2 n( E" x7 v+ Q
!
# {/ j9 `' ]# s7 e; t interface Serial0
: a& ^' c- a' T2 ]6 @% E ip address 172.16.20.1 255.255.255.09 N/ o: m4 k# I' ^- z- N7 s
no fair-queue
6 p5 i: r: s# a, i5 O( ^ !
6 I& ?- w. z9 r0 |# G) \; `, y interface Serial1
( @9 s6 L+ T% ?" A no ip address
7 S3 }( T8 Y9 |' v S shutdown
5 X2 p' K7 J# f' C !!! E3 w- T; o: w9 f$ g2 o2 f
ip classless
; B- A7 w7 K9 u ip route 0.0.0.0 0.0.0.0 172.16.20.2
7 V0 ]( T/ Z! l, Z !
6 D3 @* _9 r) ?5 _$ P2 H !) W( c9 L# K) A7 e; h1 _* s
line con 09 v7 P0 Z8 A$ V/ H% ? f/ c
line aux 02 @& X: S; y5 f6 _; P9 u& R0 `) G
line vty 0 4
7 x7 u4 w1 I. c login
+ b1 p/ }' p6 k1 E !9 {+ ?5 b) S4 P$ C6 @# R9 D
endRouterB#sh run* z0 M5 ^, o# Q# Q) ?. v$ C* P5 Y
Building configuration...Current configuration:3 K) ~% ?# `" R9 }
!
) D& |; w$ Z j# J4 `8 Z version 11.2$ m# O7 Z [$ y3 @3 G7 l7 O
no service password-encryption1 f I* q! D' a& I9 F+ P0 B1 `
no service udp-small-servers
5 s/ s+ e& L3 R# i b no service tcp-small-servers/ B( n! X; o) M9 P& @# p. u' R
!8 J, |9 k. v( I, h# _" {
hostname RouterB
* H3 p' L) ^5 @/ F, a7 b: x7 o !
1 ~' i- b3 H: j5 S !7 k& @4 a# k4 X3 t; H$ O
!
9 Y) M8 [+ M- o/ \) R/ i interface Ethernet0
6 ~1 o' Q. Y- L) ? ip address 172.16.30.1 255.255.255.0
- s7 M6 ^0 _; o0 A2 l$ E !8 a' @8 l6 q& x* g7 p
interface Serial0( `# y" M2 C2 v- Z U# I/ z8 I B7 V8 V
ip address 172.16.20.2 255.255.255.0
5 D7 E: r0 O$ x clockrate 56000
, A H6 Y$ ~$ w! z !( u/ | A; T, U) Q/ u' z+ c
interface Serial1
. {+ ?4 }4 Q5 l% q+ b! o ip address 172.16.40.1 255.255.255.0
) Q- q: ?- S: f0 _) N+ T0 _ clockrate 56000! B& {( X. S% E2 [5 {/ Q; {8 @
!
# z: s- |; D% V" c; r no ip classless
% T( G1 A9 Z' L) q/ F ip route 172.16.10.0 255.255.255.0 172.16.20.1. T. ` c2 F1 N4 ^
ip route 172.16.50.0 255.255.255.0 172.16.40.2- Y6 Q9 G, F2 p+ ]
!
8 p+ c* V( Z. H& G1 E. I e !8 A3 i. I @% m! Y) Q9 a
line con 0. y, G7 { M& h G* b" N8 M5 c
line aux 0
4 v: h% L1 A/ w line vty 0 4
2 ?( V9 P: i5 N; f login7 U/ m0 S& d5 q- ?4 b% P
!
% p8 M7 E4 d! i9 E. r! \2 R endRouterC#sh run" r. W# s, d) a$ {* X' a' \
Building configuration...Current configuration:5 G$ L( X- C' I% I
!* I( ]. ^9 K) g( p2 o
version 11.2" ], h4 _1 O' B# h" `3 W+ E
no service password-encryption
& Z8 R/ X, t W9 b6 W! v no service udp-small-servers
) i2 Z! U% I0 K# c% s% |/ z4 i no service tcp-small-servers+ k; M5 B1 z! q7 c
!
# C: \6 f5 [" u hostname RouterC! Q" h7 |3 t8 M8 _/ I8 Y9 _, G
!2 S) R( T$ O* ]+ g
!* w5 y2 b0 y5 z3 f: {
!
) ^! z# H: R0 B0 ?! \3 @ interface Ethernet0
( N) H, X3 @5 U/ V* e) [* L4 Z ip address 172.16.50.1 255.255.255.0; o3 ?% [, Q/ g1 t+ J+ ~ [! c
!
% y$ Z$ q/ D+ f! n6 b, I interface Serial0
. a0 v# q% s' w7 H4 p" G2 e- n ip address 172.16.40.2 255.255.255.0
* @ }, [0 w2 w% k9 f" V no fair-queue
- m9 s6 V. i( u5 l !* O f; L; r+ W0 s" |
interface Serial1
) i( J, _, ?: g# m+ ? no ip address
/ C2 G k+ d) s- l shutdown U# U* k: Q8 ^" K: d& d1 q
!
) z D* m* O) ?( R( ~ !
! h$ U B- j" f. t5 _ ip classless4 t% M$ Q; } z* [1 k K1 l' f
ip route 0.0.0.0 0.0.0.0 172.16.40.1: _: q3 `8 a, ?# D7 ^
!
+ p$ {# s* Y9 m7 x0 L2 q2 J !/ Q- B' l' Q4 {( L, x3 n8 n
line c |