Cisco路由配置:路由器缺省路由及相关配置
1proxy arp
代理arp被路由器作为向主机表明自身可用的一种手段,在这个实验里 面,我们将R1和R3仿真成终端主机,当R1需要R3发送报文时(目的为。3),在没有配置默认网关的情况下,R1可以向12.1.1.2发送一个ARP 请求,本地路由器R2收到这个请求后,并且知道如何到达网络3.3.3.0因此路由器将回复以上请求。其中把自己的数据链路标示作为ARP回复报文中的硬 件地址。事实上,路由器欺骗了本地的主机R1,让他认为路由器的接口就是3.3.3.3的接口,最终所有发向3.3.3.3的报文都被送往路由器。
以下实验R2和R3通过OSPF保持连通,而R1仿真为终端,注意R1不可配置环回口,否则默认ARP请求会发向环回口。
R3(config)#interface loopback 0
R3(config-if)#ip address .3 255.255.255.0 secondary
R3(config-if)#ip address .2 255.255.255.0 secondary
R3(config-if)#ip address .1 255.255.255.0 secondary
R3(config-if)#ip address .4 255.255.255.0 secondary
R3(config-if)#ip address .3 255.255.255.0
R3(config-if)#ip ospf network point-to-point
R3(config)#interface serial1
R#(config-if)#ipaddress .3 255.255.255.0
R3(config-if)#router ospf 10
R3(config-router)#router-id .3
R3(config-router)#network .0 255.255.255.255 area 0
R2(config)#interface loopback 0
R2(config-if)#ip address .2 255.255.255.0
R2(config-if)#ip ospf network point-to-point
R2(config-if)#interface serial 1
R2(config-if)#ip address .2 255.255.255.0
R2(config-if)#clockrate 64000
R2(config-if)#no shut
R2(config)#interface ethernet 0
R2(config-if)#ip address 112.1.1.2 255.255.255.0
R2(config-if)#router ospf 10
R2(config-router)#router-id .2
R2(config-router)#network .0 255.255.255.255 area 0
R1(config)#interface ethernet 0
R1(config-if)#ip address 112.1.1.1 255.255.255.0
此时,这种情况下,R1没有R3的路由,R1根本不会去发送ARP请求来解析目的地址,通过以下配置,将R1的路由功能关闭,这个时候R1犹如一个终端主机。
R1(config-if)#no ip routing
此时查看R1的路由表
R1#show ip route
Default gateway is not set
Host Gateway Last Use Total Uses Interface
ICMP redirect cache is empty
R1#traceroute .3
Type escape sequence to abort.
Tracing the route to .3
1 112.1.1.2 4 msec 4 msec 4 msec
2 .3 16 msec 20 msec *
R1 能够到达R3,是因为R1关闭了路由功能后,在没有设置默认的网关的情况下,会对所有不可知的地址,发送广播ARP请求,R2的E0接口收到请求后,查看 路由表是否有。3的对用路由,如有,便用其接受到请求的接口的MAC应答ARP.我们在R1上面同时ping多个地址,验证这一点:
R1分别ping.1 3.3.3.3 3.3.3.4
R1#show arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet .3 4 0010.7b80.4c86 ARPA Ethernet0
Internet .2 0 0010.7b80.4c86 ARPA Ethernet0
Internet .1 0 0010.7b80.4c86 ARPA Ethernet0
Internet .4 0 0010.7b80.4c86 ARPA Ethernet0
Internet 112.1.1.1 - 0030.94e5.ca62 ARPA Ethernet0
Internet 112.1.1.2 4 0010.7b80.4c86 ARPA Ethernet0