ipv6实验

在这里插入图片描述一.先做v4网络
1.缺省指向r3(ISP)

[r2]ip route-static 0.0.0.0 0 23.1.1.2
[r4]ip route-static 0.0.0.0 0 34.1.1.1  
  1. 私网访问公网(nat和缺省)
[r1]ip route-static 0.0.0.0 0 192.168.1.2  
[r2]acl 2000
[r2-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]nat outbound 2000
测试[r1]ping 34.1.1.2

二.ipv6网络
基于6to4tunnel,ipv4换算ipv6
ipv4 23.1.1.1 /24(32位4段,每段8位)
ipv6 2002:1701:0101::/48(128位8段每段16位)
子网划分 2002:1701:0101:0::/64
2002:1701:0101:1::/64
2002:1701:0101:2::/64
2002:1701:0101:3::/64
2002:1701:0101:0::/64 在划2个给R1环回用
环回1 2002:1701:0101::/65
原因 2002:1701:0101:0000:0000 0000 0000 0000::/65
环回2 2002:1701:0101:0000:8000::/65
原因2002:1701:0101:0000:1000 0000 0000 0000 ::/65
左边
1.配地址
r1

ipv6   必须先在设备上开启IPV6服务
interface LoopBack0
 ipv6 enable  再在接口上激活IPV6服务,才能配置ipv6地址配置ipv6地址
 ipv6 address 2002:1701:101::1/65 
 interface LoopBack1
 ipv6 enable 
 ipv6 address 2002:1701:101:0:8000::1/65 
 interface GigabitEthernet0/0/0
 ip address 192.168.1.1 255.255.255.0 
  ipv6 enable 
 ipv6 address 2002:1701:101:1::1/64 

r2

ipv6
interface LoopBack0
 ipv6 enable 
 ipv6 address 2002:1701:101:2::1/64 
interface GigabitEthernet0/0/0
 ipv6 enable 
 ip address 192.168.1.2 255.255.255.0 
 ipv6 address 2002:1701:101:1::2/64 

2.ripng配置

[r2]ripng  1
[r2-ripng-1]q
[r2]int lo0
[r2-LoopBack0]ripng 1 enable 
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ripng 1 enable 
r1同理
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ripng summary-address 2002:1701:0101:: 64 汇总r1的两个环回
6to4tunnel
[

测试dis ipv6 routing-table protocol ripng

在这里插入图片描述

在这里插入图片描述r1-2可以通

3.6to4tunnel

r2]int Tunnel 0/0/0
[r2-Tunnel0/0/0]tunnel-protocol ipv6-ipv4 6to4
[r2-Tunnel0/0/0]ipv6 enable 
[r2-Tunnel0/0/0]ipv6 address 2002:1701:101:3::1 64 
[r2-Tunnel0/0/0]source 23.1.1.1
[r2]ipv6 route-static 2002:: 16 Tunnel 0/0/0   //引流量
[r2]ripng 1
[r2]import-route static  //重发布使得r1有 2002::16,才能出去

在这里插入图片描述
右边
1.配地址
34.1.1.2 /24
2002:2201:0102::/48

2002:2201:0102::/49 AS1
2002:2201:0102::/64 - 2002:2201:0102:7fff::/64

2002:2201:0102:8000::/49 AS2
2002:2201:0102:8000::/64 - 2002:2201:0102:ffff::/64

[r4]ipv6
[r4]int lo 0
[r4-LoopBack0]ipv6 enable 
[r4-LoopBack0]ipv6 add 2002:2201:0102::1/64
[r4-LoopBack0]int g0/0/1
[r4-GigabitEthernet0/0/1]ipv6 enable 
[r4-GigabitEthernet0/0/1]ipv6 address 2002:2201:0102:1::1/64

[r5-GigabitEthernet0/0/0]ipv6 address 2002:2201:0102:1::2/64 
[r5-LoopBack0]ipv6 address 2002:2201:0102:8000::1/64
[r5-GigabitEthernet0/0/1]ipv6 address 2002:2201:0102:8001::1/64

[r6-GigabitEthernet0/0/0] ipv6 address 2002:2201:0102:8001::2/64
[r6-LoopBack0]ipv6 address 2002:2201:0102:8002::1/64
[r6-GigabitEthernet0/0/1]ipv6 address 2002:2201:0102:8003::1/64

[r7-GigabitEthernet0/0/0]ipv6 address 2002:2201:0102:8003::2/64
[r7-LoopBack0]ipv6 address 2002:2201:0102:8004::1/64
[r7-GigabitEthernet0/0/1]ipv6 address 2002:2201:0102:8005::1/64

