您的位置:首页 > 职场人生

局域网的vlan 配置

2009-06-03 21:08 127 查看


局域网的vlan 配置:
配置的步骤:
一 、三层交换机:1、激活路由 2、设置trunk 通道 3、设置vtp
二 、二层交换机:1、设置trunk 通道 2、设置vtp
三 、三层交换机:4、创建vlan ,并为vlan 设 Ip
四 、二层交换机:3、为接口分配vlan
五 、主机:pc0 、 ip 1.1.1.2 vlan2 网关:1.1.1.1
Pc1 、 ip 2.2.2.2 vlan3 网关:2.2.2.1
Pc2 、 ip 1.1.1.3 vlan2 网关:1.1.1.1
Pc3 、 ip 2.2.2.3 vlan3 网关:2.2.2.1
三层交换机的配置:
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#ip rout?
route routing
Switch(config)#ip routing
Switch(config)#interface fastEthernet ?
<0-9> FastEthernet interface number
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switch mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Switch(config-if)#
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#switch mode trunk

%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)#no shutdown
Switch(config-if)#exit
%SYS-5-CONFIG_I: Configured from console by console
Switch#vlan database
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#vtp domain 111
Changing VTP domain name from NULL to 111
Switch(vlan)#vtp server
Device mode already VTP SERVER.
Switch(vlan)#exit
APPLY completed.
Exiting....
Switch#vlan database
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#vlan 2
VLAN 2 added:
Name: VLAN0002
Switch(vlan)#vlan 3
VLAN 3 added:
Name: VLAN0003
Switch(vlan)#exit
APPLY completed.
Exiting....
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface vlan 2

%LINK-5-CHANGED: Interface Vlan2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to up
Switch(config-if)#
Switch(config-if)#ip address 1.1.1.1 255.0.0.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface vlan 3

%LINK-5-CHANGED: Interface Vlan3, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to up
Switch(config-if)#
Switch(config-if)#ip address 2.2.2.1 255.0.0.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#

二层交换机的配置:switch 0
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switch mode trunk
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switch mode trunk
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#end
%SYS-5-CONFIG_I: Configured from console by console
Switch#vlan datab
Switch#vlan database
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#vtp domain 111
Domain name already set to 111.
Switch(vlan)#vtp client
Setting device to VTP CLIENT mode.
Switch(vlan)#exit
APPLY completed.
Exiting....
Switch#show vlan ?
brief VTP all VLAN status in brief
id VTP VLAN status by VLAN id
name VTP VLAN status by VLAN name
<cr>
Switch#show vlan

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active 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
2 VLAN0002 active
3 VLAN0003 active
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#switch mode acc
Switch(config-if)#switch mode access
Switch(config-if)#switch access vlan 2
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/3
Switch(config-if)#switch mode access
Switch(config-if)#switch access vlan 3
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#end
%SYS-5-CONFIG_I: Configured from console by console
Switch#show vlan ?
brief VTP all VLAN status in brief
id VTP VLAN status by VLAN id
name VTP VLAN status by VLAN name
<cr>
Switch#show vlan brief

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
2 VLAN0002 active Fa0/2
3 VLAN0003 active Fa0/3
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active ……
Switch#

二层交换机的配置:Switch 1 :
Switch>enable
Switch#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switch mode trunk
Switch(config-if)#no shut
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#end
%SYS-5-CONFIG_I: Configured from console by console
Switch#vlan database
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#vtp domain 111
Domain name already set to 111.
Switch(vlan)#vtp client
Setting device to VTP CLIENT mode.
Switch(vlan)#exit
APPLY completed.
Exiting....
Switch#show vlan ?
brief VTP all VLAN status in brief
id VTP VLAN status by VLAN id
name VTP VLAN status by VLAN name
<cr>
Switch#show vlan

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active 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
2 VLAN0002 active
3 VLAN0003 active ……
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#switch mode access
Switch(config-if)#switch access vlan 2
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/3
Switch(config-if)#switch mode access
Switch(config-if)#switch access vlan 3
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#end
%SYS-5-CONFIG_I: Configured from console by console
Switch#show vlan b
Switch#show vlan brief

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
2 VLAN0002 active Fa0/2
3 VLAN0003 active Fa0/3
Switch#
Pc 机的 ping 命令:
pc 0 :
Packet Tracer PC Command Line 1.0

PC>ping 2.2.2.3

Pinging 2.2.2.3 with 32 bytes of data:

Reply from 2.2.2.3: bytes=32 time=125ms TTL=127
Reply from 2.2.2.3: bytes=32 time=80ms TTL=127
Reply from 2.2.2.3: bytes=32 time=125ms TTL=127
Reply from 2.2.2.3: bytes=32 time=125ms TTL=127

Ping statistics for 2.2.2.3:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 80ms, Maximum = 125ms, Average = 113ms

PC>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  职场 vlan 休闲