基于源地址策略路由

实验2:基于源地址策略路由
 
 
 
 
R6(config)#in e0
R6(config-if)#ip add 10.1.1.254 255.255.255.0
R6(config-if)#ip add 10.1.1.2 255.255.255.0 secondary   在e0下定义一个辅助IP地址,用于模拟教师机IP。
R6(config-if)#ip add 10.1.1.3 255.255.255.0 sec         
 
R6(config)#access-list 1 permit 10.1.1.2 0.0.0.0   定义一个标准访问列表1,指定源地址为教师机。
R6(config)#access-list 2 permit 10.1.1.3 0.0.0.0  
R6(config)#route-map network1 permit 123
R6(config-route-map)#match ip address 1   当IP地址符合访问列表1中定义的源地址时,进行策略路由。
R6(config-route-map)#set ip next-hop 192.186.12.7
R6(config-route-map)#exit
R6(config)#route-map network1 permit 126
R6(config-route-map)#match ip address 2
R6(config-route-map)#set ip next-hop 192.138.21.7
R6(config-route-map)#int e0
R6(config-if)#ip policy route-map network1
R6(config-if)#exit
R6(config)#ip local policy route-map network1
R6#debug ip policy
Policy routing debugging is on
R6#ping                    扩展ping
Protocol [ip]:            默认协议IP协议
Target IP address: 7.7.7.7    目的地地址
Repeat count [5]:         发送ping的数据包数量,默认5个。
Datagram size [100]:      ping的数据包的大小,单位字节。
Timeout in seconds [2]:   延迟2秒。
Extended commands [n]: y   是否使用扩展ping命令,输入 y ,下面就会让你输入源地址。
Source address or interface: 10.1.1.3
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 7.7.7.7, timeout is 2 seconds:
Packet sent with a source address of 10.1.1.3
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 44/44/44 ms
R6#
07:32:13: IP: s=10.1.1.3 (local), d=7.7.7.7, len 100, policy match
07:32:13: IP: route map network1, item 126, permit
07:32:13: IP: s=10.1.1.3 (local), d=7.7.7.7 (Serial1), len 100, policy routed
07:32:13: IP: local to Serial1 192.138.21.7
07:32:13: IP: s=10.1.1.3 (local), d=7.7.7.7, len 100, policy match
07:32:13: IP: route map network1, item 126, permit
07:32:13: IP: s=10.1.1.3 (local), d=7.7.7.7 (Serial1), len 100, policy routed
07:32:13: IP: local to Serial1 192.138.21.7
07:32:13: IP: s=10.1.1.3 (local), d=7.7.7.7, len 100, policy match
07:32:13: IP: route map network1, item 126, permit
07:32:13: IP: s=10.1.1.3 (local), d=7.7.7.7 (Serial1), len 100, policy routed
R6#
07:32:13: IP: local to Serial1 192.138.21.7
07:32:13: IP: s=10.1.1.3 (local), d=7.7.7.7, len 100, policy match
07:32:13: IP: route map network1, item 126, permit
07:32:13: IP: s=10.1.1.3 (local), d=7.7.7.7 (Serial1), len 100, policy routed
07:32:13: IP: local to Serial1 192.138.21.7
07:32:13: IP: s=10.1.1.3 (local), d=7.7.7.7, len 100, policy match
07:32:13: IP: route map network1, item 126, permit
07:32:13: IP: s=10.1.1.3 (local), d=7.7.7.7 (Serial1), len 100, policy routed
07:32:13: IP: local to Serial1 192.138.21.7
07:32:18: IP: s=0.0.0.0 (Ethernet0), d=255.255.255.255, len 328, policy rejected
 -- normal forwarding
07:32:55: IP: s=0.0.0.0 (Ethernet0), d=255.255.255.255, len 328, policy rejected
 -- normal forwarding

你可能感兴趣的:(职场,休闲,基于源地址策略路由)