哪位高手能不能帮一下我设置一下静态路由

2024-12-12 00:07:05
推荐回答(2个)
回答1:

从CCNA实验手册里截一段给你……

步骤一、基本配置

Router>

Router>enable

Router#config terminal

Router(config)#hostname R1

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的配置:

R1(config)#interface s0

R1(config-if)#ip address 30.1.1.1 255.255.255.0

R1(config-if)#clock rate 64000     时钟速率端

R1(config-if)#no shutdown

R1(config-if)#interface loopback 0

R1(config-if)#ip address 10.1.1.1 255.255.255.0

R1(config-if)#

R2的配置:

Router(config)#hostname R2

R2(config)#interface s1

R2(config-if)#ip address 30.1.1.2 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#interface loopback 0

R2(config-if)#ip address 20.1.1.1 255.255.255.0

R2(config-if)#exit

R2(config)#

步骤三、指定静态路由

R1(config)#

R1(config)#ip route 20.1.1.0 255.255.255.0 serial 0   指定静态路由

R2(config)#

R2(config)#ip route 10.1.1.0 255.255.255.0 30.1.1.1   指定静态路由

步骤四、作ping 测试

R1#ping

Protocol [ip]:

Target IP address: 20.1.1.1           目的地址

Extended commands [n]: y           是否用扩展命令

Source address or interface: 10.1.1.1   源地址

!!!!!             显示已通

步骤五、显示静态路由条目

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

     20.0.0.0/24 is subnetted, 1 subnets

S       20.1.1.0 is directly connected, Serial0        静态路由条目

     10.0.0.0/24 is subnetted, 1 subnets

C       10.1.1.0 is directly connected, Loopback0

     30.0.0.0/24 is subnetted, 1 subnets

C       30.1.1.0 is directly connected, Serial0

步骤六、显示当前配置

R1的配置结果:

R1#show running-config

!

hostname R1

!

no ip domain-lookup

!

interface Loopback0

 ip address 10.1.1.1 255.255.255.0

!

interface Serial0

 ip address 30.1.1.1 255.255.255.0

 clockrate 64000

!

ip route 20.1.1.0 255.255.255.0 Serial0

!

line con 0

 exec-timeout 0 0

 logging synchronous

 transport input none

end

R2的配置结果:

R2#show running-config

!

hostname R2

!

no ip domain-lookup

!

interface Loopback0

 ip address 20.1.1.1 255.255.255.0

!

interface Serial1

 ip address 30.1.1.2 255.255.255.0

!

ip route 10.1.1.0 255.255.255.0 30.1.1.1

!

line con 0

 exec-timeout 0 0

 logging synchronous

!

end

这是俩路由的,三个路由类似,有问题加我QQ吧……

235918624

回答2:

第一步:
R1的基本配置
Router>enable
Router#config t
Router(config)#hostname R1 连接到R2的se0/0/0
R1(config)#interface fa0/0 连接到PC0
R1(config-if)#ip address 172.16.10.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#interfac se0/0/0
R1(config-if)#ip address 172.16.40.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#clock rate 2000000
fa0/0连接PC0 PC0与路由器中间可以加一个交换机
PC0的配置:
IP Address......................: 172.16.10.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 172.16.10.1
R1的路由配置:
R1(config)#ip route 172.16.20.0 255.255.255.0 172.16.40.2
R1(config)#ip route 172.16.30.0 255.255.255.0 172.16.40.2
R1(config)#ip route 172.16.50.0 255.255.255.0 172.16.40.2
第二步:
R2的基本配置:
Router>enable
Router#config t
Router(config)#hostname R2
R2(config)#interface se0/0/0 连接到R1的se0/0/0
R2(config-if)#ip address 172.16.40.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface fa0/0 连接到PC1
R2(config-if)#ip address 172.16.20.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface se0/0/1 连接到R3的se0/0/0
R2(config-if)#ip address 172.16.50.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#clock rate 2000000
PC1的配置:
IP Address......................: 172.16.20.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 172.16.20.1
R2的路由配置:
R2(config)#ip route 172.16.10.0 255.255.255.0 172.16.40.1
R2(config)#ip route 172.16.30.0 255.255.255.0 172.16.50.2
第三步:R3的基本配置:
Router>enable
Router#config t
Router(config)#hostname R3
R3(config)#interface se0/0/0 连接到R2的se0/0/1
R3(config-if)#ip address 172.16.50.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#interface fa0/0 连接PC2
R3(config-if)#ip address 172.16.30.1 255.255.255.0
R3(config-if)#no shutdown
PC2配置:
IP Address......................: 172.16.30.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 172.16.30.1
R3的路由配置:
R3(config)#ip route 172.16.10.0 255.255.255.0 172.16.50.1
R3(config)#ip route 172.16.40.0 255.255.255.0 172.16.50.1
R3(config)#ip route 172.16.20.0 255.255.255.0 172.16.50.1
第四步:测试
现在从PC0 ping PC1 and PC2
结果:
PC>ping 172.16.20.2

Pinging 172.16.20.2 with 32 bytes of data:

Reply from 172.16.20.2: bytes=32 time=219ms TTL=126
Reply from 172.16.20.2: bytes=32 time=125ms TTL=126
Reply from 172.16.20.2: bytes=32 time=156ms TTL=126
Reply from 172.16.20.2: bytes=32 time=157ms TTL=126

Ping statistics for 172.16.20.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 125ms, Maximum = 219ms, Average = 164ms

PC>ping 172.16.30.2

Pinging 172.16.30.2 with 32 bytes of data:

Reply from 172.16.30.2: bytes=32 time=156ms TTL=125
Reply from 172.16.30.2: bytes=32 time=187ms TTL=125
Reply from 172.16.30.2: bytes=32 time=187ms TTL=125
Reply from 172.16.30.2: bytes=32 time=174ms TTL=125

Ping statistics for 172.16.30.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 156ms, Maximum = 187ms, Average = 176ms

如果还有啥子问题加我:296773107