[r8-GigabitEthernet0/0/0]ipv6 address 2002:2201:0102:8005::2/64
[r8-LoopBack0]ipv6 address  2002:2201:0102:8006::1/64

2.IBGP(AS2跑ospf)

[r5]ospfv3 1
[r5-ospfv3-1]router-id 5.5.5.5 
[r5-ospfv3-1]int lo 0 
[r5-LoopBack0]ospfv3 1 area 0   //进入接口进行宣告
[r5-LoopBack0]int g0/0/1
[r5-GigabitEthernet0/0/1]ospfv3 1 area 0  // 进入接口进行宣告

r6-r7-r8同理操作后
r5-r6-r7-r8ospf建邻互通 在这里插入图片描述
3.bgp建邻
(1)ebgp建邻
r4-r5建邻

[r4]bgp 1 
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 2002:2201:102:1::2 as-number 2
[r4-bgp]ipv6-family 
[r4-bgp-af-ipv6]peer 2002:2201:102:1::2 enable  //ipv6enable
[r5]bgp 64512 
[r5-bgp]router-id 5.5.5.5
[r5-bgp]confederation id 2
[r5-bgp]peer 2002:2201:102:1::1 as-number 1 
[r5-bgp]ipv6-family 
[r5-bgp-af-ipv6]peer 2002:2201:102:1::1 enable

在这里插入图片描述
ipv6地址复杂,利用多宿主的特点在r5,r6.r7,r8上各加一个环回,利用同一个接口的多宿主。
[r5]int lo0
[r5-LoopBack0]ipv6 address 5::5/64
[r6]int lo0
[r6-LoopBack0]ipv6 address 6::6/64
[r7-LoopBack0]ipv6 address 7::7/64
[r8-LoopBack0]ipv6 address 8::8/64
查看有添加的路由
在这里插入图片描述
(2)ibgp建邻
列出r5与r6,r7与r8
r6-r7同理

[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 6::6 as-number 64512
[r5-bgp]peer 6::6 connect-interface lo0 5::5
[r5-bgp]ipv6-family 
[r5-bgp-af-ipv6]peer 6::6 enable 
[r6]bgp 64512
[r6-bgp]router-id 6.6.6.6 
[r6-bgp]confederation id 2
[r6-bgp]peer 5::5 as-number 64512
[r6-bgp]peer 5::5 connect-interface lo0 6::6
[r6-bgp]ipv6-family 
[r6-bgp-af-ipv6]peer 5::5 enable

r7-r8(r7省略)

[r8]bgp 64513
[r8-bgp]router-id 8.8.8.8
[r8-bgp]confederation id 2
[r8-bgp]confederation  peer-as 64512
[r8-bgp]peer 7::7 as-number 64512
[r8-bgp]peer 7::7 connect-interface lo0 8::8
[r8-bgp]peer 7::7 ebgp-max-hop 2
[r8-bgp]ipv6-family 
[r8-bgp-af-ipv6]peer 7::7 enable

在这里插入图片描述
4.右图tunnel
[r4]int Tunnel 0/0/0
[4-Tunnel0/0/0]tunnel-protocol ipv6-ipv4 6to4
[r4-Tunnel0/0/0]ipv6 enable
[r4-Tunnel0/0/0]ipv6 address 2002:2201:0102:2::1/64
[4-Tunnel0/0/0]source 34.1.1.2

[r4]ipv6 route-static 2002:: 16 Tunnel 0/0/0 //引流量
[r4]bgp 1
[r4-bgp]ipv6-family
[r4-bgp-af-ipv6]network 2002: :16 //宣告产生路由条目
r4可以传r5(you),R5传r6不优,
由于ibgp水平分割,r5传r6,只传一跳。r6不传r7,做反射器
[r5]bgp 64512
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]peer 6::6 next-hop-local
[r6]bgp 64512
[r6-bgp]ipv6-family
[r6-bgp-af-ipv6]peer 5::5 reflect-client //r6为RR,r5为客户端
在这里插入图片描述

[r5]ipv6 route-static 2002:2201:0102:8000:: 49 null 0
[r5]bgp 64512
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]network 2002:2201:0102:8000:: 49
//将汇总宣告,则右边区域都会学到
此时r4-5-6-7-8均有路由。
在这里插入图片描述在这里插入图片描述
ping r8的环回在这里插入图片描述

版权声明:本文为qq_45630589原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_45630589/article/details/104049417