有图精版VLAN与单臂路由配置.docx
《有图精版VLAN与单臂路由配置.docx》由会员分享,可在线阅读,更多相关《有图精版VLAN与单臂路由配置.docx(17页珍藏版)》请在冰豆网上搜索。
![有图精版VLAN与单臂路由配置.docx](https://file1.bdocx.com/fileroot1/2022-11/23/9e0a48a8-136c-4c38-804c-63dde3401ffc/9e0a48a8-136c-4c38-804c-63dde3401ffc1.gif)
有图精版VLAN与单臂路由配置
VLAN与单臂路由配置实例分析
实现小型企业局域网二层广播域VLAN隔离和三层全网全连通;掌握Vlan、Trunk、单臂路由的配置方法;分析小型企业局域网广播域大小及二层网络通信过程;分析PC1pingPC4的三层通信过程和二层通信过程;分析PC4pingSW4网管地址的三层通信过程和二层通信过程。
拓扑图如下:
VLAN与单臂路由设置步骤
1、基本信息的配置
SW3的基本信息配置
1Switch>
2
3Switch>enable
4
5Switch#configureterminal
6
7Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
8
9Switch(config)#hostnameSW3
10
11SW3(config)#noipdomain-lookup
12
13SW3(config)#lineconsole0
14
15SW3(config-line)#loggingsynchronous
16
17SW3(config-line)#nologin
18
19SW3(config-line)#privilegelevel15
20
21SW3(config-line)#linevty04
22
23SW3(config-line)#nologin
24
25SW3(config-line)#privilegelevel15
26
27SW3(config-line)#exi
28
29SW3(config)#end
SW4的基本信息配置
30Switch>//普通模式
31
32Switch>enable//进入特权模式
33
34Switch#configureterminal//进入全局配置模式
35
36Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
37
38Switch(config)#hostnameSW4//配置主机命名
39
40SW4(config)#noipdomain-lookup//禁域名查找
41
42SW4(config)#lineconsole0//进入Console口线路模式
43
44SW4(config-line)#loggingsynchronous//Console信息显示自动换行
45
46SW4(config-line)#nologin//配置Console口登录不认证
47
48SW4(config-line)#privilegelevel15//配置Telnet登录为最高特权级别enable不需要密码
49
50SW4(config-line)#exi
51
52SW4(config)#linevty04
53
54SW4(config-line)#nologin
55
56SW4(config-line)#privilegelevel15
57
58SW4(config-line)#exi
59
60SW4(config)#end
RT5的基本信息配置
61Router>
62
63Router>enable
64
65Router#configureterminal
66
67Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
68
69Router(config)#hostnameRT5
70
71RT5(config)#noipdomain-lookup
72
73RT5(config)#lineconsole0
74
75RT5(config-line)#loggingsynchronous
76
77RT5(config-line)#nologin
78
79RT5(config-line)#privilegelevel15
80
81RT5(config-line)#exi
82
83RT5(config)#linevty04
84
85RT5(config-line)#nologin
86
87RT5(config-line)#privilegelevel15
88
89RT5(config-line)#exi
90
91RT5(config)#end
2、二层网络全局配置
SW3的Vlan配置
1SW3#vlandatabase//进入Vlan配置模式
2
3SW3(vlan)#vlan8//创建Vlan8、10、11
4
5VLAN8added:
6
7Name:
VLAN0008
8
9SW3(vlan)#vlan10
10
11VLAN10added:
12
13Name:
VLAN0010
14
15SW3(vlan)#vlan11
16
17VLAN11added:
18
19Name:
VLAN0011
20
21SW3(vlan)#exi
22
23SW3#showvlan-switch//查看Vlan配置信息
24
25VLANNameStatusPorts
26
27----------------------------------------------------------------------------
28
291defaultactiveFa0/0,Fa0/1,Fa0/2,Fa0/3
30
31Fa0/4,Fa0/5,Fa0/6,Fa0/7
32
33Fa0/8,Fa0/9,Fa0/10,Fa0/11
34
35Fa0/12,Fa0/13,Fa0/14,Fa0/15
36
378VLAN0008active
38
3910VLAN0010active
40
4111VLAN0011active
SW4的Vlan配置
42SW4#vlandatabase//进入Vlan配置模式
43
44SW4(vlan)#vlan8//创建Vlan8、10、11
45
46VLAN8added:
47
48Name:
VLAN0008
49
50SW4(vlan)#vlan10
51
52VLAN10added:
53
54Name:
VLAN0010
55
56SW4(vlan)#vlan11
57
58VLAN11added:
59
60Name:
VLAN0011
61
62SW4(vlan)#exi
63
64SW4#showvlan-switch//查看Vlan配置信息
65
66VLANNameStatusPorts
67
68----------------------------------------------------------------------------
69
701defaultactiveFa0/0,Fa0/1,Fa0/2,Fa0/3
71
72Fa0/4,Fa0/5,Fa0/6,Fa0/7
73
74Fa0/8,Fa0/9,Fa0/10,Fa0/11
75
76Fa0/12,Fa0/13,Fa0/14,Fa0/15
77
788VLAN0008active
79
8010VLAN0010active
81
8211VLAN0011active
3、二层链路调试
SW3的Access接口配置
1SW3#configureterminal
2
3Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
4
5SW3(config)#interfa0/10//进入接口fa0/10配置
6
7SW3(config-if)#switchportmodeaccess//配置接口为Access模式
8
9SW3(config-if)#switchportaccessvlan10//把接口划到Vlan10
10
11SW3(config-if)#exi
12
13SW3(config)#interfa0/11//进入接口f0/11配置
14
15SW3(config-if)#switchportmodeaccess//配置接口为Access模式
16
17SW3(config-if)#switchportaccessvlan11//把接口划到Vlan11
18
19SW3(config-if)#exi
SW4的Access接口配置
20SW4#
21
22SW4#configureterminal
23
24Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
25
26SW4(config)#interfa0/10
27
28SW4(config-if)#switchportmodeaccess
29
30SW4(config-if)#switchportaccessvlan10
31
32SW4(config-if)#exi
33
34SW4(config)#interfa0/11
35
36SW4(config-if)#switchportmodeaccess
37
38SW4(config-if)#switchportaccessvlan11
39
40SW4(config-if)#exi
SW3——SW4的Trunk链路调测
41SW3(config)#interfa0/3
42
43SW3(config-if)#switchporttrunkencapsulationdot1q//选择封装协议
44
45SW3(config-if)#switchportmodetrunk//配置接口模式为Trunk
46
47SW3(config-if)#switchporttrunkallowedvlanall//Trunk允许所有Vlan的信息通过
48
49SW3(config-if)#exi
50
51SW4(config)#interfa0/3
52
53SW4(config-if)#switchporttrunkencapsulationdot1q
54
55SW4(config-if)#switchportmodetrunk
56
57SW4(config-if)#switchporttrunkallowedvlanall
58
59SW4(config-if)#exi
4、二层设备网管地址配置
SW3的网管接口配置
1SW3#configureterminal
2
3Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
4
5SW3(config)#intervlan8//为SW3配置网管地址
6
7SW3(config-if)#ipaddress192.168.8.130255.255.255.128
8
9SW3(config-if)#noshutdown
10
11SW3(config-if)#exit
12
13SW3(config)#ipdefault-gateway192.168.8.129//为SW3配置网关
14
15SW3(config)#end
16
17SW3#showrun
SW4的网管接口配置
18SW4(config)#intervlan8//为SW4配置网管地址
19
20SW4(config-if)#ipaddress192.168.8.131255.255.255.128
21
22SW4(config-if)#noshutdown
23
24SW4(config-if)#exi
25
26SW4(config)#ipdefault-gateway192.168.8.129//为SW4配置网关
27
28SW4(config)#exi
29
30SW4#showipinterfacebrief//查看SW4上接口配置信息
31
32InterfaceIP-AddressOK?
MethodStatusProtocol
33
34FastEthernet0/0unassignedYESunsetupdown
35
36FastEthernet0/1unassignedYESunsetupdown
37
38FastEthernet0/2unassignedYESunsetupdown
39
40FastEthernet0/3unassignedYESunsetupup
41
42FastEthernet0/4unassignedYESunsetupdown
43
44FastEthernet0/5unassignedYESunsetupdown
45
46FastEthernet0/6unassignedYESunsetupdown
47
48FastEthernet0/7unassignedYESunsetupdown
49
50FastEthernet0/8unassignedYESunsetupdown
51
52FastEthernet0/9unassignedYESunsetupdown
53
54FastEthernet0/10unassignedYESunsetupup
55
56SW4#showinterfacesstatus//查看SW4上接口的状态
57
58PortNameStatusVlanDuplexSpeedType
59
60Fa0/0notconnect1autoauto10/100BaseTX
61
62Fa0/1notconnect1autoauto10/100BaseTX
63
64Fa0/2notconnect1autoauto10/100BaseTX
65
66Fa0/3connectedtrunka-fulla-10010/100BaseTX
67
68Fa0/4notconnect1autoauto10/100BaseTX
69
70Fa0/5notconnect1autoauto10/100BaseTX
71
72Fa0/6notconnect1autoauto10/100BaseTX
73
74Fa0/7notconnect1autoauto10/100BaseTX
75
76Fa0/8notconnect1autoauto10/100BaseTX
77
78Fa0/9notconnect1autoauto10/100BaseTX
79
80Fa0/10connected10a-fulla-10010/100BaseTX
81
82Fa0/11connected11a-fulla-10010/100BaseTX
83
84Fa0/12notconnect1autoauto10/100BaseTX
85
86Fa0/13notconnect1autoauto10/100BaseTX
87
88Fa0/14notconnect1autoauto10/100BaseTX
89
90Fa0/15notconnect1autoauto10/100BaseTX
5、三层接口配置及链路测试
SW3的上连接口配置
1SW3(config)#interfa0/1
2
3SW3(config-if)#switchporttrunkencapsulationdot1q
4
5SW3(config-if)#switchportmodetrunk
6
7SW3(config-if)#switchporttrunkallowedvlanall
8
9SW3(config-if)#switchporttrunknativevlan8//将该Trunk接口的nativeVlan改为Vlan8
10
11SW3(config-if)#exi
12
13SW3(config)#end
14
15SW3#showipinterfacebrief//查看SW3上接口的配置信息
16
17InterfaceIP-AddressOK?
MethodStatusProtocol
18
19FastEthernet0/0unassignedYESunsetupdown
20
21FastEthernet0/1unassignedYESunsetupup
22
23FastEthernet0/2unassignedYESunsetupdown
24
25FastEthernet0/3unassignedYESunsetupup
26
27FastEthernet0/4unassignedYESunsetupdown
28
29FastEthernet0/5unassignedYESunsetupdown
30
31FastEthernet0/6unassignedYESunsetupdown
32
33FastEthernet0/7unassignedYESunsetupdown
34
35FastEthernet0/8unassignedYESunsetupdown
36
37FastEthernet0/9unassignedYESunsetupdown
38
39FastEthernet0/10unassignedYESunsetupup
40
41FastEthernet0/11unassignedYESunsetupup
42
43SW3#showinterfacesstatus//查看SW3上接口的状态
44
45PortNameStatusVlanDuplexSpeedType
46
47Fa0/0notconnect1autoauto10/100BaseTX
48
49Fa0/1connectedtrunka-fulla-10010/100BaseTX
50
51Fa0/2notconnect1autoauto10/100BaseTX
52
53Fa0/3connectedtrunka-fulla-10010/100BaseTX
54
55Fa0/4notconnect1autoauto10/100BaseTX
56
57Fa0/5notconnect1autoauto10/100BaseTX
58
59Fa0/6notconnect1autoauto10/100BaseTX
60
61Fa0/7notconnect1autoauto10/100BaseTX
62
63Fa0/8notconnect1autoauto10/100BaseTX
64
65Fa0/9notconnect1autoauto10/100BaseTX
66
67Fa0/10connected10a-fulla-10010/100BaseTX
68
69Fa0/11connected11a-fulla-10010/100BaseTX
70
71Fa0/12notconnect1autoauto10/100BaseTX
72
73Fa0/13notconnect1autoauto10/100BaseTX
74
75Fa0/14notconnect1autoauto10/100BaseTX
76
77Fa0/15notconnect1autoauto10/100BaseTX
单臂路由配置
78RT5#configureterminal
79
80Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
81
82RT5(config)#intere0/0//主接口对应nativevlan
83
84RT5(config-if)#ipaddress192.168.8.129255.255.255.128
85
86RT5(config-if)#noshutdown//打开主接口
87
88RT5(config-if)#exi
89
90RT5(config)#intere0/0.10//创建子接口
91
92RT5(config-subif)#encapsulationdot1q10//封装dot1q,vlanid10,对应vlan10,vlan10的路由点。
93
94RT5(config-subif)#ipaddress192.168.10.1255.255.255.0
95
96RT5(config-subif)#noshutdown//打开子接口
97
98RT5(config-subif)#exi
99
100RT5(config)#intere0/0.11//创建子接口
101
102RT5(config-subif)#encapsulationdot1q11//封装dot1q,vlanid11,对应vlan11,vlan11的路由点
103
104RT5(config-subif)#ipaddress192.168.11.1255.255.255.0
105
106RT5(config-subif)#noshutdown//打开子接口
107
108RT5(config-subif)#end