Chinaunix首页 | 论坛 | 博客
  • 博客访问: 19780
  • 博文数量: 11
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 70
  • 用 户 组: 普通用户
  • 注册时间: 2014-03-13 22:57
文章分类

全部博文(11)

文章存档

2014年(11)

我的朋友

分类: 网络与安全

2014-04-15 20:08:13

    在当今世界中,网络已经成为一个我们生活中很重要的一部分了,人们在网络上学习、办公与娱乐,通过网络解决自己碰到的各种问题。这篇博客就是利用模拟器cisco packet tracer来模拟一个简单网络的设计与实现过程。这个实验是模拟的一个小型局域网,其中左边是一个小型网络,包括二层交换机SW2-1、SW2-2、三层交换机SW3、路由器R1以及左边的所有PC机。其中划分了3个不同的VLAN,3个VLAN间通过三层交换机进行通信,最右边是也是一个小型网络,包括路由器R2,二层交换机SW2-3和右边的PC机,2个网络间通过2台路由器进行连接通信。网络拓扑图如下:

先用SW2-1和SW-2划分好VLAN
SW2-1:
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#host SW2-1
SW2-1(config)#vlan 10                                        创建vlan 10
SW2-1(config-vlan)#vlan 20
SW2-1(config-vlan)#int f0/2
SW2-1(config-if)#switchport access vlan 10            该接口划分到vlan 10
SW2-1(config-if)#int f0/3
SW2-1(config-if)#switchport access vlan 20
SW2-1(config-if)#int f0/1
SW2-1(config-if)#switchport 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
SW2-2:
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#host SW2-2
SW2-2(config)#vlan 10
SW2-2(config-vlan)#vlan 30
SW2-2(config-vlan)#int f0/2
SW2-2(config-if)#switchport access vlan 30
SW2-2(config-if)#int f0/3
SW2-2(config-if)#switchport access vlan 10
SW2-2(config-if)#int f0/1
SW2-2(config-if)#switchport 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
VLAN划分好后,利用PC0来分别ping PC1、PC2、PC3并观察结果


我们可以观察到PC0向处于不同VLAN间的PC1和PC2发送的数据包全部因超时而丢失,向处于同一VLAN间的PC3发送的数据包顺利到达并返回,接下来我们就要利用三层交换机来实现三个不同VLAN间的通信了。
配置如下:
SW3:
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#host SW3
SW3(config)# vlan 10                          
SW3(config-vlan)#vlan 20
SW3(config-vlan)#vlan 30
SW3(config-vlan)#exit
SW3(config)#int vlan 10
%LINK-5-CHANGED: Interface Vlan10, changed state to up
SW3(config-if)#ip add 192.168.10.1 255.255.255.0              给vlan 10配网关地址
SW3(config-if)#int vlan 20
SW3(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
SW3(config-if)#ip add 192.168.20.1 255.255.255.0
SW3(config-if)#int vlan 30
%LINK-5-CHANGED: Interface Vlan30, changed state to up
SW3(config-if)#ip add 192.168.30.1 255.255.255.0
SW3(config-if)#ip routing                                                   开启三层交换机的路由功能
配好之好,现在用PC0再ping下PC1和PC2

现在发现首先不通的PC1和PC2也通了,不同VLAN之间的通信已经实现,接下来要做的就是实现整个网络的正常通信
配置如下:
SW3:
SW3(config)#int f0/1
SW3(config-if)#no switchport                                            将该接口设置为三层模式
SW3(config-if)#ip add 192.168.1.1 255.255.255.252
SW3(config-if)#exit
SW3(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.2               设置默认路由
R1:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R1
R1(config)#int f0/0
R1(config-if)#ip add 192.168.1.2 255.255.255.252
R1(config-if)#no shut
%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)#int s2/0
R1(config-if)#ip add 10.0.0.1 255.255.255.252
R1(config-if)#clock rate 64000                                            设置串口的时钟频率
R1(config-if)#no shut
%LINK-5-CHANGED: Interface Serial2/0, changed state to down
R1(config-if)#exit
R1(config)#ip route 192.168.10.0 255.255.255.0 192.168.1.1        设置静态路由  
R1(config)#ip route 192.168.20.0 255.255.255.0 192.168.1.1
R1(config)#ip route 192.168.30.0 255.255.255.0 192.168.1.1
R1(config)#ip route 0.0.0.0 0.0.0.0 10.0.0.2
R2:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R2
R2(config)#int s2/0
R2(config-if)#ip add 10.0.0.2 255.255.255.252
R2(config-if)#no shut
%LINK-5-CHANGED: Interface Serial2/0, changed state to up
R2(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
R2(config-if)#int f0/0
R2(config-if)#ip add 172.16.10.1 255.255.255.0
R2(config-if)#no shut
%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)#exit
R2(config)#ip route 0.0.0.0 0.0.0.0 10.0.0.1
到此,整个网络已配置完成,现在利用PC6去ping左边的四台PC机来看看结果


从图中可以得出结论整个网络都可以互相通信了,大功告成。







阅读(2474) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~