HCIP第十一天

         

 

 

 配置vlan:

[SW4]vlan 10
[SW4-vlan10]q
[SW4]vlan 20
[SW4]int g0/0/2
[SW4-GigabitEthernet0/0/2]port link-type access 
[SW4-GigabitEthernet0/0/2]port default vlan 10
[SW4]int g0/0/3
[SW4-GigabitEthernet0/0/3]port link-type access 
[SW4-GigabitEthernet0/0/3]port default vlan 20

配置trunk:

[SW4]int g0/0/1
[SW4-GigabitEthernet0/0/1]port link-type trunk 
[SW4-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20

[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ip add 192.168.200.1 30
[R10]int g0/0/1.1
[R10-GigabitEthernet0/0/1.1]ip add 192.168.3.254 24
[R10-GigabitEthernet0/0/1.1]dot1q termination vid 10
[R10-GigabitEthernet0/0/1.1]arp broadcast enable
[R10]int g0/0/1.2
[R10-GigabitEthernet0/0/1.2]ip add 192.168.4.254 24
[R10-GigabitEthernet0/0/1.2]dot1q termination vid 20    
[R10-GigabitEthernet0/0/1.2]arp broadcast enable

配置IP地址:

R1:

[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.100.9 30
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 10.10.10.41 30
[R1-GigabitEthernet0/0/1]int g 0/0/2
[R1-GigabitEthernet0/0/2]ip add 192.168.100.17 30
[R1-GigabitEthernet0/0/2]int g 1/0/0
[R1-GigabitEthernet1/0/0]ip add 10.10.10.1 30
[R1-GigabitEthernet1/0/0]int g 2/0/0
[R1-GigabitEthernet2/0/0]ip add 10.10.10.5 30
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 1.1.1.1 32

R2:
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.100.13 30
[R2-GigabitEthernet0/0/0]int g 0/0/1
[R2-GigabitEthernet0/0/1]ip add 10.10.10.42 30
[R2-GigabitEthernet0/0/1]int g 0/0/2
[R2-GigabitEthernet0/0/2]ip add 192.168.100.5 30
[R2-GigabitEthernet0/0/2]int g 1/0/0
[R2-GigabitEthernet1/0/0]ip add 10.10.10.13 30
[R2-GigabitEthernet1/0/0]int g 2/0/0
[R2-GigabitEthernet2/0/0]ip add 10.10.10.9 30
[R2]interface LoopBack 0
[R2-LoopBack0]ip address 2.2.2.2 32

R3:
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.100.10 30
[R3-GigabitEthernet0/0/0]int g 0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.1.254 24
[R3-GigabitEthernet0/0/1]int g 0/0/2
[R3-GigabitEthernet0/0/2]ip add 192.168.100.1 30
[R3-GigabitEthernet0/0/2]int g 1/0/0
[R3-GigabitEthernet1/0/0]ip add 192.168.100.6 30

R4:
[R4]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.100.14 30
[R4-GigabitEthernet0/0/0]int g 0/0/1
[R4-GigabitEthernet0/0/1]ip add 192.168.2.254 24
[R4-GigabitEthernet0/0/1]int g 0/0/2
[R4-GigabitEthernet0/0/2]ip add 192.168.100.2 30
[R4-GigabitEthernet0/0/2]int g 1/0/0
[R4-GigabitEthernet1/0/0]ip add 192.168.100.18 30

R5:
[R5]int g 0/0/0
[R5-GigabitEthernet0/0/0]ip add 10.10.10.2 30
[R5-GigabitEthernet0/0/0]int g 0/0/1
[R5-GigabitEthernet0/0/1]ip add 10.10.10.10 30
[R5-GigabitEthernet0/0/1]int g 0/0/2
[R5-GigabitEthernet0/0/2]ip add 10.10.10.21 30
[R5-GigabitEthernet0/0/2]int g 1/0/0
[R5-GigabitEthernet1/0/0]ip add 10.10.10.17 30
[R5]interface LoopBack 0
[R5-LoopBack0]ip add 5.5.5.5 32

R6:
[R6]int g 0/0/0
[R6-GigabitEthernet0/0/0]ip add 10.10.10.14 30
[R6-GigabitEthernet0/0/0]int g 0/0/1
[R6-GigabitEthernet0/0/1]ip add 10.10.10.6 30
[R6-GigabitEthernet0/0/1]int g 0/0/2
[R6-GigabitEthernet0/0/2]ip add 10.10.10.25 30
[R6-GigabitEthernet0/0/2]int g 1/0/0
[R6-GigabitEthernet1/0/0]ip add 10.10.10.18 30
[R6]interface LoopBack 0
[R6-LoopBack0]ip add 6.6.6.6 32

R7:
[R7]int g 0/0/0
[R7-GigabitEthernet0/0/0]ip add 10.10.10.22 30
[R7-GigabitEthernet0/0/0]int g 0/0/1
[R7-GigabitEthernet0/0/1]ip add 10.10.10.26 30
[R7-GigabitEthernet0/0/1]int g 0/0/2
[R7-GigabitEthernet0/0/2]ip add 10.10.10.29 30
[R7-GigabitEthernet0/0/2]int g 1/0/0
[R7-GigabitEthernet1/0/0]ip add 10.10.10.33 30
[R7]interface LoopBack 0
[R7-LoopBack0]ip add 7.7.7.7 32

R8:
[R8]int g 0/0/0
[R8-GigabitEthernet0/0/0]ip add 10.10.10.30 30
[R8-GigabitEthernet0/0/0]int g 0/0/1
[R8-GigabitEthernet0/0/1]ip add 10.10.10.34 30
[R8-GigabitEthernet0/0/1]int g 0/0/2
[R8-GigabitEthernet0/0/2]ip add 10.10.10.37 30
[R8]interface LoopBack 0
[R8-LoopBack0]ip add 8.8.8.8 32

R9:
[R9]int g 0/0/0
[R9-GigabitEthernet0/0/0]ip add 10.10.10.38 30
[R9-GigabitEthernet0/0/0]int g 0/0/1
[R9-GigabitEthernet0/0/1]ip add 192.168.200.2 30

OSPF配置:
[R9]ospf 200 router-id 9.9.9.9
[R9-ospf-200]area 0
[R9-ospf-200-area-0.0.0.0]network 192.168.200.2 0.0.0.0
[R10]ospf 200 router-id 10.10.10.10
[R10-ospf-200]a 0
[R10-ospf-200-area-0.0.0.0]network 192.168.200.1 0.0.0.0
[R10-ospf-200-area-0.0.0.0]network 192.168.3.254 0.0.0.0
[R10-ospf-200-area-0.0.0.0]network 192.168.4.254 0.0.0.0

[R1]ospf 100 router-id 1.1.1.1
[R1-ospf-100]a 0
[R1-ospf-100-area-0.0.0.0]network 192.168.100.9 0.0.0.0
[R1-ospf-100-area-0.0.0.0]network 192.168.100.17 0.0.0.0
[R1-ospf-100-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R2]ospf 100 router-id 2.2.2.2
[R2-ospf-100]a 0
[R2-ospf-100-area-0.0.0.0]network 192.168.100.13 0.0.0.0
[R2-ospf-100-area-0.0.0.0]network 192.168.100.5 0.0.0.0
[R2-ospf-100-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R3]ospf 100 router-id 3.3.3.3
[R3-ospf-100]a 0
[R3-ospf-100-area-0.0.0.0]network 192.168.100.10 0.0.0.0
[R3-ospf-100-area-0.0.0.0]network 192.168.1.254 0.0.0.0
[R3-ospf-100-area-0.0.0.0]network 192.168.100.1 0.0.0.0
[R3-ospf-100-area-0.0.0.0]network 192.168.100.6 0.0.0.0
[R4]ospf 100 router-id 4.4.4.4
[R4-ospf-100]a 0
[R4-ospf-100-area-0.0.0.0]network 192.168.100.14 0.0.0.0
[R4-ospf-100-area-0.0.0.0]network 192.168.2.254 0.0.0.0
[R4-ospf-100-area-0.0.0.0]network 192.168.100.2 0.0.0.0
[R4-ospf-100-area-0.0.0.0]network 192.168.100.18 0.0.0.0

[R5]ospf 10 router-id 5.5.5.5
[R5-ospf-10]a 0
[R5-ospf-10-area-0.0.0.0]network 10.10.10.21 0.0.0.0
[R5-ospf-10-area-0.0.0.0]network 10.10.10.17 0.0.0.0
[R5-ospf-10-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[R6]ospf 10 router-id 6.6.6.6
[R6-ospf-10]a 0
[R6-ospf-10-area-0.0.0.0]network 10.10.10.25 0.0.0.0
[R6-ospf-10-area-0.0.0.0]network 10.10.10.18 0.0.0.0
[R6-ospf-10-area-0.0.0.0]network 6.6.6.6 0.0.0.0
[R7]ospf 10 router-id 7.7.7.7
[R7-ospf-10]a 0
[R7-ospf-10-area-0.0.0.0]network 10.10.10.22 0.0.0.0
[R7-ospf-10-area-0.0.0.0]network 10.10.10.26 0.0.0.0
[R7-ospf-10-area-0.0.0.0]network 10.10.10.29 0.0.0.0
[R7-ospf-10-area-0.0.0.0]network 10.10.10.33 0.0.0.0
[R7-ospf-10-area-0.0.0.0]network 7.7.7.7 0.0.0.0
[R8]ospf 10 router-id 8.8.8.8
[R8-ospf-10]a 0
[R8-ospf-10-area-0.0.0.0]network 10.10.10.30 0.0.0.0
[R8-ospf-10-area-0.0.0.0]network 10.10.10.34 0.0.0.0
[R8-ospf-10-area-0.0.0.0]network 8.8.8.8 0.0.0.0

建立BGP:

[R1]bgp 100
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 2.2.2.2 as 100
[R1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R1-bgp]peer 10.10.10.2 as 200
[R1-bgp]peer 10.10.10.6 as 200
[R2]bgp 100
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 1.1.1.1 as 100
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R2-bgp]peer 10.10.10.10 as 200
[R2-bgp]peer 10.10.10.14 as 200

[R5]bgp 200
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 10.10.10.1 as 100
[R5-bgp]peer 10.10.10.9 as 100
[R5-bgp]peer 6.6.6.6 as 200
[R5-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[R5-bgp]peer 7.7.7.7 as 200
[R5-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[R5-bgp]peer 8.8.8.8 as 200
[R5-bgp]peer 8.8.8.8 connect-interface LoopBack 0
[R6]bgp 200
[R6-bgp]router-id 6.6.6.6
[R6-bgp]peer 10.10.10.5 as 100
[R6-bgp]peer 10.10.10.13 as 100
[R6-bgp]peer 5.5.5.5 as 200
[R6-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R6-bgp]peer 7.7.7.7 as 200
[R6-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[R6-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[R6-bgp]peer 8.8.8.8 as 200
[R6-bgp]peer 8.8.8.8 connect-interface LoopBack 0
[R7]bgp 200
[R7-bgp]router-id 7.7.7.7
[R7-bgp]peer 5.5.5.5 as 200
[R7-bgp]peer 5.5.5.5 connect-interface l    
[R7-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R7-bgp]peer 6.6.6.6 as 200
[R7-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[R7-bgp]peer 8.8.8.8 as 200
[R7-bgp]peer 8.8.8.8 connect-interface LoopBack 0

[R8]bgp 200
[R8-bgp]router-id 8.8.8.8
[R8-bgp]peer 7.7.7.7 as 200
[R8-bgp]peer 7.7.7.7 connect-interface LoopBack 0
[R8-bgp]peer 6.6.6.6 as 200
[R8-bgp]peer 6.6.6.6 connect-interface LoopBack 0
[R8-bgp]peer 5.5.5.5 as 200
[R8-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R8-bgp]peer 10.10.10.38 as 100

[R9]bgp 100
[R9-bgp]router-id 9.9.9.9
[R9-bgp]peer 10.10.10.37 as 200

[R1]bgp 100
[R1-bgp]network 192.168.1.0 24
[R1-bgp]network 192.168.2.0 24
[R2]bgp 100
[R2-bgp]network 192.168.1.0 24
[R2-bgp]network 192.168.2.0 24
[R9]bgp 100
[R9-bgp]network 192.168.3.0 24
[R9-bgp]network 192.168.4.0 24

[R8-bgp]peer 5.5.5.5 next-hop-local
[R8-bgp]peer 6.6.6.6 next-hop-local
[R8-bgp]peer 7.7.7.7 next-hop-local

[R5-bgp]peer 7.7.7.7 next-hop-local
[R5-bgp]peer 8.8.8.8 next-hop-local
[R6-bgp]peer 7.7.7.7 next-hop-local
[R6-bgp]peer 8.8.8.8 next-hop-local

[R1-bgp]peer 10.10.10.2 allow-as-loop 
[R1-bgp]peer 10.10.10.6 allow-as-loop
[R2-bgp]peer 10.10.10.10 allow-as-loop 
[R2-bgp]peer 10.10.10.14 allow-as-loop
[R9-bgp]peer 10.10.10.37 allow-as-loop

重发布:
[R1]ospf 100
[R1-ospf-100]import-route bgp
[R2]ospf 100
[R2-ospf-100]import-route bgp
[R9]ospf 200
[R9-ospf-200]import-route bgp 

[R1]bgp 100
[R1-bgp]ipv4-family unicast 
[R1-bgp-af-ipv4]preference 140 255 255 
[R2]bgp 100
[R2-bgp]ipv4-family unicast 
[R2-bgp-af-ipv4]preference 140 255 255

[R4]int g1/0/0    
[R4-GigabitEthernet1/0/0]ospf cost 10
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]ospf cost 10

[R2]ip ip-prefix policy-1 permit 192.168.1.0 24
[R2]route-policy policy-1 permit node 10
[R2-route-policy]if-match ip-prefix policy-1
[R2-route-policy]apply cost 10
[R2]route-policy policy-1 permit node 20
[R2-route-policy]q
[R2]bgp 100
[R2-bgp]peer 10.10.10.10 route-policy policy-1 
[R2-bgp]peer 10.10.10.14 route-policy policy-1

[R1]ospf 100
[R1-ospf-100]import-route bgp type 1
[R2]ospf 100
[R2-ospf-100]import-route bgp type 1
[R9]ospf 200
[R9-ospf-200]import-route bgp type 1

[R6]route-policy policy-1 permit node 10
[R6-route-policy]apply cost 10
[R6]route-policy policy-1 permit node 20
[R6-route-policy]q
[R6]bgp 200
[R6-bgp]peer 10.10.10.5 route-policy policy-1 export 
[R6-bgp]peer 10.10.10.13 route-policy policy-1 export

测试
 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值