组网上机实验报告
实验题目:vlan配置实验
班级: A09计算机
姓名: 查 昊 迅
学号: 09803101
20##年4月3日
实验目的:理解Port VLAN的配置和跨交换机之间VLAN的特点.
掌握如何通过三层交换机实现VLAN之间的路由.
试验环境:
本实验环境如实验过程中的各图.
实验过程:
一、实例拓扑图
图一 交换机Cisco 2960
二、创建VLAN
在Cisco IOS中有两种方式创建vlan,在全局配置模式下使用vlan vlanid命令,如switch(config)#vlan 10;在vlan database下创建vlan,如switch(vlan)vlan 20
图二 创建vlan
三、把端口划分给vlan(基于端口的vlan)
switch(config)#interface fastethernet0/1 进入端口配置模式
switch(config-if)#switchport mode access 配置端口为access模式
switch(config-if)#switchport access vlan 10 把端口划分到vlan 10
图三
如果一次把多个端口划分给某个vlan可以使用interface range命令。
图四
四、查看vlan信息
switch#show vlan
图五
图六 show vlan brief 查看vlan简明信息
图七 查看id为10的vlan
图八 通过vlan的名字查看vlan
五、删除配置
图九 把第0个模块中的第8个端口从vlan 40中删除
图十 删除vlan 40
我们还可以为每个vlan配置ip地址。
第二篇:VLAN间的路由配置实验报告
“计算机网络实验”-实验报告
实验序号:
一、VLAN之间的路由配置
Switch>enable
Switch#config t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname c3750
c3750(config)#exit
c3750#
00:01:19: %SYS-5-CONFIG_I: Configured from console by console
c3750#vlan b
00:01:25: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state t
o up
c3750#vlan basedata
^
% Invalid input detected at '^' marker.
c3750#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.
c3750(vlan)#vlan 2 name market
VLAN 2 modified:
Name: market
c3750(vlan)#vlan 3 name develop
VLAN 3 modified:
Name: develop
c3750(vlan)#end
^
% Invalid input detected at '^' marker.
c3750(vlan)#exit
APPLY completed.
Exiting....
c3750#config t
Enter configuration commands, one per line. End with CNTL/Z.
c3750(config)#inter range f0/1 -4
^
% Invalid input detected at '^' marker.
c3750(config)#inter range f1/1 -4
^
% Invalid input detected at '^' marker.
c3750(config)#inter range fa1/1 -4
^
% Invalid input detected at '^' marker.
c3750(config)#interface range fa1/0/1 -4
c3750(config-if-range)#switchport access vlan 2
c3750(config-if-range)#interface range fa1/0/5 -8
c3750(config-if-range)#switchport access vlan 3
c3750(config-if-range)#exit
c3750(config)#inter fa1/0/24
c3750(config-if)#switchport trunk encap dot1q
c3750(config-if)#switchport mode trunk
c3750(config-if)#interface fa1/0/23
c3750(config-if)#switchport tunk encap dot1q
^
% Invalid input detected at '^' marker.
c3750(config-if)#switchport trunk encap dot1q
c3750(config-if)#switchport mode trunk
c3750(config-if)#e
00:07:57: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0/23, ch
anged state to down
c3750(config-if)#exit
c3750(config)#
00:08:00: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0/23, ch
anged state to up
c3750(config)#
% Please answer 'yes' or 'no'.
Would you like to enter the initial configuration dialog? [yes/no]:
% Please answer 'yes' or 'no'.
Would you like to enter the initial configuration dialog? [yes/no]: no
Press RETURN to get started!
Router>
Router>enable
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#inter f0/0
Router(config-if)#no shutdown
Router(config-if)#
Router(config-if)#
*May 15 03:16:07.219: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state t
o up
*May 15 03:16:10.219: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthern
et0/0, changed state to up
Router(config-if)#interf f0/0.2
Router(config-subif)#encap dot1q 2
Router(config-subif)#ip address
% Incomplete command.
Router(config-subif)#ip address 192.168.2.1 255.255.255.0
Router(config-subif)#no shutdown
Router(config-subif)#inter f0/0.3
Router(config-subif)#encap dot1q 3
Router(config-subif)#ip address 192.168..3.1 255.255.255.0
^
% Invalid input detected at '^' marker.
Router(config-subif)#ip address 192.168.3.1 255.255.255.0
Router(config-subif)#exit
Router(config)#inter f0/0.3
Router(config-subif)#no shutdown
Router(config-subif)#end
Router#
*May 15 03:19:17.519: %SYS-5-CONFIG_I: Configured from console by console
% Please answer 'yes' or 'no'.
Would you like to enter the initial configuration dialog? [yes/no]: n
Press RETURN to get started!
Switch>
00:13:51: %LINK-5-CHANGED: Interface Vlan1, changed state to administratively do
wn
00:13:52: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state t
o downe
% Ambiguous command: "e"
Switch>enable
Switch#config t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname c2950
c2950(config)#exit
c2950#v
00:14:18: %SYS-5-CONFIG_I: Configured from console by console]
% Unknown command or computer name, or unable to find computer address
c2950#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.
c2950(vlan)#vlan 2 name market
VLAN 2 modified:
Name: market
c2950(vlan)#vlan 3 name develop
VLAN 3 modified:
Name: develop
c2950(vlan)#vtp client
Device mode already VTP CLIENT.
c2950(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
c2950#config t
Enter configuration commands, one per line. End with CNTL/Z.
c2950(config)#inter range fa0/1 -4
c2950(config-if-range)#switchport access vlan 2
c2950(config-if-range)#inter range fa0/0/5 -8
^
% Invalid input detected at '^' marker.
c2950(config)#inter range fa0/5 -8
c2950(config-if-range)#switchport access vlan 3
c2950(config-if-range)#interface f0/24
c2950(config-if)#switchport mode trunk
c2950(config-if)#exit
c2950(config)#end
c2950#
00:18:36: %SYS-5-CONFIG_I: Configured from console by console
二、路由访问控制列表配置
未添加acl之前
R1的配置
Router>enable
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname ri
ri(config)#inter f0/0
ri(config-if)#ip address 192.168.1.1 255.255.255.0
ri(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
ri(config-if)#inter s0/0/0
^
% Invalid input detected at '^' marker.
ri(config-if)#exit
ri(config)#inter s0/0/0
^
% Invalid input detected at '^' marker.
ri(config)#inter s0/0/1
^
% Invalid input detected at '^' marker.
ri(config)#inter s0/0
ri(config-if)#
ri(config-if)#exit
ri(config)#interface Serial0/0
ri(config-if)#
ri(config-if)#exit
ri(config)#interface Serial0/1
ri(config-if)#
ri(config-if)#exit
ri(config)#interface Serial0/0
ri(config-if)#ip address 192.168.12.1 255.255.255.0
ri(config-if)#encap ppp
ri(config-if)#clock rate 64000
ri(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0, changed state to down
ri(config-if)#no shutdown
ri(config-if)#
ri(config-if)#exit
ri(config)#interface Serial0/0
ri(config-if)#exit
ri(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
ri#config t
Enter configuration commands, one per line. End with CNTL/Z.
ri(config)#router rip
ri(config-router)#network 192.168.1.0
ri(config-router)#network 192.168.12.0
ri(config-router)#end
%SYS-5-CONFIG_I: Configured from console by console
ri#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, FastEthernet0/0
ri#
%LINK-5-CHANGED: Interface Serial0/0, changed state to up
ri#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, FastEthernet0/0
ri#
ri#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
ri(config)#interface Serial0/0
ri(config-if)#
ri(config-if)#exit
ri(config)#
ri(config)#
ri(config)#router rip
ri(config-router)#
ri#
%SYS-5-CONFIG_I: Configured from console by console
ri#ping 192.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
ri#show inter
FastEthernet0/0 is up, line protocol is up (connected)
Hardware is Lance, address is 00e0.f9aa.eb23 (bia 00e0.f9aa.eb23)
Internet address is 192.168.1.1/24
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
ARP type: ARPA, ARP Timeout 04:00:00,
Last input 00:00:08, output 00:00:05, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0 (size/max/drops); Total output drops: 0
Queueing strategy: fifo
Output queue :0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 input packets with dribble condition detected
1 packets output, 52 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier
ri#show inter
FastEthernet0/0 is up, line protocol is up (connected)
Hardware is Lance, address is 00e0.f9aa.eb23 (bia 00e0.f9aa.eb23)
Internet address is 192.168.1.1/24
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
ARP type: ARPA, ARP Timeout 04:00:00,
Last input 00:00:08, output 00:00:05, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0 (size/max/drops); Total output drops: 0
Queueing strategy: fifo
Output queue :0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 input packets with dribble condition detected
1 packets output, 52 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier
0 output buffer failures, 0 output buffers swapped out
Serial0/0 is up, line protocol is down (disabled)
Hardware is HD64570
Internet address is 192.168.12.1/24
MTU 1500 bytes, BW 128 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation PPP, loopback not set, keepalive set (10 sec)
LCP Closed
Closed: LEXCP, BRIDGECP, IPCP, CCP, CDPCP, LLC2, BACP
Last input never, output never, output hang never
Last clearing of "show interface" counters never
--More--
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
Input queue: 0/75/0 (size/max/drops); Total output drops: 0
Queueing strategy: weighted fair
Output queue: 0/1000/64/0 (size/max total/threshold/drops)
ri#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, FastEthernet0/0
R 192.168.2.0/24 [120/1] via 192.168.12.2, 00:00:08, Serial0/0
C 192.168.12.0/24 is directly connected, Serial0/0
R2的配置
Router>enable
Router#hostname r2
^
% Invalid input detected at '^' marker.
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname r2
r2(config)#interfa f0/0\
^
% Invalid input detected at '^' marker.
r2(config)#inter f0/0
r2(config-if)#ip address 192.168.2.1 255.255.255.0
r2(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
r2(config-if)#inter s0/1
r2(config-if)#ip address 192.168.12.2 255.255.255.0
r2(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/1, changed state to up
r2(config-if)#exit
r2(config)#router rip
r2(config-router)#network 192.168.12.0
r2(config-router)#network 192.168.2.0
r2(config-router)#end
%SYS-5-CONFIG_I: Configured from console by console
r2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.2.0/24 is directly connected, FastEthernet0/0
r2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.2.0/24 is directly connected, FastEthernet0/0
r2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
r2(config)#inter s0/1
r2(config-if)#encap ppp
r2(config-if)#e
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
xit
r2(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
r2#ping 192.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/3/4 ms
r2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
R 192.168.1.0/24 [120/1] via 192.168.12.1, 00:00:18, Serial0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/0
C 192.168.12.0/24 is directly connected, Serial0/1
r2#
标准数据包过滤
ri(config)#access-list 99 deny 192.168.2.2 0.0.0.0
ri(config)#access-list permit 0.0.0.0 255.255.255.255
^
% Invalid input detected at '^' marker.
ri(config)#interf s0/0
ri(config-if)#ip access-group 99 in
ri(config-if)#end
%SYS-5-CONFIG_I: Configured from console by console
ri#show ip access-list
Standard IP access list 99
deny host 192.168.2.2
ri#
扩展ip访问链表配置
ri(config)#inter s0/0
ri(config-if)#no ip access-group 99 in
ri(config-if)#exit
ri(config)#access-list 110 deny tcp 192.168.2.2 0.0.0.0 192.168.12.1.0.0.0.0 eq23
^
% Invalid input detected at '^' marker.
ri(config)#access-list 110 deny tcp 192.168.2.2 0.0.0.0 192.168.12.1.0.0.0.0 eq 23
^
% Invalid input detected at '^' marker.
ri(config)#
ri(config)#access-list 110 deny tcp 192.168.2.2 0.0.0.0 192.168.12.1 0.0.0.0 eq 23
ri(config)#inter s0/0
ri(config-if)#exit
ri(config)#access-list 110 permit ip any any
ri(config)#inter s0/0
ri(config-if)#ip access-group 110 in
ri(config-if)#exit
ri(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
ri#show ip access-list
Standard IP access list 99
deny host 192.168.2.2
Extended IP access list 110
deny tcp host 192.168.2.2 host 192.168.12.1 eq telnet
permit ip any any (2 match(es))
ri#