IP相关问题3 --- MGRE基础实验

 

1.配置ip (先配置R2)

1.R1配置ip

[r1]interface GigabitEthernet 0/0/0

[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
Aug  4 2023 19:16:20-08:00 r1 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r1-GigabitEthernet0/0/0]q
[r1]interface Serial 4/0/0
[r1-Serial4/0/0]ip add 14.1.1.1 24

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.1.1/24       up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Serial4/0/0                       14.1.1.1/24          up         down      
Serial4/0/1                       unassigned           down       down  

[r1]interface Serial 4/0/0
[r1-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y

[r1-Serial4/0/0]q
[r1]display ip interface brief 

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.1.1/24       up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Serial4/0/0                       14.1.1.1/24          up         up        
Serial4/0/1                       unassigned           down       down  

2.R2配置ip

[ISP]interface s3/0/0
[ISP-Serial3/0/0]ip add 34.1.1.2 24
Aug  4 2023 19:39:34-08:00 ISP %%01PPP/4/PEERNOPAP(l)[17]:On the interface Seria
l4/0/1, authentication failed and PPP link was closed because PAP was disabled o
n the peer. 
[ISP-Serial3/0/0]ip add 34.1.1.2 24
Aug  4 2023 19:39:34-08:00 ISP %%01PPP/4/RESULTERR(l)[18]:On the interface Seria
l4/0/1, LCP negotiation failed because the result cannot be accepted. 
[ISP-Serial3/0/0]ppp authentication-mode chap
[ISP-Serial3/0/0]shutdown 
Aug  4 2023 19:39:55-08:00 ISP %%01PPP/4/PHYSICALDOWN(l)[19]:On the interface Se
rial3/0/0, PPP link was closed because the status of the physical layer was Down
.	
[ISP-Serial3/0/0]undo shutdown 
[ISP-Serial3/0/0]display ip interface brief 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              unassigned           down       down      
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         4.4.4.4/24           up         up(s)     
NULL0                             unassigned           up         up(s)     
Serial3/0/0                       34.1.1.2/24          up         down      
Serial3/0/1                       unassigned           down       down      
Serial4/0/0                       14.1.1.2/24          up         down      
Serial4/0/1                       24.1.1.2/24          up         down      

3.R3配置ip

[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.2.1 24
Aug  4 2023 19:57:01-08:00 r3 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r3-GigabitEthernet0/0/0]q
[r3]interface Serial 4/0/0
[r3-Serial4/0/0]ip address 24.1.1.1 24
[r3-Serial4/0/0]q
[r3]display ip interface brief 

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.2.1/24       up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Serial4/0/0                       24.1.1.1/24          up         down      
Serial4/0/1                       unassigned           down       down 

[r3]interface Serial 4/0/0
[r3-Serial4/0/0]ppp pap local-user a password 123456
Aug  4 2023 20:02:08-08:00 r3 %%01IFNET/4/LINK_STATE(l)[25]:The line protocol PP
P on the interface Serial4/0/0 has entered the UP state. 
[r3-Serial4/0/0]ppp pap local-user a password cipher 123456

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.2.1/24       up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Serial4/0/0                       24.1.1.1/24          up         up        
Serial4/0/1                       unassigned           down       down 

     

4.配置R4ip

[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.3.1 24
Aug  4 2023 20:07:30-08:00 r4 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 

[r4-Serial4/0/0]ppp chap user b
[r4-Serial4/0/0]ppp chap password cipher  123456
[r4-Serial4/0/0]ping 34.1.1.2
  PING 34.1.1.2: 56  data bytes, press CTRL_C to break
    Request time out
    Reply from 34.1.1.2: bytes=56 Sequence=3 ttl=255 time=60 ms
    Reply from 34.1.1.2: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 34.1.1.2: bytes=56 Sequence=5 ttl=255 time=30 ms

2.配置路由

1.R1路由

<r1>system-view 
Enter system view, return user view with Ctrl+Z.
[r1]ip route-static 0.0.0.0 0 14.1.1.2

2.R2路由

<r3>system-view 
Enter system view, return user view with Ctrl+Z.
[r3]ip route-static 0.0.0.0 0 24.1.1.2

3.R3路由

<r4>system-view 
Enter system view, return user view with Ctrl+Z.
[r4]ip route-static 0.0.0.0 0 34.1.1.2

4.检验是否联通

[r1]ping 24.1.1.1
  PING 24.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 24.1.1.1: bytes=56 Sequence=1 ttl=254 time=40 ms
    Reply from 24.1.1.1: bytes=56 Sequence=2 ttl=254 time=40 ms
    Reply from 24.1.1.1: bytes=56 Sequence=3 ttl=254 time=30 ms
    Reply from 24.1.1.1: bytes=56 Sequence=4 ttl=254 time=20 ms
    Reply from 24.1.1.1: bytes=56 Sequence=5 ttl=254 time=30 ms

  --- 24.1.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/32/40 ms

[r1]ping 34.1.1.1
  PING 34.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 34.1.1.1: bytes=56 Sequence=1 ttl=254 time=160 ms
    Reply from 34.1.1.1: bytes=56 Sequence=2 ttl=254 time=180 ms
    Reply from 34.1.1.1: bytes=56 Sequence=3 ttl=254 time=120 ms
    Reply from 34.1.1.1: bytes=56 Sequence=4 ttl=254 time=90 ms
    Reply from 34.1.1.1: bytes=56 Sequence=5 ttl=254 time=60 ms

  --- 34.1.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 60/122/180 ms

[r1]ping 4.4.4.4
  PING 4.4.4.4: 56  data bytes, press CTRL_C to break
    Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=255 time=30 ms
    Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=255 time=40 ms
    Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 4.4.4.4 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/28/40 ms

3.构建MGRE环境

1.R1的配置

[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip add 192.168.4.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r1-Tunnel0/0/0]source 14.1.1.1
Aug  4 2023 20:46:18-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r1-Tunnel0/0/0]nhrp entry multicast dynamic 
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]display this

