静态路由配置

  1. 配置静态路由实现两个不同网络之间的全网互通

    1)搭建网络拓扑

        wKioL1PnRDKg9VmFAAEKRW7G2N0749.jpg


      2)配置PC1的IP地址为192.168.1.1,网关为192.168.1.254

           配置PC2的IP地址为192.168.2.1,网关为192.168.2.254

      3)router1上配置接口IP

           R1(config)#interface fastEthernet 0/0

           R1(config-if)#ip address 192.168.1.254 255.255.255.0

           R1(config-if)#no shutdown

           R1(config-if)#exit

           R1(config)#interface fastEthernet 0/1

           R1(config-if)#ip address 192.168.2.1 255.255.255.0

           R1(config-if)#no shutdown

      4)router2上配置接口IP

           R2(config)#interface fastEthernet 0/1

           R2(config-if)#ip address 192.168.2.2 255.255.255.0

           R2(config-if)#no shutdown

           R2config-if)#exit

           R2(config)#interface fastEthernet 0/0

           R2(config-if)#ip address 192.168.3.254 255.255.255.0

           R2(config-if)#no shutdown

    5)在router1上添加静态路由并产看路由表

           R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2

           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

          C    192.168.2.0/24 is directly connected, FastEthernet0/1

          S    192.168.3.0/24 [1/0] via 192.168.2.2

     6)在router2上添加静态路由并查看路由表

          R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1

          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 

          S    192.168.1.0/24 [1/0] via 192.168.2.1                     //S表示静态路由

          C    192.168.2.0/24 is directly connected, FastEthernet0/1

          C    192.168.3.0/24 is directly connected, FastEthernet0/0

     7)测试网络连通性,在pc1上ping192.168.3.1

          PC>ping 192.168.3.1


          Pinging 192.168.3.1 with 32 bytes of data:


 

          Reply from 192.168.3.1: bytes=32 time=1ms TTL=126

          Reply from 192.168.3.1: bytes=32 time=11ms TTL=126

          Reply from 192.168.3.1: bytes=32 time=10ms TTL=126

          Reply from 192.168.3.1: bytes=32 time=11ms TTL=126


 

          Ping statistics for 192.168.3.1:

                    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss

2. 配置静态路由是吸纳三个不同网络的连通性

   1)搭建网络拓扑结构

             wKiom1PnUtSRPzQpAAFPaT6zMIM944.jpg

    2)配置pc1的IP地址192.168.1.1,网关为192.168.1.254

         配置PC2的IP地址192.168.4.1,网关为192.168.4.254

   3)在router1上配置接口IP

R1(config)#interface fastEthernet 0/0

R1(config-if)#ip address 192.168.1.254 255.255.255.0

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)#interface fastEthernet 0/1

R1(config-if)#ip address 192.168.2.1 255.255.255.0

R1(config-if)#no shutdown

   4)在router2上配置接口IP

R2(config)#interface f0/1

R2(config-if)#ip address 192.168.2.2 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#exit

R2(config)#interface fastEthernet 0/0

R2(config-if)#ip address 192.168.3.1 255.255.255.0

R2(config-if)#no shutdown

   5)在router3上配置接口IP

R3(config)#interface fastEthernet 0/1

R3(config-if)#ip address 192.168.3.2 255.255.255.0

R3(config-if)#no shutdown

R3(config-if)#exit

R3(config)#interface fastEthernet 0/0

R3(config-if)#ip address 192.168.4.254 255.255.255.0

R3(config-if)#no shutdown

   6)在router1、router2、router3上分别添加静态路由

R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2

R1(config)#ip route 192.168.4.0 255.255.255.0 192.168.2.2


 

R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1

R2(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2


 

R3(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1

R3(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1

   7)在router1上查看路由表

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

C    192.168.2.0/24 is directly connected, FastEthernet0/1

S    192.168.3.0/24 [1/0] via 192.168.2.2    //静态路由

S    192.168.4.0/24 [1/0] via 192.168.2.2    //静态路由

   8)在router2上查看路由表

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


 

S    192.168.1.0/24 [1/0] via 192.168.2.1    //静态路由

C    192.168.2.0/24 is directly connected, FastEthernet0/1

C    192.168.3.0/24 is directly connected, FastEthernet0/0

S    192.168.4.0/24 [1/0] via 192.168.3.2    //静态路由

   9)在router3上查看路由表

R3#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.1    //静态路由

S    192.168.2.0/24 [1/0] via 192.168.3.1    //静态路由

C    192.168.3.0/24 is directly connected, FastEthernet0/1

C    192.168.4.0/24 is directly connected, FastEthernet0/0

    10)测试网络连通性,在PC1 ping 192.168.2.2、

                                                       192.168.3.1、

                                                       192.168.3.2、

                                                       192.168.4.1

PC>ping 192.168.2.2                                                     //ping 192.168.2.2


 

Pinging 192.168.2.2 with 32 bytes of data:


 

Reply from 192.168.2.2: bytes=32 time=0ms TTL=254

Reply from 192.168.2.2: bytes=32 time=0ms TTL=254

Reply from 192.168.2.2: bytes=32 time=0ms TTL=254

Reply from 192.168.2.2: bytes=32 time=0ms TTL=254


 

Ping statistics for 192.168.2.2:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),



 

PC>ping 192.168.3.1                                                     //ping 192.168.3.1


 

Pinging 192.168.3.1 with 32 bytes of data:


 

Reply from 192.168.3.1: bytes=32 time=0ms TTL=254

Reply from 192.168.3.1: bytes=32 time=3ms TTL=254

Reply from 192.168.3.1: bytes=32 time=0ms TTL=254

Reply from 192.168.3.1: bytes=32 time=0ms TTL=254


 

Ping statistics for 192.168.3.1:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),



 

PC>ping 192.168.3.2                                                     //ping 192.168.3.2


 

Pinging 192.168.3.2 with 32 bytes of data:


 

Reply from 192.168.3.2: bytes=32 time=0ms TTL=253

Reply from 192.168.3.2: bytes=32 time=12ms TTL=253

Reply from 192.168.3.2: bytes=32 time=0ms TTL=253

Reply from 192.168.3.2: bytes=32 time=12ms TTL=253


 

Ping statistics for 192.168.3.2:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),



 

PC>ping 192.168.4.                                                       //ping 192.168.4.1


 

Pinging 192.168.4.1 with 32 bytes of data:


 

Reply from 192.168.4.1: bytes=32 time=0ms TTL=125

Reply from 192.168.4.1: bytes=32 time=10ms TTL=125

Reply from 192.168.4.1: bytes=32 time=0ms TTL=125

Reply from 192.168.4.1: bytes=32 time=22ms TTL=125


 

Ping statistics for 192.168.4.1:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

3,注:本实验采用思科模拟器-- Cisco Packet Tracer 6.0


本文出自 “梦醒” 博客,转载请与作者联系!

你可能感兴趣的:(interface,IP地址,Address)