eNSP-GRE简单配置

 

目录

IP配置

公网全网通

配置隧道

路由配置

检测


1、按照图示配置 |P 地址

IP配置

配置主机IP地址:

PC1:

PC2:

R1:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
Mar 28 2024 13:47:45-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R1-GigabitEthernet0/0/0]q
[R1]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 100.1.1.1 24
Mar 28 2024 13:48:14-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R1-GigabitEthernet0/0/1]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.1.1/24       up         up        
GigabitEthernet0/0/1              100.1.1.1/24         up         up        
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
[R1-GigabitEthernet0/0/1]

R2:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.	
[Huawei]sysname R2
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 100.1.1.2 24
[R2-GigabitEthernet0/0/0]
Mar 28 2024 13:49:46-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2-GigabitEthernet0/0/0]q
[R2]int g 0/0/1
[R2-GigabitEthernet0/0/1]ip add 100.2.2.2 24
Mar 28 2024 13:54:58-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R2-GigabitEthernet0/0/1]q
[R2]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              100.1.1.2/24         up         up        
GigabitEthernet0/0/1              100.2.2.2/24         up         up        
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
[R2]

R3:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.	
[Huawei]sysname R3
[R3]
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add 100.2.2.3 24
Mar 28 2024 13:59:12-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R3-GigabitEthernet0/0/0]q
[R3]int g 0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.2.1 24
Mar 28 2024 13:59:34-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R3-GigabitEthernet0/0/1]q
[R3]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              100.2.2.3/24         up         up        
GigabitEthernet0/0/1              192.168.2.1/24       up         up        
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
[R3]



2、在 R1 和 R3 上配置默认路由使公网区域互通

公网全网通

在R1和R3上配置缺省路由:

R1:

[R1]ip route-static 0.0.0.0 0 100.1.1.2
[R1]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 11       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   Static  60   0          RD   100.1.1.2       GigabitEthernet
0/0/1
      100.1.1.0/24  Direct  0    0           D   100.1.1.1       GigabitEthernet
0/0/1
      100.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
    100.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.1.0/24  Direct  0    0           D   192.168.1.1     GigabitEthernet
0/0/0
    192.168.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
  192.168.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R1]

R2:

[R3]ip route-static 0.0.0.0 0 100.2.2.2
[R3]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 11       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   Static  60   0          RD   100.2.2.2       GigabitEthernet
0/0/0
      100.2.2.0/24  Direct  0    0           D   100.2.2.3       GigabitEthernet
0/0/0
      100.2.2.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
    100.2.2.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.2.0/24  Direct  0    0           D   192.168.2.1     GigabitEthernet
0/0/1
    192.168.2.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
  192.168.2.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R3]

测试:


3、在 R1 和 R3 上配置 GREVPN,使两端私网能够互相访问,Tunnel口IP 地址如图

配置隧道

R1:

[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 192.168.3.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]source 100.1.1.1
[R1-Tunnel0/0/0]destination 100.2.2.3
Mar 28 2024 14:31:28-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[R1-Tunnel0/0/0]q
[R1]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.1.1/24       up         up        
GigabitEthernet0/0/1              100.1.1.1/24         up         up        
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Tunnel0/0/0                       192.168.3.1/24       up         up        
[R1]

R3:

 

[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip add 192.168.3.3 24
[R3-Tunnel0/0/0]tunnel-protocol gre
[R3-Tunnel0/0/0]source 100.2.2.3
[R3-Tunnel0/0/0]destination 100.1.1.1
Mar 28 2024 14:34:29-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[R3-Tunnel0/0/0]
[R3-Tunnel0/0/0]q
[R3]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              100.2.2.3/24         up         up        
GigabitEthernet0/0/1              192.168.2.1/24       up         up        
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Tunnel0/0/0                       192.168.3.3/24       up         up        
[R3]

4、在 R1 和 R3 上配置 RIPv2 或者 ospf或者静态,来传递两端私网路由 

路由配置

这里直接使用ospf:

R1:

[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]

R2:ca

[R3]ospf 1 router-id 2.2.2.2
[R3-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
Mar 28 2024 14:40:07-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[1]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.3.168.192, Neighb
orEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init) 
[R3-ospf-1-area-0.0.0.0]
Mar 28 2024 14:40:07-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.3.168.192, Neighb
orEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=ExStart) 
[R3-ospf-1-area-0.0.0.0]
Mar 28 2024 14:40:07-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.3.168.192, Neighb
orEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exc
hange) 
[R3-ospf-1-area-0.0.0.0]
Mar 28 2024 14:40:07-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.3.168.192, Neighb
orEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loadi
ng) 
[R3-ospf-1-area-0.0.0.0]
Mar 28 2024 14:40:07-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.3.168.192, Neighb
orEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full) 
[R3-ospf-1-area-0.0.0.0]

查看路由表:

R1:

[R1]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 1        Routes : 1        

OSPF routing table status : <Active>
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.2.0/24  OSPF    10   1563        D   192.168.3.3     Tunnel0/0/0

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0

[R1]

 R3:

[R3-ospf-1-area-0.0.0.0]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 1        Routes : 1        

OSPF routing table status : <Active>
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.0/24  OSPF    10   1563        D   192.168.3.1     Tunnel0/0/0

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0

[R3-ospf-1-area-0.0.0.0]

检测

完成配置,使用RIP同理。而静态这需要全部手动配置路由。 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值