一 组网信息

两端ipv4内网地址,通过各自R1、R2设备做NAT转换,然后R1和R2配置ipv4ipv4或者gre隧道实现vpn打通
二 IPV4IPV4设备配置方式
2.1 R1设备配置
hostname R1
!
ip access-list extended 100
10 permit ip any any
!
interface GigabitEthernet 0/0
ip address 202.1.1.1 255.255.255.0
ip nat outside
!
interface GigabitEthernet 0/1
ip address 1.1.1.1 255.255.255.0
ip nat inside
!
interface Tunnel 1
ip address 6.6.6.0 255.255.255.254
tunnel mode ipip
tunnel source 202.1.1.1
tunnel destination 203.1.1.1
!
ip nat inside source list 100 interface GigabitEthernet 0/0 overload
!
ip route 0.0.0.0 0.0.0.0 202.1.1.2
ip route 2.2.2.0 255.255.255.0 Tunnel 1
!
2.2 R2设备配置
hostname R2
!
ip access-list extended 100
10 permit ip any any
!
interface GigabitEthernet 0/0
ip address 203.1.1.1 255.255.255.0
ip nat outside
!
interface GigabitEthernet 0/1
ip address 2.2.2.1 255.255.255.0
ip nat inside
!
interface Tunnel 1
ip address 6.6.6.1 255.255.255.254
tunnel mode ipip
tunnel source 203.1.1.1
tunnel destination 202.1.1.1
!
ip nat inside source list 100 interface GigabitEthernet 0/0 overload
!
ip route 0.0.0.0 0.0.0.0 203.1.1.2
ip route 1.1.1.0 255.255.255.0 Tunnel 1
!
2.3 PC1设备配置
hostname PC1
!
interface GigabitEthernet 0/0
!
interface GigabitEthernet 0/1
ip address 1.1.1.2 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 1.1.1.1
!
2.4 PC2设备配置
hostname PC2
!
interface GigabitEthernet 0/1
ip address 2.2.2.2 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 2.2.2.1
!
2.5 ISP设备配置
hostname ISP
!
interface GigabitEthernet 0/0
ip address 202.1.1.2 255.255.255.0
!
interface GigabitEthernet 0/1
ip address 203.1.1.2 255.255.255.0
!
interface Loopback 0
ip address 8.8.8.8 255.255.255.255
!
三 设备状态查看
3.1 R1设备状态查看
R1#sh ip in b
Interface IP-Address(Pri) IP-Address(Sec) Status Protocol
GigabitEthernet 0/0 202.1.1.1/24 no address up up
GigabitEthernet 0/1 1.1.1.1/24 no address up up
GigabitEthernet 0/2 no address no address up down
GigabitEthernet 0/3 no address no address up down
GigabitEthernet 0/4 no address no address up down
GigabitEthernet 0/5 no address no address up down
GigabitEthernet 0/6 no address no address up down
GigabitEthernet 0/7 no address no address up down
GigabitEthernet 0/8 no address no address up down
Tunnel 1 6.6.6.0/31 no address up up
R1#
R1#sh ip route
Codes: C - Connected, L - Local, S - Static
R - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow route
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
IA - Inter area, EV - BGP EVPN, A - Arp to host
LA - Local aggregate route
* - candidate default
Gateway of last resort is 202.1.1.2 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 202.1.1.2
C 1.1.1.0/24 is directly connected, GigabitEthernet 0/1
C 1.1.1.1/32 is local host.
S 2.2.2.0/24 is directly connected, Tunnel 1
C 6.6.6.0/31 is directly connected, Tunnel 1
C 6.6.6.0/32 is local host.
C 202.1.1.0/24 is directly connected, GigabitEthernet 0/0
C 202.1.1.1/32 is local host.
R1#
3.2 R2设备状态查看
R2#sh ip in b
Interface IP-Address(Pri) IP-Address(Sec) Status Protocol
GigabitEthernet 0/0 203.1.1.1/24 no address up up
GigabitEthernet 0/1 2.2.2.1/24 no address up up
GigabitEthernet 0/2 no address no address up down
GigabitEthernet 0/3 no address no address up down
GigabitEthernet 0/4 no address no address up down
GigabitEthernet 0/5 no address no address up down
GigabitEthernet 0/6 no address no address up down
GigabitEthernet 0/7 no address no address up down
GigabitEthernet 0/8 no address no address up down
Tunnel 1 6.6.6.1/31 no address up up
R2#
R2#sh ip ro
Codes: C - Connected, L - Local, S - Static
R - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow route
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
IA - Inter area, EV - BGP EVPN, A - Arp to host
LA - Local aggregate route
* - candidate default
Gateway of last resort is 203.1.1.2 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 203.1.1.2
S 1.1.1.0/24 is directly connected, Tunnel 1
C 2.2.2.0/24 is directly connected, GigabitEthernet 0/1
C 2.2.2.1/32 is local host.
C 6.6.6.0/31 is directly connected, Tunnel 1
C 6.6.6.1/32 is local host.
C 203.1.1.0/24 is directly connected, GigabitEthernet 0/0
C 203.1.1.1/32 is local host.
R2#
3.3 PC1设备状态查看
PC1#sh ip in b
Interface IP-Address(Pri) IP-Address(Sec) Status Protocol
GigabitEthernet 0/0 no address no address up down
GigabitEthernet 0/1 1.1.1.2/24 no address up up
GigabitEthernet 0/2 no address no address up down
GigabitEthernet 0/3 no address no address up down
GigabitEthernet 0/4 no address no address up down
GigabitEthernet 0/5 no address no address up down
GigabitEthernet 0/6 no address no address up down
GigabitEthernet 0/7 no address no address up down
GigabitEthernet 0/8 no address no address up down
PC1#
PC1#sh ip route
Codes: C - Connected, L - Local, S - Static
R - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow route
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
IA - Inter area, EV - BGP EVPN, A - Arp to host
LA - Local aggregate route
* - candidate default
Gateway of last resort is 1.1.1.1 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 1.1.1.1
C 1.1.1.0/24 is directly connected, GigabitEthernet 0/1
C 1.1.1.2/32 is local host.
PC1#
3.4 PC2设备状态查看
PC2#
PC2#sh ip in b
Interface IP-Address(Pri) IP-Address(Sec) Status Protocol
GigabitEthernet 0/0 no address no address up down
GigabitEthernet 0/1 2.2.2.2/24 no address up up
GigabitEthernet 0/2 no address no address up down
GigabitEthernet 0/3 no address no address up down
GigabitEthernet 0/4 no address no address up down
GigabitEthernet 0/5 no address no address up down
GigabitEthernet 0/6 no address no address up down
GigabitEthernet 0/7 no address no address up down
GigabitEthernet 0/8 no address no address up down
PC2#
PC2#sh ip ro
Codes: C - Connected, L - Local, S - Static
R - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow route
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
IA - Inter area, EV - BGP EVPN, A - Arp to host
LA - Local aggregate route
* - candidate default
Gateway of last resort is 2.2.2.1 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 2.2.2.1
C 2.2.2.0/24 is directly connected, GigabitEthernet 0/1
C 2.2.2.2/32 is local host.
PC2#
四 业务测试-OK
4.1 PC1 业务测试
PC1#ping 2.2.2.2
Sending 5, 100-byte ICMP Echoes to 2.2.2.2, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/8/19 ms.
PC1#
PC1#
PC1#traceroute 2.2.2.2
< press Ctrl+C to break >
Tracing the route to 2.2.2.2
1 1.1.1.1 1 msec <1 msec <1 msec
2 1.1.1.1 <1 msec <1 msec <1 msec
3 6.6.6.1 6 msec
2.2.2.2 6 msec 4 msec
PC1#
PC1#ping 8.8.8.8
Sending 5, 100-byte ICMP Echoes to 8.8.8.8, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/4 ms.
PC1#
PC1#
PC1#traceroute 8.8.8.8
< press Ctrl+C to break >
Tracing the route to 8.8.8.8
1 1.1.1.1 1 msec <1 msec <1 msec
2 1.1.1.1 <1 msec <1 msec <1 msec
3 8.8.8.8 2 msec 3 msec 2 msec
PC1#
4.2 PC2 业务测试
PC2#ping 1.1.1.2
Sending 5, 100-byte ICMP Echoes to 1.1.1.2, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/7/17 ms.
PC2#
PC2#traceroute 1.1.1.2
< press Ctrl+C to break >
Tracing the route to 1.1.1.2
1 2.2.2.1 2 msec 1 msec <1 msec
2 2.2.2.1 <1 msec <1 msec
6.6.6.0 5 msec
3 1.1.1.2 5 msec 5 msec 6 msec
PC2#
PC2#ping 8.8.8.8
Sending 5, 100-byte ICMP Echoes to 8.8.8.8, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/3/9 ms.
PC2#
PC2#
PC2#traceroute 8.8.8.8
< press Ctrl+C to break >
Tracing the route to 8.8.8.8
1 2.2.2.1 1 msec 2 msec <1 msec
2 8.8.8.8 1 msec 4 msec 2 msec
PC2#
五 锐捷tunnel接口配置命令
5.1 锐捷tunnel接口配置命令过程
R1(config)#interface tunnel 1
R1(config-if-Tunnel 1)#tunnel ?
checksum Enable end to end checksumming of packets
destination Destination of tunnel
key Security or selector key
mode Tunnel encapsulation method
mpls MPLS tunnel commands
nested-limit Set tunnel nested limit
source Source of tunnel packets
tos Set tos
ttl Set time to live
vrf Set vrf
R1(config-if-Tunnel 1)#tunnel source ?
A.B.C.D Ip address
AggregatePort Aggregate port interface
GigabitEthernet Gigabit Ethernet interface
Loopback Loopback interface
Null Null interface
OverlayRouter OverlayRouter interface
OverlayTunnel OverlayTunnel interface
Tunnel Tunnel interface
VLAN Vlan interface
Virtual-ppp Virtual PPP interface
Virtual-template Virtual Template interface
R1(config-if-Tunnel 1)#
R1(config-if-Tunnel 1)#tunnel mode ?
gre Generic route encapsulation protocol
ipip IP over IP encapsulation
ipv4ipv6 IP over IPv6 encapsulation
ipv6 Generic packet tunneling in IPv6
ipv6ip IPv6 over IP encapsulation
ipv6ipv6 IPv6 over IPv6 encapsulation
mpls Multi-Protocol Label Switching
R1(config-if-Tunnel 1)#
5.2 tunnel模式gre配置命令过程
R1(config)#int tun 1
R1(config-if-Tunnel 1)#tunnel mode gre ?
ip Over IP
ipv6 Over IPv6
R1(config-if-Tunnel 1)#tunnel mode gre ip ?
<cr>
R1(config-if-Tunnel 1)#tunnel mode gre ip
R1(config-if-Tunnel 1)#sh this
Building configuration...
!
ip address 6.6.6.0 255.255.255.254
tunnel source 202.1.1.1
tunnel destination 203.1.1.1
!
end
六 GRE配置方式-配置后命令不显示
6.1 GR配置方式
R1(config)#int tun 1
R1(config-if-Tunnel 1)#tunnel mode gre ?
ip Over IP
ipv6 Over IPv6
R1(config-if-Tunnel 1)#tunnel mode gre ip ?
<cr>
R1(config-if-Tunnel 1)#tunnel mode gre ip
R1(config-if-Tunnel 1)#sh this
Building configuration...
!
ip address 6.6.6.0 255.255.255.254
tunnel source 202.1.1.1
tunnel destination 203.1.1.1
!
end
6.2 配置后命令结果查看
hostname R1
!
interface Tunnel 1
ip address 6.6.6.0 255.255.255.254
tunnel source 202.1.1.1
tunnel destination 203.1.1.1
!
hostname R2
!
interface Tunnel 1
ip address 6.6.6.1 255.255.255.254
tunnel source 203.1.1.1
tunnel destination 202.1.1.1
!
6.3 业务测试正常
PC1#ping 2.2.2.2
Sending 5, 100-byte ICMP Echoes to 2.2.2.2, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/8/19 ms.
PC1#
PC1#
PC2#ping 1.1.1.2
Sending 5, 100-byte ICMP Echoes to 1.1.1.2, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/7/17 ms.
PC2#
PC2#traceroute 1.1.1.2
< press Ctrl+C to break >
Tracing the route to 1.1.1.2
1 2.2.2.1 2 msec 1 msec <1 msec
2 2.2.2.1 <1 msec <1 msec
6.6.6.0 5 msec
3 1.1.1.2 5 msec 5 msec 6 msec
PC2#
七 配置总结
1.ipv4ipv4方式
!
interface Tunnel 1
ip address 6.6.6.0 255.255.255.254
tunnel mode ipip
tunnel source 202.1.1.1
tunnel destination 203.1.1.1
!
配置后查看show run,配置后显示该命令
!
interface Tunnel 1
ip address 6.6.6.0 255.255.255.254
tunnel mode ipip
tunnel source 202.1.1.1
tunnel destination 203.1.1.1
!
2.gre配置方式
!
interface Tunnel 1
ip address 6.6.6.0 255.255.255.254
tunnel mode gre ip
tunnel source 202.1.1.1
tunnel destination 203.1.1.1
!
配置后查看show run不显示gre方式,属于默认配置
!
interface Tunnel 1
ip address 6.6.6.0 255.255.255.254
tunnel source 202.1.1.1
tunnel destination 203.1.1.1
!

2万+

被折叠的 条评论
为什么被折叠?



