wKiom1jVvsniOWdUAAAhk4cMDRw612.png-wh_50

  实验要求:

1.R1和R3上添加默认路由,R2先不添加静态.在R1上分别以Fa0/0和Lo0接口为源ping R3;观察现象,思考原因.

2.在R2上启用uRPF;

3.在R1上用 Lo0接口为源ping R3,测试连通性, 分析与1的现象的不同. 思考uRPF的工作原理.

4.在R2上添加一条默认路由,指向R1,测试连通性, 如果希望ping通,应当如何解决。思考uRPF与默认路由的关系.

5.思考uRPF的严格模式和宽松模式。

  其他:

1.CEF与uRPF

2.启用uRPF的情况下,怎样ping 自己?

3.对某写流量不做uRPF, 如何做?

#############################################

基本配置:

R1的配置

R1(config)#int f0/0

R1(config-if)#ip add 12.1.1.1 255.255.255.0

R1(config-if)#no sh

R1(config)#int lo 0

R1(config-if)#ip add 1.1.1.1 255.255.255.0

R2的配置

R2(config)#int f0/0

R2(config-if)#ip add 12.1.1.2 255.255.255.0

R2(config-if)#no sh

R2(config)#int s1/0

R2(config-if)#ip add 23.1.1.2 255.255.255.0

R2(config-if)#no sh

R3的配置

R3(config)#int s1/0

R3(config-if)#ip add 23.1.1.3 255.255.255.0

R3(config-if)#no sh

实验一:

R1(config)#ip route 0.0.0.0 0.0.0.0 12.1.1.2 // 以太网口默认路由写下一跳

R3(config)#ip route 0.0.0.0 0.0.0.0 s1/0  // 串口无所谓

实验现象:

R1#ping 23.1.1.3

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 23.1.1.3, timeout is 2 seconds:

.!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 52/59/68 ms

R1#ping 23.1.1.3 so lo 0

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 23.1.1.3, timeout is 2 seconds:

Packet sent with a source address of 1.1.1.1 

.....

Success rate is 0 percent (0/5)

pingR3的包,如果源是12.1.1.1,R2能到达;如果源是1.1.1.1,回包的时候R2没有条目不能到达

实验二:

R2(config)#ip cef  // 必须开启;默认开启

R2(config)#int f0/0

R2(config-if)#ip verify unicast source reachable-via any // 启用uRPF松散模式

这时候pingR3的包现象同上,但是去R3的包因为R2没有条目而直接丢弃

  • 严格uRPF:要求入口跟去往源的出口是同一个

  • 松散uRPF:不要求接口一致,只要求路由器有去往源的路由即可

实验四:

R2(config)#int f0/0

R2(config-if)#ip verify unicast source reachable-via any // 启用uRPF松散模式

R1#ping 23.1.1.3 so lo 0

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 23.1.1.3, timeout is 2 seconds:

Packet sent with a source address of 1.1.1.1 

.....

Success rate is 0 percent (0/5)

R2(config-if)#ip verify unicast source reachable-via any allow-default // 默认不会通过默认路由检查

R1#ping 23.1.1.3 so lo 0

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 23.1.1.3, timeout is 2 seconds:

Packet sent with a source address of 1.1.1.1 

.!!!!

Success rate is 0 percent (0/5)

其他:
R2(config-if)#ip verify unicast source reachable-via any allow-default 

R2#ping 12.1.1.2 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:

.....

Success rate is 0 percent (0/5)

R2(config-if)#ip verify unicast source reachable-via any allow-default allow-self-ping

R2#ping 12.1.1.2 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:

!!!!!

Success rate is 0 percent (0/5)

 //启用uRPF后ping自己默认是不通的,除非+allow-self-ping