有路由器完整的三层交换网络

来源:互联网 发布:linux squid 代理 编辑:程序博客网 时间:2024/04/30 14:31

 

    本次操作是接用核心交换机实现三层交换继续做的....

    完成图:

  

    1、配置核心交换机对外接口:

 Switch(config-if)#no switchport ......................................此句解决不能给交换机分配ip地址的问题
Switch(config-if)#ip address 192.168.3.2 255.255.255.0
Switch(config-if)#

    2 、配置路由器

           首先,先把路由器f1/0与核心交换机f0/2相连。然后对路由器进行设置:

Router(config)#interface FastEthernet1/0
Router(config-if)#ip address 192.168.3.1 255.255.255.0
Router(config-if)#no shutdown

Router(config-if)#exit
Router(config)#interface FastEthernet0/0
Router(config-if)#ip address 192.168.4.1 255.255.255.0

Router(config-if)#no shutdown
Router(config-if)#exit

Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.2
Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.2................................使路由器接受来自.1.0和.2.0的网段信息
Router(config)#end

Router#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

S    192.168.1.0/24 [1/0] via 192.168.3.2
S    192.168.2.0/24 [1/0] via 192.168.3.2     ............................................此上两条为刚才配置的ip route
C    192.168.3.0/24 is directly connected, FastEthernet1/0

出现以上信息则配置正确。

   3、配置核心交换机。

 Switch(config)#ip route 0.0.0.0 0.0.0.0 192.168.3.1 ..................................使核心交换机接受任何网段的信息,网关为3.1

Switch(config)#end

Switch#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 192.168.3.1 to network 0.0.0.0

C    10.0.0.0/8 is directly connected, Vlan1
C    192.168.1.0/24 is directly connected, Vlan2
C    192.168.2.0/24 is directly connected, Vlan3
C    192.168.3.0/24 is directly connected, FastEthernet0/2
S*   0.0.0.0/0 [1/0] via 192.168.3.1

   出现以上信息则正确。

此时用pc终端ping 192.168.3.2 、192.168.3.1 都应该有响应。

通过路由器ping 192.168.2.2、192.168.1.2也应该有响应。

至此交换机与路由器可以互通。

    4、设置终端  PC2   ip:192.168.4.2 ;255.255.255.0 ;网关192.168.4.1 连接

             经测试,pc2 可以与pc0、pc1 通信。 

    

原创粉丝点击