CCNA第三天实验

一.七天酒店网络配置

要求

酒店共计9层

第一层前台接待4台 —— 使用8口交换机

第二层4台—— 使用8口交换机

第三层到第九层交换机,有20台电脑 —— 使用24口交换机

拓扑图

这里写图片描述

思路
  • 本题应该将各层电脑分成三个网络,分别是一层,二层和客房

  • 将它们的网络划分为 192.168.1.0 , 192.168.2.0 , 192.168.3.0

  • 将各分交换机的汇聚在一个交换机上,进行端口的子网划分

  • 开启对接路由器端口的trunk模式

  • 将路由器划虚拟分子网,实现联通

IP配置
电脑IP掩码网关DNS
一层1号机192.168.1.1255.255.255.0192.168.1.254192.168.10.1
一层2号机192.168.1.2255.255.255.0192.168.1.254192.168.10.1
一层3号机192.168.1.3255.255.255.0192.168.1.254192.168.10.1
一层4号机192.168.1.4255.255.255.0192.168.1.254192.168.10.1
二层号1机192.168.2.1255.255.255.0192.168.2.254192.168.10.1
二层号2机192.168.2.2255.255.255.0192.168.2.254192.168.10.1
二层号3机192.168.2.3255.255.255.0192.168.2.254192.168.10.1
二层号4机192.168.2.4255.255.255.0192.168.2.254192.168.10.1
3层号1机192.168.3.1255.255.255.0192.168.3.254192.168.10.1
4层号1机192.168.3.21255.255.255.0192.168.3.254192.168.10.1
5层号1机192.168.3.41255.255.255.0192.168.3.254192.168.10.1
6层号1机192.168.3.61255.255.255.0192.168.3.254192.168.10.1
7层号1机192.168.3.81255.255.255.0192.168.3.254192.168.10.1
8层号1机192.168.3.101255.255.255.0192.168.3.254192.168.10.1
9层号1192.168.3.121255.255.255.0192.168.3.254192.168.10.1
DNS服务192.168.10.1255.255.255.0192.168.10.254192.168.10.1
WEB服务192.168.10.2255.255.255.0192.168.10.254192.168.10.1

这里写图片描述

交换机配置

汇总后的酒店交换机


Switch>en

Switch#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#vlan 2

Switch(config-vlan)#name vlan2

Switch(config-vlan)#vlan 3

Switch(config-vlan)#name vlan3

Switch(config-vlan)#vlan 4

Switch(config-vlan)#name vlan4

Switch(config-vlan)#ex

Switch(config)#int f0/1

Switch(config-if)#switchport mode access 

Switch(config-if)#switchport access vlan 2

Switch(config-if)#int f0/9

Switch(config-if)#switchport access vlan 3

Switch(config-if)#ex

Switch(config)#int range f0/2-8

Switch(config-if-range)#switchport access vlan 4

Switch(config-if-range)#^Z

Switch#

%SYS-5-CONFIG_I: Configured from console by console



Switch#show vlan



VLAN Name                             Status    Ports

---- -------------------------------- --------- -------------------------------

1    default                          active    Fa0/10, Fa0/11, Fa0/12, Fa0/13

                                                Fa0/14, Fa0/15, Fa0/16, Fa0/17

                                                Fa0/18, Fa0/19, Fa0/20, Fa0/21

                                                Fa0/22, Fa0/23, Fa0/24

2    vlan2                            active    Fa0/1

3    vlan3                            active    Fa0/9

4    vlan4                            active    Fa0/2, Fa0/3, Fa0/4, Fa0/5

                                                Fa0/6, Fa0/7, Fa0/8

1002 fddi-default                     act/unsup 

1003 token-ring-default               act/unsup 

1004 fddinet-default                  act/unsup 

1005 trnet-default                    act/unsup 



VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2

---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------

1    enet  100001     1500  -      -      -        -    -        0      0

2    enet  100002     1500  -      -      -        -    -        0      0

3    enet  100003     1500  -      -      -        -    -        0      0

4    enet  100004     1500  -      -      -        -    -        0      0

1002 fddi  101002     1500  -      -      -        -    -        0      0   

1003 tr    101003     1500  -      -      -        -    -        0      0   

1004 fdnet 101004     1500  -      -      -        ieee -        0      0   

1005 trnet 101005     1500  -      -      -        ibm  -        0      0   



Remote SPAN VLANs

------------------------------------------------------------------------------





Primary Secondary Type              Ports

------- --------- ----------------- ------------------------------------------

Switch#en

Switch#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#int f0/10 

Switch(config-if)#switchport mode trunk 

Switch(config-if)#^Z

Switch#

%SYS-5-CONFIG_I: Configured from console by console



Switch#wr

Building configuration...

[OK]

Switch#

服务器端的交换机


Switch>en

Switch#conf t

Enter configuration commands, one per line.  End with CNTL/Z.   

Switch(config)#vlan 2

Switch(config-vlan)#name vlan2

Switch(config-vlan)#ex

Switch(config-vlan)#exit 

Switch(config)#int range f0/1-2

Switch(config-if-range)#switchport mode access 

Switch(config-if-range)#switchport access vlan 2

Switch(config-if-range)#exit 

Switch(config)#int f0/3

Switch(config-if)#switchport mode trunk 

Switch(config-if)#ex

Switch(config)#^Z

Switch#

%SYS-5-CONFIG_I: Configured from console by console



Switch#show vlan



VLAN Name                             Status    Ports

---- -------------------------------- --------- -------------------------------

1    default                          active    Fa0/3, Fa0/4, Fa0/5, Fa0/6

                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10

                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14

                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18

                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22

                                                Fa0/23, Fa0/24

2    vlan2                            active    Fa0/1, Fa0/2

1002 fddi-default                     act/unsup 

1003 token-ring-default               act/unsup 

1004 fddinet-default                  act/unsup 

1005 trnet-default                    act/unsup 



VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2

---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------

1    enet  100001     1500  -      -      -        -    -        0      0

2    enet  100002     1500  -      -      -        -    -        0      0

1002 fddi  101002     1500  -      -      -        -    -        0      0   

1003 tr    101003     1500  -      -      -        -    -        0      0   

1004 fdnet 101004     1500  -      -      -        ieee -        0      0   

1005 trnet 101005     1500  -      -      -        ibm  -        0      0   



Remote SPAN VLANs

------------------------------------------------------------------------------





Primary Secondary Type              Ports

------- --------- ----------------- ------------------------------------------

Switch#wr

Building configuration...

[OK]

Switch#

路由器


Router>en

Router#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#int f0/1

Router(config-if)#no shutdown 



Router(config-if)#

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up



%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up



Router(config-if)#int f0/1.1

Router(config-subif)#

%LINK-5-CHANGED: Interface FastEthernet0/1.1, changed state to up



%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.1, changed state to up



Router(config-subif)#encapsulation dot1Q 2

Router(config-subif)#ip address 192.168.10.254 255.255.255.0

Router(config-subif)#ex

Router(config)#int f0/0

Router(config-if)#no shutdown 



Router(config-if)#

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up



%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up



Router(config-if)#int f0/0.1

Router(config-subif)#

%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up



%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up



Router(config-subif)#encapsulation dot1Q 2

Router(config-subif)#ip address 192.168.1.254 255.255.255.0

Router(config-subif)#int f0/0.2

Router(config-subif)#

%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up



%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up



Router(config-subif)#encapsulation dot1Q 3

Router(config-subif)#ip address 192.168.2.254 255.255.255.0

Router(config-subif)#int f0/0.3

Router(config-subif)#

%LINK-5-CHANGED: Interface FastEthernet0/0.3, changed state to up



%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.3, changed state to up



Router(config-subif)#encapsulation dot1Q 4

Router(config-subif)#ip address 192.168.3.254 255.255.255.0

Router(config-subif)#ex

Router(config)#^Z

Router#

%SYS-5-CONFIG_I: Configured from console by console



Router#wr

Building configuration...

[OK]

Router#

二.某互联网创业公司 公司网络规划及实施

业务规划

公司6个部门 技术部 财务部 人事部 产品部 设计部 销售部 

公司大厦为五层 其中二三四层分别有两个部门

每个部门之间不能互相通信 每个部门都能访问服务器区

网络规划

VLAN 共8个VLAN   6个部门各一个、DMZ区一个、一层接待一个

VLAN10 192.168.10.0/24 网关254

VLAN21 192.168.21.0/24 网关254

VLAN22 192.168.22.0/24 网关254

VLAN31 192.168.31.0/24 网关254

VLAN32 192.168.32.0/24 网关254

VLAN41 192.168.41.0/24 网关254

VLAN42 192.168.42.0/24 网关254

VLAN100 192.168.100.0/24 网关254



