交换机、路由器综合实验(三)

交换机、路由器综合实验(三)

一、实验目的:

  掌握较复杂网络的交换机和路由器的配置问题。

二、实验环境:Cisco路由器 3台;Catalyst 3550交换机 1台;PC机 3台。

图1

交换机、路由器综合实验(三)


说明:三层交换机将内网分割为三个子网 192.168.0.0、192.168.1.0、192.168.2.0;路由器R1负责内网与外网的连接,并实现NAT功能;R1、R2、R3之间通过路由协议识别各个网络,由于内网采用了私有IP地址进行编址,它对外网应该是不可见的,所以启用路由协议时不要启用内部网络。

三、实验工具:Boson Netsim模拟器

四、实验内容:

(1) 按图1所示连接网络;

(2) 配置路由器R1:

  路由器的名字为R1;

  F0口的IP地址:192.168.0.1/24,设置F0口为NAT输入端;

  S0口的IP地址:200.1.1.1/24,设置S0口为NAT输出端;

  配置NAT池,地址范围为 200.1.1.10~200.1.1.20,将内网中格式为 192.168.*.* 的IP地址转换为NAT池中的IP地址;

  配置静态路由,将目的网络为 192.168.1.0 或 192.168.2.0 的数据报发往 192.168.0.2;

  配置OSPF路由协议,区域号为10,在它的外网地址上启用协议。

(3) 配置路由器R2:

  路由器的名字为R2;

  S0口的IP地址:222.2.2.1/24;

  S1口的IP地址:200.1.1.2/24;

  配置OSPF路由协议,区域号为10,在它的所有直连网络上启用协议。

(4) 配置路由器R3:

  路由器的名字为R3;

  F0口的IP地址:18.1.1.1/8;

  S0口的IP地址:222.2.2.2/24;

  配置OSPF路由协议,区域号为10,在它的所有直连网络上启用协议。

(5) 配置三层交换机:

  把F0/1口设置为三层路由口,IP地址为 192.168.0.2/24;

  把F0/2口设置为三层路由口,IP地址为 192.168.1.1/24;

  把F0/3口设置为三层路由口,IP地址为 192.168.2.1/24;

  配置默认路由,方向为R1路由器的F0口;

  启用路由功能。

(6) 配置各PC机:包括IP地址、子网掩码和默认网关。PC1的默认网关为交换机的2#口IP、PC2的默认网关为交换机3#口IP、PC3的默认网关为R3的F0口IP。

(7) 测试结果:

R1的路由表中应包含2条直连路由(C)、2条静态路由(S)、2条由OSPF学习到的路由(O);

R2的路由表中应包含2条直连路由(C)、1条由OSPF学习到的路由(O);

R3的路由表中应包含2条直连路由(C)、1条由OSPF学习到的路由(O);

三层交换机的路由表中应包含3条直连路由(C)、1条默认路由(S*);

PC1与PC2可以ping通,它们与PC3无法ping通(这可能是模拟软件的问题),但在R1上用“show ip nat translation”命令可以看到ping命令执行时的NAT翻译情况,从R1上可ping通PC3。


交换机、路由器综合实验(三)参考答案:

交换机、路由器综合实验(三)

R1路由器的配置:(假设R1的S0口为DCE端)

Router>enable

Router#conf t

Router(config)#hostname R1

R1(config)#interface f0

R1(config-if)#ip address 192.168.0.1 255.255.255.0

R1(config-if)#ip nat inside

R1(config-if)#no shutdown

R1(config-if)#interface s0

R1(config-if)#ip address 200.1.1.1 255.255.255.0

R1(config-if)#clock rate 64000

R1(config-if)#ip nat outside

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)#ip nat pool p1 200.1.1.10 200.1.1.20 255.255.255.0

R1(config)#access-list 1 permit 192.168.0.0 0.0.255.255

R1(config)#ip nat inside source list 1 pool p1 overload

R1(config)#ip route 192.168.1.0 255.255.255.0 192.168.0.2

R1(config)#ip route 192.168.2.0 255.255.255.0 192.168.0.2

R1(config)#router ospf 100

R1(config-router)#network 200.1.1.0 0.0.0.255 area 10

R1(config-router)#end

R2路由器的配置:(假设R2的S0口为DCE端、S1口为DTE端)

Router>enable

Router#conf t

Router(config)#hostname R2

R2(config)#interface s0

R2(config-if)#ip address 222.2.2.1 255.255.255.0

R2(config-if)#clock rate 64000

R2(config-if)#no shutdown

R2(config-if)#interface s1

R2(config-if)#ip address 200.1.1.2 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#exit

R2(config)#router ospf 200

R2(config-router)#network 222.2.2.0 0.0.0.255 area 10

R2(config-router)#network 200.1.1.0 0.0.0.255 area 10

R2(config-router)#end

R3路由器的配置:(假设R3的S0口为DTE端)

Router>enable

Router#conf t

Router(config)#hostname R3

R3(config)#interface f0

R3(config-if)#ip address 18.1.1.1 255.0.0.0

R3(config-if)#no shutdown

R3(config-if)#interface s0

R3(config-if)#ip address 222.2.2.2 255.255.255.0

R3(config-if)#no shutdown

R3(config-if)#exit

R3(config)#router ospf 300

R3(config-router)#network 222.2.2.0 0.0.0.255 area 10

R3(config-router)#network 18.0.0.0 0.255.255.255 area 10

R3(config-router)#end

三层交换机的配置:

Switch>enable

Switch#conf t

Switch(config)#interface f0/1

Switch(config-if)#no switchport

Switch(config-if)#ip address 192.168.0.2 255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#interface f0/2

Switch(config-if)#no switchport

Switch(config-if)#ip address 192.168.1.1 255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#interface f0/3

Switch(config-if)#no switchport

Switch(config-if)#ip address 192.168.2.1 255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#exit

Switch(config)#ip route 0.0.0.0 0.0.0.0 192.168.0.1

Switch(config)#ip routing

Switch(config)#end

配置PC机:

PC1的IP地址为 192.168.1.2,子网掩码为 255.255.255.0,默认网关为 192.168.1.1;

PC2的IP地址为 192.168.2.2,子网掩码为 255.255.255.0,默认网关为 192.168.2.1;

PC3的IP地址为 18.1.1.2,子网掩码为 255.0.0.0,默认网关为 18.1.1.1。

r


分享到:


相關文章: