接口借用其它接口IP地址目的:
有些组网环境中,由于IP地址缺乏,想节约IP地址的使用,这时候可以使用借用其他接口IP地址的功能,比如loopback接口的地址。
组网拓扑:
R1的接口Tunnel0/0/1与R3通过隧道相连,R1和R3的接口Tunnel0/0/1不常用,没有配置IP地址,要求借用loopback的地址使R1和R3可以通过隧道互通。
拓扑图
IP地址借用配置步骤:
1、在所有路由器上配置IP和路由
[Huawei]sysname R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 10.1.12.1 24
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 10.1.11.254 24
[R1]int LoopBack 0
[R1-LoopBack0]ip add 1.1.1.1 32
[Huawei]sysname R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 10.1.12.2 24
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 10.1.23.2 24
[R2]int loop 0
[R2-LoopBack0]ip add 2.2.2.2 32
[Huawei]sysname R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 10.1.23.3 24
[R3]int g0/0/2
[R3-GigabitEthernet0/0/2]ip add 10.1.33.254 24
[R3]int LoopBack 0
[R3-LoopBack0]ip add 3.3.3.3 32
2、在R1和R3上配置tunnel接口并配置IP地址借用
[R1]interface Tunnel 0/0/1
[R1-Tunnel0/0/1]tunnel-protocol gre
[R1-Tunnel0/0/1]source 10.1.12.1
[R1-Tunnel0/0/1]destination 10.1.23.3
[R1-Tunnel0/0/1]ip address unnumbered interface LoopBack 0
[R3]int Tunnel 0/0/1
[R3-Tunnel0/0/1]tunnel-protocol gre
[R3-Tunnel0/0/1]source 10.1.23.3
[R3-Tunnel0/0/1]destination 10.1.12.1
[R3-Tunnel0/0/1]ip address unnumbered interface LoopBack 0
3、在R1-R2-R3使用动态路由协议,在R1和R3隧道之间使用静态路由协议。
[R1]ospf
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 10.1.12.1 0.0.0.0
[R2]ospf
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]net 10.1.12.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]net 10.1.23.2 0.0.0.0
[R3]ospf
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]net 10.1.23.3 0.0.0.0
在这里使用OSPF的目的是为了打通R1的接口和R3接口的连通性,因为如果不通的话tunnel接口不能up起来
在R1和R3之间配置静态路由通过隧道端口
[R1]ip route-static 10.1.33.0 24 Tunnel 0/0/1
[R3]ip route-static 10.1.11.0 24 Tunnel 0/0/1
4、测试PC1和PC2
配置PC1的地址为10.1.11.1网关为R1路由器g0/0/2的地址10.1.11.254
配置PC2的地址为10.1.33.1网关为R3路由器g0/0/2的地址10.1.33.254
PC1测试5、查看tunnel接口状态
Tunnel0/0/1 current state : UP
Line protocol current state : UP
Last line protocol up time : 2022-07-25 10:17:23 UTC-08:00
Description:HUAWEI, AR Series, Tunnel0/0/1 Interface
Route Port,The Maximum Transmit Unit is 1500
Internet Address is unnumbered, using address of LoopBack0
Encapsulation is TUNNEL, loopback not set
Tunnel source 10.1.12.1 , destination 10.1.23.3
Tunnel protocol/transport GRE/IP, key disabled
keepalive disabled
Checksumming of packets disabled
Current system time: 2022-07-25 10:23:16-08:00
300 seconds input rate 0 bits/sec, 0 packets/sec
300 seconds output rate 0 bits/sec, 0 packets/sec
0 seconds input rate 0 bits/sec, 0 packets/sec
0 seconds output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes
0 input error
0 packets output, 0 bytes
0 output error
Input bandwidth utilization : --
Output bandwidth utilization : --
tunnle接口已经启动,地址借用的loopback0的地址,配置了源物理地址和目的物理地址。
免责声明:本平台仅供信息发布交流之途,请谨慎判断信息真伪。如遇虚假诈骗信息,请立即举报
举报