网络配置实践

 

目录

【实验目的及要求】

【实验原理】

【实验环境】

【实验内容】

实验项目

实验方案设计

实验过程

(1)PC机IP设置

(2)按照拓扑图修改设备名

(3)交换机的配置

(4)配置检验

(5)单臂路由:

(6)RIPv2设计

(7)ACL

(8)NAT

【小结】


实验概述:

 

【实验目的及要求】

1)理解交换机的工作原理

2理解路由器选路工作原理

3理解企业网络部署的原理

(4)掌握企业网络部署的配置过程

 

【实验原理】

交换机:交换机按每一个包中的MAC地址相对简单地决策信息转发,转发决策一般不考虑包中隐藏的更深的其他信息。体现了桥接技术的复杂交换技术在OSI参考模型的第二层操作,它的各个端口都具有桥接功能,每个端口可以连接一个LAN或一台高性能网站或服务器,能够通过自学习来了解每个端口的设备连接情况。所有端口由专用处理器进行控制,并经过控制管理总线转发信息。

路由器:路由器工作在IP协议网络层,用于实现子网之间转发数据。当一台路由器收到一个IP数据包时,它将根据数据包中的目的IP地址项查找路由表,根据查找的结果将此IP数据包送往对应端口。下一台IP路由器收到此数据包后继续转发,直至发到目的地。路由器之间可以通过路由协议来进行路由信息的交换,从而更新路由表。

STP:在交换机上采用冗余链路,复杂的拓扑结构可能导致多重回路,产生广播风暴,STP将交换机某些端口置于阻塞状态以防止打破环路的存在。

VLANVLAN将一个物理的LAN逻辑地划分成不同的广播域(或称虚拟LAN,即VLAN),每个逻辑的VLAN就象一个独立的物理桥,同一个VLAN可以跨越多个交换机主干功能支持多个VLAN的数据。使用VLAN的创建,隔离广播,缩小广播范围,可以控制广播风暴的产生。

VTP:VTP是一种消息协议,在全网的基础上管理VLAN的添加、删除和重命名,以实现VLAN配置的一致性。

静态路由:静态路由是在路由器中设置的固定的路由表。由网络管理员在路由器上手工添加路由信息以实现路由目的。除非网络管理员干预,否则静态路由不会发生变化。由于静态路由不能对网络的改变作出反映,一般用于网络规模不大拓扑结构固定的网络中。静态路由的优点是简单、高效、可靠。在所有的路由中,静态路由优先级最高。当动态路由与静态路由发生冲突时,以静态路由为准。

RIP路由协议:RIP采用距离向量算法,即路由器根据距离选择路由,也称为距离向量协议。路由器收集所有可到达目的地的不同路径,并且保存有关到达每个目的地的最少站点数的路径信息,除到达目的地的最佳路径外,任何其它信息均予以丢弃。同时路由器也把所收集的路由信息用RIP协议通知相邻的其它路由器。这样,路由信息逐渐扩散到全网。RIP使用广泛,简单,可靠,便于配置。但RIP只适用于小型的同构网络,因为它允许的最大站点数为15,任何超过15个站点的目的地均被标记为不可达。RIP每隔30s做一次路由信息广播。

OSPF路由协议:0SPF基于链路状态的路由协议,需每个路由器向其同一管理域的所有其它路由器发送链路状态广播信息。利用0SPF的路由器首先须收集有关的链路状态信息,并根据一定的算法计算出到每个节点的最短路径。基于距离向量的路由协议仅向其邻接路由器发送有关路由更新信息。OSPF将一个自治域再划分为区,相应地即有两种类型的路由选择方式。当源和目的地在同一区时,采用区内路由选择;当源和目的地在不同区时,则采用区间路由选择。当一个区内的路由器出了故障时并不影响自治域内其它区路由器的正常工作,给网络的管理维护带来方便。

ACLACL使用包过滤技术,在路由器上读取第三层及第四层包头中的信息如源地址、目的地址、源端口、目的端口等,根据预先定义好的规则对包进行过滤,从而达到访问控制的目的。

NAT:网络地址转换,其功能是将企业内部自行定义的非法IP地址转换为Internet公网上可识别的合法IP地址。

【实验环境】

本次网络组网实验的实验环境为:

(1)cisco2621 系列路由器若干台;

(2)cisco2950系列交换机若干台;

(3)PC机若干台;

(4)网线、背靠背线若干根;

(4)ios版本要求:ios 1.22及以上。

 

【实验内容】

 

实验项目

(1)按照以下组网图连接好设备

(2)按照拓扑图修改设备名,所有设备关闭域名解析,打开光标跟随exec(交换没有),关闭自动退出。

(3)PC1和PC2属于192.168.1.0网段,这个部门有20人,PC3和PC4属于192.168.2.0网段,这个部门有40人。请选择正确的子网掩码,要求最少浪费IP地址

(4)三台交换之间封装trunk

(5)SW1,SW2,SW3属于同VTP域,域名ccna,其中SW1server,SW2,SW3是客户端。SW1上建立VLAN10和VLAN20,SW2和SW3能够从SW1上学习到VLAN信息

(6)将SW2上的F0/5和F0/6划进VLAN10,SW3上的F0/5和F0/6划进VLAN20.

(7)将SW2设为vlan1、vlan10、vlan20的根桥。注意在三个vlan里都要设置

(8)在R1上配置单臂路由,注意SW1的F0/1封装trunk。

(9)R1是公司内部路由,R2是边界,R1、R2运行RIP版本2协议,使公司内全通。

(10)在R2上配置VTY,密码111,特权密码222,允许别人telnet。配置标准的ACL,应用到VTY接口下,使得只有PC1能够telnet R2

(11)在R2上配置NAT,使192.168.1.0和192.168.2.0这两段内网地址在访问外网时全部转换为R2的S1/1接口地址。在R2上指一条0.0.0.0的默认路由,出接口S1/1

 

 

实验方案设计

 

 

PC1的ip:192.168.1.2/27,pc2::192.168.1.3/27,掩码:255.255.255.224,;pc3:192.168.2.2/26,pc4:192.168.2.3/26,掩码:255.255.255.192

 

拓扑结构图

 

实验过程

(1)PC机IP设置

 

 

 

(2)按照拓扑图修改设备名

R1>en

R1#config t

Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)#no ip domain-lookup

R1(config)#line console 0

R1(config-line)#logging syn

R1(config-line)#exec-timeout 0 0

R1(config-line)#exit

 

R2>en

R2#config t

Enter configuration commands, one per line.  End with CNTL/Z.

R2(config)#no ip domain-lookup

R2(config)#line console 0

R2(config-line)#logging syn

R2(config-line)#exec-timeout 0 0

R2(config-line)#exit

 

R3>en

R3#config t

Enter configuration commands, one per line.  End with CNTL/Z.

R3(config)#no ip domain-lookup

R3(config)#line console 0

R3(config-line)#logging syn

R3(config-line)#exec-timeout 0 0

R3(config-line)#exit

R3(config)#int se 1/0

R3(config-if)#ip add 172.16.23.3 255.255.255.0

R3(config-if)#no shutdown

 

R3(config-if)#

%LINK-5-CHANGED: Interface Serial1/0, changed state to up

(3)交换机的配置

S1:

Switch>en

Switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#hostname SW1

SW1(config)#exit

SW1#

%SYS-5-CONFIG_I: Configured from console by console

SW1#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.

 

SW1(vlan)#vtp server

Device mode already VTP SERVER.

SW1(vlan)#vtp domain ccna

Domain name already set to ccna.

SW1(vlan)#exit

APPLY completed.

Exiting....

SW1#config t

Enter configuration commands, one per line.  End with CNTL/Z.

SW1(config)#interface fa0/2

SW1(config-if)#switchport mode trunk

 

SW1(config-if)#

%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

 

SW1(config-if)#exit

SW1(config)#interface fa 0/3

SW1(config-if)#switchport mode trunk

 

SW1(config-if)#

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

 

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

 

SW1(config-if)#exit

SW1(config)#vlan 10

SW1(config-vlan)#name v10

SW1(config-vlan)#exit

SW1(config)#vlan 20

SW1(config-vlan)#name v20

SW1(config-vlan)#exit

 

 

 

S2:

Switch>en

Switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#hostname SW2

SW2(config)#exit

SW2#

%SYS-5-CONFIG_I: Configured from console by console

