BGP邻居建立和通告路由基本配置

BGP邻居建立和通告路由基本配置_第1张图片
R1:

interface GigabitEthernet0/0/0
ip address 192.168.12.1 255.255.255.0

interface LoopBack0
ip address 1.1.1.1 255.255.255.255

bgp 100 -----------//本端AS号
peer 192.168.12.2 as-number 200 -----------//对端IP地址,对端AS号

ipv4-family unicast
undo synchronization**----------//关闭路由同步**
peer 192.168.12.2 enable

R2:

router id 0.0.0.2

interface GigabitEthernet0/0/0
ip address 192.168.23.2 255.255.255.0

interface GigabitEthernet0/0/1
ip address 192.168.12.2 255.255.255.0

interface LoopBack0
ip address 2.2.2.2 255.255.255.255

bgp 200
peer 192.168.12.1 as-number 100
peer 192.168.23.3 as-number 200

ipv4-family unicast
undo synchronization
network 3.3.3.3 255.255.255.255
import-route static--------------//BGP引入静态路由
import-route ospf 1--------------//BGP引入OSPF路由

peer 192.168.12.1 enable
peer 192.168.23.3 enable

ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 192.168.12.0 0.0.0.255
network 192.168.23.0 0.0.0.255

ip route-static 1.1.1.1 255.255.255.255 192.168.12.1

R3:

router id 0.0.0.3

interface GigabitEthernet0/0/0
ip address 192.168.34.3 255.255.255.0

interface GigabitEthernet0/0/1
ip address 192.168.23.3 255.255.255.0

interface LoopBack0
ip address 3.3.3.3 255.255.255.255

bgp 200
peer 4.4.4.4 as-number 300
peer 4.4.4.4 ebgp-max-hop 2
peer 4.4.4.4 connect-interface LoopBack0
peer 192.168.23.2 as-number 200

ipv4-family unicast
undo synchronization
import-route static
peer 4.4.4.4 enable
peer 192.168.23.2 enable

ospf 1
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 192.168.23.0 0.0.0.255
network 192.168.34.0 0.0.0.255

ip route-static 4.4.4.4 255.255.255.255 192.168.34.4

R4:
interface GigabitEthernet0/0/1
ip address 192.168.34.4 255.255.255.0

interface GigabitEthernet0/0/2

interface NULL0

interface LoopBack0
ip address 4.4.4.4 255.255.255.255

bgp 300
peer 3.3.3.3 as-number 200
peer 3.3.3.3 ebgp-max-hop 2
peer 3.3.3.3 connect-interface LoopBack0

ipv4-family unicast
undo synchronization
import-route static
peer 3.3.3.3 enable

ip route-static 3.3.3.3 255.255.255.255 192.168.34.3

验证:
< R1>dis ip routing-table
Route Flags: R - relay, D - download to fib

Routing Tables: Public
Destinations : 13 Routes : 13

Destination/Mask Proto Pre Cost Flags NextHop Interface

    1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
    2.2.2.2/32  EBGP    255  0           D   192.168.12.2    GigabitEthernet

0/0/0
3.3.3.3/32 EBGP 255 1 D 192.168.12.2 GigabitEthernet
0/0/0
4.4.4.4/32 EBGP 255 0 D 192.168.12.2 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.12.0/24 Direct 0 0 D 192.168.12.1 GigabitEthernet
0/0/0
192.168.12.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.12.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.23.0/24 EBGP 255 0 D 192.168.12.2 GigabitEthernet
0/0/0
192.168.34.0/24 EBGP 255 2 D 192.168.12.2 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
注意:
1、BGP配置邻居关系时peer “对端IP地址”as-number“对端AS好”;
2、BGP配置邻居关系时peer“对端Loopback端口”,需要做指定更新原端口connect-interface‘接口号’,同时还需要路由多跳TTL值,如peer “对端IP地址”ebgp-max-hop “路由跳数”。

你可能感兴趣的:(网络,交换机)