核心交换机和服务器放在五层机房内



核心交换机作为每个VLAN的网关并启用路由功能、vtp

实施

在核心交换机配置VLAN vtp 网关 链路聚合

在接入交换机划分VLAN

服务器搭建
拓扑结构

这里写图片描述

思路

1.设置VTP


en

conf t

vtp mode client

vtp domain aaa

vtp password PASSWORD

ex

en

conf t

vtp mode server

vtp domain aaa

vtp password PASSWORD

ex

2.在服务器中配置vlan


en

conf t

vlan 41

name jishu

3.打开trunk


show interfaces trunk 

4.划分端口及对应子网

将端口划分到子网内

en
conf t
int f0/1
swi mo ac
swi ac vlan 21
int f0/2
swi ac vlan 22 
do show vlan

5.IP routing将交换机调至路由功能
6.进入vlan,配置网关


interface vlan 10

IP address

7.负载均衡


Switch(config-if-range)#channel-group 1 mode on

Switch(config-if-range)#ex

Switch(config)#port-channel load-balance dst-ip 

所以,拓扑结构为:

这里写图片描述

IP配置
电脑IP掩码网关DNS
vlan10192.168.10.1255.255.255.0192.168.10.254192.168.100.1
vlan21192.168.21.1255.255.255.0192.168.21.254192.168.100.1
vlan22192.168.22.1255.255.255.0192.168.22.254192.168.100.1
vlan31192.168.31.1255.255.255.0192.168.31.254192.168.100.1
vlan32192.168.32.1255.255.255.0192.168.32.254192.168.100.1
vlan41192.168.41.1255.255.255.0192.168.41.254192.168.100.1
vlan42192.168.42.1255.255.255.0192.168.42.254192.168.100.1
vlan100192.168.100.1255.255.255.0192.168.100.254192.168.100.1
vlan100192.168.100.2255.255.255.0192.168.100.254192.168.100.1
交换机配置
vlan100
///*设置VTP*/
Switch(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch(config)#vtp domain aaa
Changing VTP domain name from NULL to aaa
Switch(config)#vtp password PASSWORD
Setting device VLAN database password to PASSWORD
Switch(config)#ex
Switch#
%SYS-5-CONFIG_I: Configured from console by console

/*打开trunk*/
Switch(config)#int range f0/4-5
Switch(config-if-range)#switchport mode trunk 
Switch(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up

Switch(config-if-range)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#show int t
Switch#show int trunk 
Port        Mode         Encapsulation  Status        Native vlan
Fa0/4       on           802.1q         trunking      1
Fa0/5       on           802.1q         trunking      1

Port        Vlans allowed on trunk
Fa0/4       1-1005
Fa0/5       1-1005

Port        Vlans allowed and active in management domain
Fa0/4       1,10,21,22,31,32,41,42,100
Fa0/5       1,10,21,22,31,32,41,42,100

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/4       none
Fa0/5       none

/*划分端口及对应子网*/
Switch(config)#int range f0/1-3
Switch(config-if-range)#switchport mode access 
Switch(config-if-range)#switchport access vlan 100
Switch(config-if-range)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19, Fa0/20, Fa0/21
                                                Fa0/22, Fa0/23, Fa0/24
10   vlan10                           active    
21   vlan21                           active    
22   vlan22                           active    
31   vlan31                           active    
32   vlan32                           active    
41   vlan41                           active    
42   vlan42                           active    
100  vlan100                          active    Fa0/1, Fa0/2, Fa0/3
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
21   enet  100021     1500  -      -      -        -    -        0      0
22   enet  100022     1500  -      -      -        -    -        0      0
31   enet  100031     1500  -      -      -        -    -        0      0
32   enet  100032     1500  -      -      -        -    -        0      0
41   enet  100041     1500  -      -      -        -    -        0      0
42   enet  100042     1500  -      -      -        -    -        0      0
100  enet  100100     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------

Switch#wr
Building configuration...
[OK]
Switch#
vlan 41,42
///*设置VTP*/
Switch(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch(config)#vtp domain aaa
Changing VTP domain name from NULL to aaa
Switch(config)#vtp password PASSWORD
Setting device VLAN database password to PASSWORD
Switch(config)#ex
Switch#
%SYS-5-CONFIG_I: Configured from console by console

/*打开trunk*/
Switch(config)#int range f0/3-4
Switch(config-if-range)#switchport mode trunk 
Switch(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up

Switch(config-if-range)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#show interfaces trunk 
Port        Mode         Encapsulation  Status        Native vlan
Fa0/3       on           802.1q         trunking      1
Fa0/4       on           802.1q         trunking      1

Port        Vlans allowed on trunk
Fa0/3       1-1005
Fa0/4       1-1005

Port        Vlans allowed and active in management domain
Fa0/3       1,10,21,22,31,32,41,42,100
Fa0/4       1,10,21,22,31,32,41,42,100

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/3       none
Fa0/4       none

/*划分端口及对应子网*/
Switch(config)#int f0/1
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 41
Switch(config-if)#int f0/2
Switch(config-if)#switchport access vlan 42
Switch(config-if)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19, Fa0/20, Fa0/21
                                                Fa0/22, Fa0/23, Fa0/24
10   vlan10                           active    
21   vlan21                           active    
22   vlan22                           active    
31   vlan31                           active    
32   vlan32                           active    
41   vlan41                           active    Fa0/1
42   vlan42                           active    Fa0/2
100  vlan100                          active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
21   enet  100021     1500  -      -      -        -    -        0      0
22   enet  100022     1500  -      -      -        -    -        0      0
31   enet  100031     1500  -      -      -        -    -        0      0
32   enet  100032     1500  -      -      -        -    -        0      0
41   enet  100041     1500  -      -      -        -    -        0      0
42   enet  100042     1500  -      -      -        -    -        0      0
100  enet  100100     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------
Switch#wr
Building configuration...
[OK]
Switch#
Switch#
vlan 31,32
///*设置VTP*/
Switch(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch(config)#vtp domain aaa
Changing VTP domain name from NULL to aaa
Switch(config)#vtp password PASSWORD
Setting device VLAN database password to PASSWORD
Switch(config)#ex
Switch#
%SYS-5-CONFIG_I: Configured from console by console

/*打开trunk*/
Switch(config)#int f0/3
Switch(config-if)#switchport mode trunk 

Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

Switch(config-if)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#sh
Switch#show in
Switch#show interfaces t
Switch#show interfaces trunk 
Port        Mode         Encapsulation  Status        Native vlan
Fa0/3       on           802.1q         trunking      1

Port        Vlans allowed on trunk
Fa0/3       1-1005

Port        Vlans allowed and active in management domain
Fa0/3       1,10,21,22,31,32,41,42,100

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/3       none

/*划分端口及对应子网*/
Switch(config)#int f0/1
Switch(config-if)#swi mo ac
Switch(config-if)#swi ac vlan 31
Switch(config-if)#int f0/2
Switch(config-if)#swi ac vlan 32 
Switch(config-if)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/4, Fa0/5, Fa0/6, Fa0/7
                                                Fa0/8, Fa0/9, Fa0/10, Fa0/11
                                                Fa0/12, Fa0/13, Fa0/14, Fa0/15
                                                Fa0/16, Fa0/17, Fa0/18, Fa0/19
                                                Fa0/20, Fa0/21, Fa0/22, Fa0/23
                                                Fa0/24
10   vlan10                           active    
21   vlan21                           active    
22   vlan22                           active    
31   vlan31                           active    Fa0/1
32   vlan32                           active    Fa0/2
41   vlan41                           active    
42   vlan42                           active    
100  vlan100                          active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
21   enet  100021     1500  -      -      -        -    -        0      0
22   enet  100022     1500  -      -      -        -    -        0      0
31   enet  100031     1500  -      -      -        -    -        0      0
32   enet  100032     1500  -      -      -        -    -        0      0
41   enet  100041     1500  -      -      -        -    -        0      0
42   enet  100042     1500  -      -      -        -    -        0      0
100  enet  100100     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------

Switch(config-if)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#wr
Building configuration...
[OK]
Switch#
vlan 21,22
///*设置VTP*/
Switch(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch(config)#vtp domain aaa
Changing VTP domain name from NULL to aaa
Switch(config)#vtp password PASSWORD
Setting device VLAN database password to PASSWORD
Switch(config)#ex
Switch#
%SYS-5-CONFIG_I: Configured from console by console

/*打开trunk*/
Switch(config)#int range f0/3-4
Switch(config-if-range)#switchport mode trunk 


Switch(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up

Switch(config-if-range)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console


Switch#show interfaces trunk 
Port        Mode         Encapsulation  Status        Native vlan
Fa0/3       on           802.1q         trunking      1
Fa0/4       on           802.1q         trunking      1

Port        Vlans allowed on trunk
Fa0/3       1-1005
Fa0/4       1-1005

Port        Vlans allowed and active in management domain
Fa0/3       1,10,21,22,31,32,41,42,100
Fa0/4       1,10,21,22,31,32,41,42,100

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/3       none
Fa0/4       none

/*划分端口及对应子网*/
Switch(config)#int f0/1
Switch(config-if)#swi mo ac
Switch(config-if)#swi ac vlan 21
Switch(config-if)#int f0/2
Switch(config-if)#swi ac vlan 22 
Switch(config-if)#do show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Fa0/19, Fa0/20, Fa0/21
                                                Fa0/22, Fa0/23, Fa0/24
10   vlan10                           active    
21   vlan21                           active    Fa0/1
22   vlan22                           active    Fa0/2
31   vlan31                           active    
32   vlan32                           active    
41   vlan41                           active    
42   vlan42                           active    
100  vlan100                          active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
21   enet  100021     1500  -      -      -        -    -        0      0
22   enet  100022     1500  -      -      -        -    -        0      0
31   enet  100031     1500  -      -      -        -    -        0      0
32   enet  100032     1500  -      -      -        -    -        0      0
41   enet  100041     1500  -      -      -        -    -        0      0
42   enet  100042     1500  -      -      -        -    -        0      0
100  enet  100100     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------
Switch(config-if)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#wr
Building configuration...
[OK]
Switch#

vlan 10
///*设置VTP*/
Switch(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch(config)#vtp domain aaa
Changing VTP domain name from NULL to aaa
Switch(config)#vtp password PASSWORD
Setting device VLAN database password to PASSWORD
Switch(config)#
Switch(config)#ex
Switch#
%SYS-5-CONFIG_I: Configured from console by console

/*打开trunk*/
Switch(config)#int f0/2
Switch(config-if)#switchport mode trunk 

Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

Switch(config-if)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#show interfaces trunk 
Port        Mode         Encapsulation  Status        Native vlan
Fa0/2       on           802.1q         trunking      1

Port        Vlans allowed on trunk
Fa0/2       1-1005

Port        Vlans allowed and active in management domain
Fa0/2       1,10,21,22,31,32,41,42,100

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/2       none

/*划分端口及对应子网*/
Switch(config)#int f0/1
Switch(config-if)#switchport access vlan 10
Switch(config-if)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/3, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24
10   vlan10                           active    Fa0/1
21   vlan21                           active    
22   vlan22                           active    
31   vlan31                           active    
32   vlan32                           active    
41   vlan41                           active    
42   vlan42                           active    
100  vlan100                          active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
21   enet  100021     1500  -      -      -        -    -        0      0
22   enet  100022     1500  -      -      -        -    -        0      0
31   enet  100031     1500  -      -      -        -    -        0      0
32   enet  100032     1500  -      -      -        -    -        0      0
41   enet  100041     1500  -      -      -        -    -        0      0
42   enet  100042     1500  -      -      -        -    -        0      0
100  enet  100100     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------
Switch#
Switch#
Switch#wr
Building configuration...
[OK]
Switch#
三层交换机
///*设置VTP*/
Switch(config)#vtp mode server
Device mode already VTP SERVER.
Switch(config)#vtp domain aaa
Changing VTP domain name from NULL to aaa
Switch(config)#vtp password PASSWORD
Setting device VLAN database password to PASSWORD
Switch(config)#ex
Switch#
%SYS-5-CONFIG_I: Configured from console by console

/*在服务器中配置vlan*/
Switch(config)#vlan 41
Switch(config-vlan)#name vlan41
Switch(config-vlan)#vlan 42
Switch(config-vlan)#name vlan42
Switch(config-vlan)#vlan 31
Switch(config-vlan)#name vlan31
Switch(config-vlan)#vlan 32
Switch(config-vlan)#name vlan32
Switch(config-vlan)#vlan 21
Switch(config-vlan)#name vlan21
Switch(config-vlan)#vlan 22
Switch(config-vlan)#name vlan22
Switch(config-vlan)#vlan 10
Switch(config-vlan)#name vlan10
Switch(config)#vlan 100
Switch(config-vlan)#name vlan100
Switch(config-vlan)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#
Switch#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/10, Fa0/11, Fa0/12
                                                Fa0/13, Fa0/14, Fa0/15, Fa0/16
                                                Fa0/17, Fa0/18, Fa0/19, Fa0/20
                                                Fa0/21, Fa0/22, Fa0/23, Fa0/24
                                                Gig0/1, Gig0/2
10   vlan10                           active    
21   vlan21                           active    
22   vlan22                           active    
31   vlan31                           active    
32   vlan32                           active    
41   vlan41                           active    
42   vlan42                           active    
100  vlan100                          active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
21   enet  100021     1500  -      -      -        -    -        0      0
22   enet  100022     1500  -      -      -        -    -        0      0
31   enet  100031     1500  -      -      -        -    -        0      0
32   enet  100032     1500  -      -      -        -    -        0      0
41   enet  100041     1500  -      -      -        -    -        0      0
42   enet  100042     1500  -      -      -        -    -        0      0
100  enet  100100     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------

/*打开trunk*/
Switch(config)#int range f0/4-5
Switch(config-if-range)#switchport mode access 
Switch(config-if-range)#switchport mode trunk 


Switch(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up

Switch(config-if-range)#
Switch(config-if-range)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#show interfaces trunk 
Port        Mode         Encapsulation  Status        Native vlan
Fa0/1       auto         n-802.1q       trunking      1
Fa0/2       auto         n-802.1q       trunking      1
Fa0/3       auto         n-802.1q       trunking      1
Fa0/4       on           802.1q         trunking      1
Fa0/5       on           802.1q         trunking      1

Port        Vlans allowed on trunk
Fa0/1       1-1005
Fa0/2       1-1005
Fa0/3       1-1005
Fa0/4       1-1005
Fa0/5       1-1005

Port        Vlans allowed and active in management domain
Fa0/1       1,10,21,22,31,32,41,42,100
Fa0/2       1,10,21,22,31,32,41,42,100
Fa0/3       1,10,21,22,31,32,41,42,100
Fa0/4       1,10,21,22,31,32,41,42,100
Fa0/5       1,10,21,22,31,32,41,42,100

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/1       1,10,21,22,31,32,41,42,100
Fa0/2       1,10,21,22,31,32,41,42,100
Fa0/3       1,10,21,22,31,32,41,42,100
Fa0/4       none
Fa0/5       none


/*IP routing将交换机调至路由功能*/
Switch(config)#ip routing 


/*进入vlan,配置网关*/
Switch(config)#interface vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up

Switch(config-if)#ip add
Switch(config-if)#ip address 192.168.10.254 255.255.255.0
Switch(config-if)#interface vlan 21
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan21, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan21, changed state to up

Switch(config-if)#ip address 192.168.21.254 255.255.255.0
Switch(config-if)#interface vlan 22
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan22, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan22, changed state to up

Switch(config-if)#ip address 192.168.22.254 255.255.255.0
Switch(config-if)#interface vlan 31
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan31, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan31, changed state to up

Switch(config-if)#ip address 192.168.31.254 255.255.255.0
Switch(config-if)#interface vlan 32
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan32, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan32, changed state to up

Switch(config-if)#ip address 192.168.32.254 255.255.255.0
Switch(config-if)#interface vlan 41
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan41, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan41, changed state to up

Switch(config-if)#ip address 192.168.41.254 255.255.255.0
Switch(config-if)#interface vlan 42
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan42, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan42, changed state to up

Switch(config-if)#ip address 192.168.42.254 255.255.255.0
Switch(config-if)#interface vlan 100
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan100, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan100, changed state to up

Switch(config-if)#ip address 192.168.100.254 255.255.255.0
Switch(config-if)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console


/*负载均衡*/
Switch(config)#int range f0/4-5 
Switch(config-if-range)#channel-group 1 mode on
Switch(config-if-range)#
Creating a port-channel interface Port-channel 1

%LINK-5-CHANGED: Interface Port-channel 1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up

Switch(config-if-range)#ex
Switch(config)#port-channel load-balance dst-ip 
Switch(config)#^Z
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#wr
Building configuration...
[OK]
Switch#
三层交换机冗余
///*设置VTP*/
Switch(config)#vtp mode server
Device mode already VTP SERVER.
Switch(config)#vtp domain aaa
Changing VTP domain name from NULL to aaa
Switch(config)#vtp password PASSWORD
Setting device VLAN database password to PASSWORD
Switch(config)#ex
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#

当打开trunk的时候,交换机自动学习,将VTP.server中vlan学习到VTP.client
这里写图片描述
学习的时候,只学习vlan,不学习端口号

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值