SW2#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.

 

SW2(vlan)#vtp client

Device mode already VTP CLIENT.

SW2(vlan)#vtp domain ccna

Domain name already set to ccna.

SW2(vlan)#exit

APPLY completed.

Exiting....

SW2#

%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

 

SW2#config t

Enter configuration commands, one per line.  End with CNTL/Z.

SW2(config)#interface fa 0/2

SW2(config-if)#switchport mode trunk

SW2(config-if)#exit

SW2(config)#interface fa 0/4

SW2(config-if)#switchport mode trunk

 

SW2(config-if)#

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down

 

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up

 

SW2(config-if)#exit

SW2(config)#interface range fa 0/5-6

SW2(config-if-range)#switchport access vlan 10 

SW2(config-if-range)#exit

SW2(config)#spanning-tree vlan 10 priority 4096

SW2(config)#spanning-tree vlan 20 priority 4096

SW2(config)#spanning-tree vlan 1 root primary

 

 

 

S3:

Switch>en

Switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#hostname SW3

SW3(config)#exit

SW3#

%SYS-5-CONFIG_I: Configured from console by console

SW3#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.

 

SW3(vlan)#vtp client

Device mode already VTP CLIENT.

SW3(vlan)#vtp domain ccna

Domain name already set to ccna.

SW3(vlan)#exit

APPLY completed.

Exiting....

SW3#

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down

 

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

 

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down

 

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up

SW3#config t

Enter configuration commands, one per line.  End with CNTL/Z.

SW3(config)#interface fa 0/3

SW3(config-if)#switchport mode trunk

SW3(config-if)#exit

SW3(config)#interface fa 0/4

SW3(config-if)#switchport mode trunk

SW3(config-if)#exit

SW3(config)#interface range fa 0/5-6

SW3(config-if-range)#switchport access vlan 20

SW3(config-if-range)#exit

(4)配置检验

SW1的生成树:

SW1#show spanning-tree

VLAN0001

  Spanning tree enabled protocol ieee

  Root ID    Priority    32769

             Address     0004.9A83.1E36

             Cost        19

             Port        2(FastEthernet0/2)

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

 

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)

             Address     00E0.F92D.B524

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

             Aging Time  20

 

Interface        Role Sts Cost      Prio.Nbr Type

---------------- ---- --- --------- -------- --------------------------------

Fa0/2            Root FWD 19        128.2    P2p

Fa0/3            Altn BLK 19        128.3    P2p

 

VLAN0010

  Spanning tree enabled protocol ieee

  Root ID    Priority    4106

             Address     0004.9A83.1E36

             Cost        19

             Port        2(FastEthernet0/2)

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

 

  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)

             Address     00E0.F92D.B524

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

             Aging Time  20

 

Interface        Role Sts Cost      Prio.Nbr Type

---------------- ---- --- --------- -------- --------------------------------

Fa0/2            Root FWD 19        128.2    P2p

Fa0/3            Altn BLK 19        128.3    P2p

 

VLAN0020

  Spanning tree enabled protocol ieee

  Root ID    Priority    4116

             Address     0004.9A83.1E36

             Cost        19

             Port        2(FastEthernet0/2)

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

 

  Bridge ID  Priority    32788  (priority 32768 sys-id-ext 20)

             Address     00E0.F92D.B524

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

             Aging Time  20

 

Interface        Role Sts Cost      Prio.Nbr Type

---------------- ---- --- --------- -------- --------------------------------

Fa0/2            Root FWD 19        128.2    P2p

Fa0/3            Altn BLK 19        128.3    P2p

 

 

SW2的生成树:

SW2#show spanning-tree

VLAN0001

  Spanning tree enabled protocol ieee

  Root ID    Priority    24577

             Address     0004.9A83.1E36

             This bridge is the root

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

 

  Bridge ID  Priority    24577  (priority 24576 sys-id-ext 1)

             Address     0004.9A83.1E36

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

             Aging Time  20

 

Interface        Role Sts Cost      Prio.Nbr Type

---------------- ---- --- --------- -------- --------------------------------

Fa0/2            Desg FWD 19        128.2    P2p

Fa0/4            Desg FWD 19        128.4    P2p

 