[V200R003C00]
#
interface Tunnel0/0/0
 ip address 192.168.4.1 255.255.255.0 
 tunnel-protocol gre p2mp
 source 14.1.1.1
 nhrp entry multicast dynamic
 nhrp network-id 100
#
return
[r1-Tunnel0/0/0]
[r1-Tunnel0/0/0]q
[r1]dis	
[r1]display  nh	
[r1]display  nhrp peer all

Number of nhrp peers: 0
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip add 192.168.4.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r1-Tunnel0/0/0]source 14.1.1.1
Aug  4 2023 20:46:18-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r1-Tunnel0/0/0]nhrp entry multicast dynamic 
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]display this

[V200R003C00]
#
interface Tunnel0/0/0
 ip address 192.168.4.1 255.255.255.0 
 tunnel-protocol gre p2mp
 source 14.1.1.1
 nhrp entry multicast dynamic
 nhrp network-id 100
#
return

[r1-Tunnel0/0/0]q

<r1>system-view 
Enter system view, return user view with Ctrl+Z.
[r1]display  nhrp peer all
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
192.168.4.2     32    24.1.1.1        192.168.4.2     dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:01:14
Expire time     : 01:58:46

Number of nhrp peers: 1
[r1]

  Please check whether system data has been changed, and save data in time

  Configuration console time out, please press any key to log on

<r1>sys	
<r1>system-view 
Enter system view, return user view with Ctrl+Z.
[r1]display nhrp peer all
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
192.168.4.2     32    24.1.1.1        192.168.4.2     dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:10:23
Expire time     : 01:49:37
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
192.168.4.3     32    34.1.1.1        192.168.4.3     dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:00:12
Expire time     : 01:59:48

Number of nhrp peers: 2

2.R3的配置

[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip add 192.168.4.2 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r3-Tunnel0/0/0]source Serial 4/0/0
Aug  4 2023 20:56:48-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]nhrp entry 192.168.4.1 14.1.1 register 

  Please check whether system data has been changed, and save data in time

  Configuration console time out, please press any key to log on

<r3>system-view 
Enter system view, return user view with Ctrl+Z.
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]nhrp entry 192.168.4.1 14.1.1.1 register 
[r3-Tunnel0/0/0]display nhrp peer all
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
192.168.4.1     32    14.1.1.1        192.168.4.1     static       hub          
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:00:52
Expire time     : --

Number of nhrp peers: 1

[r3-Tunnel0/0/0]q
[r3]interface  Tunnel 0/0/0	
[r3-Tunnel0/0/0]display this
[V200R003C00]
#
interface Tunnel0/0/0
 ip address 192.168.4.2 255.255.255.0 
 tunnel-protocol gre p2mp
 source Serial4/0/0
 nhrp entry 192.168.4.1 14.1.1.1 register
#
return

3.R4的配置

<r4>system-view 
Enter system view, return user view with Ctrl+Z.
[r4]ip route-static 0.0.0.0 0 34.1.1.2
[r4]

  Please check whether system data has been changed, and save data in time

  Configuration console time out, please press any key to log on

<r4>system-view 
Enter system view, return user view with Ctrl+Z.
[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]ip add 192.168.4.3 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r4-Tunnel0/0/0]source s4/0/0
Aug  4 2023 21:12:00-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r4-Tunnel0/0/0]nhrp entry 192.168.4.1 14.1.1 register 
[r4-Tunnel0/0/0]display nhrp peer all
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
192.168.4.1     32    0.0.0.0         192.168.4.1     static       hub          
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:01:29
Expire time     : --

Number of nhrp peers: 1

4.检验是否联通

[r3]ping 192.168.4.2
  PING 192.168.4.2: 56  data bytes, press CTRL_C to break
    Reply from 192.168.4.2: bytes=56 Sequence=1 ttl=255 time=20 ms
    Reply from 192.168.4.2: bytes=56 Sequence=2 ttl=255 time=1 ms
    Reply from 192.168.4.2: bytes=56 Sequence=3 ttl=255 time=1 ms
    Reply from 192.168.4.2: bytes=56 Sequence=4 ttl=255 time=1 ms
    Reply from 192.168.4.2: bytes=56 Sequence=5 ttl=255 time=1 ms

  --- 192.168.4.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 1/4/20 ms

