一、配置IP
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip ad 12.0.0.1 24
May 13 2024 22:37:24-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]int l0
[r1-LoopBack0]ip ad 1.1.1.1 32
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip ad 12.0.0.2 24
May 13 2024 22:38:24-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]int l0
[r2-LoopBack0]ip ad 2.2.2.2 32
[r2-LoopBack0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip ad 23.0.0.1 24
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip ad 23.0.0.2 24
May 13 2024 22:39:33-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]int l0
[r3-LoopBack0]ip ad 3.3.3.3 32
[r3-LoopBack0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip ad 34.0.0.1 24
May 13 2024 22:40:13-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip ad 45.0.0.1 24
May 13 2024 22:40:58-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]int g0/0/1
[r4-GigabitEthernet0/0/1]ip ad 34.0.0.2 24
May 13 2024 22:41:20-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4-GigabitEthernet0/0/1]int l0
[r4-LoopBack0]ip ad 4.4.4.4 32
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip ad 45.0.0.2 14
May 13 2024 22:42:40-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r5-GigabitEthernet0/0/0]int l0
[r5-LoopBack0]ip ad 5.5.5.5 32
二、内部ospf互通
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]ne
[r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[r3]ospf 1 ro
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]a 0
[r3-ospf-1-area-0.0.0.0]net
[r3-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
r4]ospf 1 ro
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]a 0
[r4-ospf-1-area-0.0.0.0]net
[r4-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
三、bgp建立邻居关系
[r1]bgp 100
[r1-bgp]peer 12.0.0.2 as-number 200
r2]bgp 200
[r2-bgp]peer 12.0.0.1 as-number 100
[r2-bgp]
May 13 2024 22:58:22-08:00 r2 %%01BGP/3/STATE_CHG_UPDOWN(l)[5]:The status of the
peer 12.0.0.1 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, St
ateChangeReason=Up)
[r2-bgp]peer 4.4.4.4 as-number 200
[r2-bgp]peer 4.4.4.4 connect-i
[r2-bgp]peer 4.4.4.4 connect-interface l0
[r4]bgp 200
[r4-bgp] peer 45.0.0.2 as-
[r4-bgp]peer 45.0.0.2 as-number 300
[r4-bgp]peer 2.2.2.2 as-
[r4-bgp]peer 2.2.2.2 as-n
[r4-bgp]peer 2.2.2.2 as-number 200
[r4-bgp]peer 2.2.2.2 conn
[r4-bgp]peer 2.2.2.2 connect-interface l0
[r5]bgp 300
[r5-bgp]peer 45.0.0.1 as-number 200
四、
[r2]ospf 1
[r2-ospf-1]im
[r2-ospf-1]import-route bgp
[r4]ospf 1
[r4-ospf-1]im
[r4-ospf-1]import-route bgp
[r2]bgp 200
[r2-bgp] peer 4.4.4.4 ne
[r2-bgp]peer 4.4.4.4 next-hop-l
[r2-bgp]peer 4.4.4.4 next-hop-local
[r4]bgp 200
[r4-bgp] peer 2.2.2.2 ne
[r4-bgp]peer 2.2.2.2 next-hop-l
[r4-bgp]peer 2.2.2.2 next-hop-local