VLAN0010

  Spanning tree enabled protocol ieee

  Root ID    Priority    4106

             Address     0004.9A83.1E36

             This bridge is the root

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

 

  Bridge ID  Priority    4106  (priority 4096 sys-id-ext 10)

             Address     0004.9A83.1E36

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

             Aging Time  20

 

Interface        Role Sts Cost      Prio.Nbr Type

---------------- ---- --- --------- -------- --------------------------------

Fa0/5            Desg FWD 19        128.5    P2p

Fa0/6            Desg FWD 19        128.6    P2p

Fa0/2            Desg FWD 19        128.2    P2p

Fa0/4            Desg FWD 19        128.4    P2p

 

VLAN0020

  Spanning tree enabled protocol ieee

  Root ID    Priority    4116

             Address     0004.9A83.1E36

             This bridge is the root

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

 

  Bridge ID  Priority    4116  (priority 4096 sys-id-ext 20)

             Address     0004.9A83.1E36

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

             Aging Time  20

 

Interface        Role Sts Cost      Prio.Nbr Type

---------------- ---- --- --------- -------- --------------------------------

Fa0/2            Desg FWD 19        128.2    P2p

Fa0/4            Desg FWD 19        128.4    P2p

 

 

SW3的生成树:

SW3#show spanning-tree

VLAN0001

  Spanning tree enabled protocol ieee

  Root ID    Priority    24577

             Address     0004.9A83.1E36

             Cost        19

             Port        4(FastEthernet0/4)

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

 

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)

             Address     00D0.BA2D.63AA

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

             Aging Time  20

 

Interface        Role Sts Cost      Prio.Nbr Type

---------------- ---- --- --------- -------- --------------------------------

Fa0/3            Desg FWD 19        128.3    P2p

Fa0/4            Root FWD 19        128.4    P2p

 

VLAN0010

  Spanning tree enabled protocol ieee

  Root ID    Priority    4106

             Address     0004.9A83.1E36

             Cost        19

             Port        4(FastEthernet0/4)

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

 

  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)

             Address     00D0.BA2D.63AA

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

             Aging Time  20

 

Interface        Role Sts Cost      Prio.Nbr Type

---------------- ---- --- --------- -------- --------------------------------

Fa0/3            Desg FWD 19        128.3    P2p

Fa0/4            Root FWD 19        128.4    P2p

 

VLAN0020

  Spanning tree enabled protocol ieee

  Root ID    Priority    4116

             Address     0004.9A83.1E36

             Cost        19

             Port        4(FastEthernet0/4)

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

 

  Bridge ID  Priority    32788  (priority 32768 sys-id-ext 20)

             Address     00D0.BA2D.63AA

             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

             Aging Time  20

 

Interface        Role Sts Cost      Prio.Nbr Type

---------------- ---- --- --------- -------- --------------------------------

Fa0/5            Desg FWD 19        128.5    P2p

Fa0/3            Desg FWD 19        128.3    P2p

Fa0/4            Root FWD 19        128.4    P2p

Fa0/6            Desg FWD 19        128.6    P2p

 

PC1可通PC2,不可通PC3,PC4

(5)单臂路由:

SW1:

SW1(config)#int fa 0/1

SW1(config-if)#switchport mode access

SW1(config-if)#switchport mode trunk

 

SW1(config-if)#

%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

 

SW1(config-if)#end

 

R1:

初始化

R1>en

R1#config t

Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)#no ip domain-lookup

R1(config)#line console 0

R1(config-line)#logging synchronous

R1(config-line)#exec-timeout 0 0

R1(config-line)#exit

 

配置子端口:

R1(config)#int fa 0/0

R1(config-if)#no shut

 

Router(config-if)#

%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)#int fa 0/0.1

R1(config-subif)#encap dot1q 10

R1(config-subif)#ip add 192.168.1.1 255.255.255.224

R1(config-subif)#exit

R1(config)#int fa 0/0.2

R1(config-subif)#encap dot1q 20

R1(config-subif)#ip address 192.168.2.1 255.255.255.192

R1(config-subif)#end

 

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

 

     192.168.1.0/27 is subnetted, 1 subnets

C       192.168.1.0 is directly connected, FastEthernet0/0.1

     192.168.2.0/26 is subnetted, 1 subnets