[r3]ping 192.168.4.3
  PING 192.168.4.3: 56  data bytes, press CTRL_C to break
    Reply from 192.168.4.3: bytes=56 Sequence=1 ttl=254 time=60 ms
    Reply from 192.168.4.3: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 192.168.4.3: bytes=56 Sequence=3 ttl=255 time=40 ms
    Reply from 192.168.4.3: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 192.168.4.3: bytes=56 Sequence=5 ttl=255 time=40 ms

  --- 192.168.4.3 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/38/60 ms

4.使用rip获取路由

1.R1的配置

<r1>system-view 
Enter system view, return user view with Ctrl+Z.
[r1]rip 1
[r1-rip-1]ver 2
[r1-rip-1]network 192.168.1.0	
[r1-rip-1]network 192.168.4.0

2.R3的配置

<r3>system-view 
Enter system view, return user view with Ctrl+Z.
[r3]rip 1
[r3-rip-1]vers 2
[r3-rip-1]network 192.168.4.0
[r3-rip-1]network 192.168.2.0

3.R4的配置

<r4>system-view 
Enter system view, return user view with Ctrl+Z.
[r4]rip 1
[r4-rip-1]vers 2
[r4-rip-1]network 192.168.4.0
[r4-rip-1]network 192.168.3.0

4.查看rip路由情况

1.R1的rip

<r1>system-view 
Enter system view, return user view with Ctrl+Z.	
[r1]display ip routing-table protocol rip
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
         Destinations : 2        Routes : 2        

RIP routing table status : <Active>
         Destinations : 2        Routes : 2

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.2.0/24  RIP     100  1           D   192.168.4.2     Tunnel0/0/0
    192.168.3.0/24  RIP     100  1           D   192.168.4.3     Tunnel0/0/0

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

2.R3的rip

<r3>system-view 
Enter system view, return user view with Ctrl+Z.
[r3]display ip routing-table protocol rip
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
         Destinations : 1        Routes : 1        

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

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.0/24  RIP     100  1           D   192.168.4.1     Tunnel0/0/0

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

3.R4的rip

[r4]display ip routing-table protocol rip
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
         Destinations : 1        Routes : 1        

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

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.0/24  RIP     100  1           D   192.168.4.1     Tunnel0/0/0

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

5.R1关闭水平分割

[r1]interface Tunnel 0/0/00
[r1-Tunnel0/0/0]undo rip split-horizon 

6.查看是否成功

<r4>system-view 
Enter system view, return user view with Ctrl+Z.
[r4]display ip routing-table protocol rip
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
         Destinations : 2        Routes : 2        

RIP routing table status : <Active>
         Destinations : 2        Routes : 2

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.0/24  RIP     100  1           D   192.168.4.1     Tunnel0/0/0
    192.168.2.0/24  RIP     100  2           D   192.168.4.1     Tunnel0/0/0

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

5.验证是否成功 

<r1>system-view 
Enter system view, return user view with Ctrl+Z.
[r1]ping -a 192.168.1.1 192.168.2.1
  PING 192.168.2.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.2.1: bytes=56 Sequence=1 ttl=255 time=20 ms
    Reply from 192.168.2.1: bytes=56 Sequence=2 ttl=255 time=30 ms
    Reply from 192.168.2.1: bytes=56 Sequence=3 ttl=255 time=30 ms
    Reply from 192.168.2.1: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 192.168.2.1: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 192.168.2.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/26/30 ms
<r3>system-view 
Enter system view, return user view with Ctrl+Z.
[r3]ping -a 192.168.2.1 192.168.3.1
  PING 192.168.3.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.3.1: bytes=56 Sequence=1 ttl=254 time=40 ms
    Reply from 192.168.3.1: bytes=56 Sequence=2 ttl=254 time=50 ms
    Reply from 192.168.3.1: bytes=56 Sequence=3 ttl=254 time=40 ms
    Reply from 192.168.3.1: bytes=56 Sequence=4 ttl=254 time=50 ms
    Reply from 192.168.3.1: bytes=56 Sequence=5 ttl=254 time=50 ms

  --- 192.168.3.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/46/50 ms

6.使PC端可以访问R2

1.配置PC1可访问R2

<r1>system-view 
Enter system view, return user view with Ctrl+Z.
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r1-acl-basic-2000]q
[r1]interface s4/0/0
[r1-Serial4/0/0]nat outbound  2000

2.配置PC2可访问R2

<r3>system-view 
Enter system view, return user view with Ctrl+Z.
[r3]acl 2000
[r3-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[r3-acl-basic-2000]q
[r3]interface s4/0/0
[r3-Serial4/0/0]nat outbound 2000

3.配置PC3可访问R2

<r4>system-view 
Enter system view, return user view with Ctrl+Z.
[r4]acl 2000
[r4-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[r4-acl-basic-2000]q
[r4]interface s4/0/0
[r4-Serial4/0/0]nat outbound 2000

4.检验是否成功

1.PC1可访问R2

2.PC2可访问R2

 2.PC3可访问R2

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值