Packet Tracer 5.0实验(七) 路由器单臂路由配置

一、实验目标

  • 掌握单臂路由配置方法;
  • 通过单臂路由实现不同VLAN间互相通信;

二、实验背景

某企业有两个主要部门:技术部和销售部,分处于不同的办公室,为了安全和便于管理,对两个部门的主机进行了VLAN的划分,技术部和销售部分处于不同的VLAN。现由于业务的需求,需要销售部和技术部的主机能够相互访问,获得相应的资源,两个部门的交换机通过一台路由器进行了连接。

三、技术原理

单臂路由:是为实现VLAN间通信的三层网络设备路由器,它只需要一个以太接口,通过创建子接口可以承担所有VLAN的网关,而在不同的VLAN间转发数据。

四、实验步骤

实验拓扑

1、当交换机设置成两个vlan时,逻辑上已经成为两个网络,广播被隔离了。两个vlan的网络要通信,必须通过路由器,如果接入路由器的只有一个物理端口,则必须有两个子接口分别与两个vlan对应,同时还要求与路由器相连的交换机的端口f0/1要设置为trunk,因为这个口要通过两个vlan的数据包。

2、检查设置情况,应该能正确的看到vlan和trunk的信息。

3、计算机的网关分别指向路由器的子接口。

4、配置子接口,开启路由器物理接口。

5、默认封装为dot1q协议。

6、配置路由器子接口ip地址。

Switch:

Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#interface fa0/2
Switch(config-if)#switchport access vlan 2
Switch(config-if)#exit
Switch(config)#interface fa0/3
Switch(config-if)#switchport access vlan 3
Switch(config-if)#exit
Switch(config)#interface fa0/1
Switch(config-if)#switchport mode trunk 
Switch(config-if)#

R1:

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R1
R1(config)#interface fa0/0
R1(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

R1(config-if)#exit
R1(config)#interface fa0/0.1

%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
R1(config-subif)#encapsulation dot1Q 2
R1(config-subif)#ip address 192.168.1.1 255.255.255.0
R1(config-subif)#exit
R1(config)#interface fa0/0.2

%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
R1(config-subif)#encapsulation dot1Q 3
R1(config-subif)#ip address 192.168.2.1 255.255.255.0
R1(config-subif)#
R1#
%SYS-5-CONFIG_I: Configured from console by console

R1#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.1
C    192.168.2.0/24 is directly connected, FastEthernet0/0.2
R1

五、测试

PC2:

Packet Tracer PC Command Line 1.0
PC>ipconfig

IP Address......................: 192.168.2.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.2.1

PC>ping 192.168.1.2

Pinging 192.168.1.2 with 32 bytes of data:

Request timed out.
Reply from 192.168.1.2: bytes=32 time=8ms TTL=127
Reply from 192.168.1.2: bytes=32 time=8ms TTL=127
Reply from 192.168.1.2: bytes=32 time=17ms TTL=127

Ping statistics for 192.168.1.2:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 8ms, Maximum = 17ms, Average = 11ms

PC>
posted @ 2012-07-17 18:02  Merlin_Tang  阅读(16414)  评论(4编辑  收藏  举报