C       192.168.2.0 is directly connected, FastEthernet0/0.2

 

PC1已经可以ping通PC3、PC4,单臂路由配置成功。

(6)RIPv2设计

R1:

R1#config t

Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)#int se 1/0

R1(config-if)#ip add 172.16.12.1 255.255.255.0

R1(config-if)#clock rate 64000

R1(config-if)#no shutdown

R1(config-if)#exit

%LINK-5-CHANGED: Interface Serial1/0, changed state to up

 

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up

R1(config)#router rip

R1(config-router)#network 192.168.1.0

R1(config-router)#network 192.168.2.0

R1(config-router)#network 172.16.12.0

R1(config-router)#version 2

R1(config-router)#no auto-summary

R1(config-router)#exit

R1(config)#exit

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

 

     172.16.0.0/24 is subnetted, 1 subnets

C       172.16.12.0 is directly connected, Serial1/0

     192.168.1.0/27 is subnetted, 1 subnets

C       192.168.1.0 is directly connected, FastEthernet0/0.1

     192.168.2.0/26 is subnetted, 1 subnets

C       192.168.2.0 is directly connected, FastEthernet0/0.2

 

R2:

R2#config t

Enter configuration commands, one per line.  End with CNTL/Z.

R2(config)#int se 1/0

R2(config-if)#ip address 172.16.12.2 255.255.255.0

R2(config-if)#no shut

 

R2(config-if)#

%LINK-5-CHANGED: Interface Serial1/0, changed state to up

 

R2(config-if)#exit

R2(config)#int se 1/1

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up

R2(config-if)#ip add 172.16.23.2 255.255.255.0

R2(config-if)#no shut

R2(config-if)#

%LINK-5-CHANGED: Interface Serial1/1, changed state to up

R2(config-if)#exit

R2(config)#router rip

R2(config-router)#network 172.16.12.0

R2(config-router)#network 172.16.23.0

R2(config-router)#version 2

R2(config-router)#no auto-summary

R2(config-router)#exit

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

 

     172.16.0.0/24 is subnetted, 1 subnets

C       172.16.12.0 is directly connected, Serial1/0

     192.168.1.0/27 is subnetted, 1 subnets

R       192.168.1.0 [120/1] via 172.16.12.1, 00:00:23, Serial1/0

     192.168.2.0/26 is subnetted, 1 subnets

R       192.168.2.0 [120/1] via 172.16.12.1, 00:00:23, Serial1/0

 

测试结果:R1、R2都可以ping通全部PC,从而证明公司内网全通

 

(7)ACL

1、vty

R2#config t

Enter configuration commands, one per line.  End with CNTL/Z.

R2(config)#enable secret 222

R2(config)#line vty 0 4

R2(config-line)#password 111

R2(config-line)#login

R2(config-line)#exit

2、标准ACL

R2(config)#access-list 10 permit 192.168.1.2 0.0.0.31

R2(config)#access-list 10 deny any

R2(config)#int se 1/0

R2(config-if)#ip access-group 10 in

 

测试结果:PC1可以telnet R2,但是PC2、3、4不可以

 

(8)NAT

R2:

R2(config)#ip route 0.0.0.0 0.0.0.0 serial 1/1

R2(config)#ip nat inside source static 192.168.1.2 172.168.12.2

R2(config)#ip nat inside source static 192.168.1.3 172.168.12.2

R2(config)#ip nat inside source static 192.168.2.2 172.168.12.2

R2(config)#ip nat inside source static 192.168.2.3 172.168.12.2

R1(config)#int se 1/0

R1(config-if)#ip nat inside

R1(config-if)#exit

R1(config)#int se 1/1

R1(config-if)#ip nat outside

 

R3:

R3(config)#ip route 172.16.12.2 255.255.255.255 se 1/0

 

结果:

PC1成功ping通R3,同理PC2、3、4也可ping通R3

 

在PC1和PC2上ping R3的过程中,在R2上运行debug ip nat,所得结果如下:

 

可见已经通过静态NAT的方法,将PC的地址转换为R2的出口地址并与外网连通

 

【小结】

这次试验完全由我们自己完成,充分调动了以前所学的网络路由配置的知识,巩固了所学的知识点,让我对路由和交换网络有了更加深刻的认识。

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值