Configuring IBGP and EBGP Sessions, Local Preference and MED_第1张图片

ISP#show run
Building configuration...

Current configuration : 1476 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname ISP
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
!
!
ip cef
no ip domain lookup

interface Loopback0
ip address 192.168.100.1 255.255.255.0
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Serial1/0
ip address 192.168.1.5 255.255.255.252
serial restart-delay 0
!
interface Serial1/1
ip address 192.168.1.1 255.255.255.252
serial restart-delay 0
!

router bgp 200
no synchronization
bgp log-neighbor-changes
network 192.168.1.0 mask 255.255.255.252
network 192.168.1.4 mask 255.255.255.252
network 192.168.100.0
neighbor 192.168.1.2 remote-as 64512
neighbor 192.168.1.6 remote-as 64512
no auto-summary
!
!
no ip http server
no ip http secure-server

control-plane

gatekeeper
shutdown  
!
!
line con 0
exec-timeout 0 0
logging synchronous
stopbits 1
line aux 0
stopbits 1
line vty 0 4
!
!
end

Sanjose1# show run
Building configuration...

Current configuration : 1788 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Sanjose1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
!
!
ip cef
no ip domain lookup

interface Loopback0
ip address 172.16.64.1 255.255.255.0
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Serial1/0
ip address 192.168.1.6 255.255.255.252
serial restart-delay 0
!
interface Serial1/1
ip address 172.16.1.1 255.255.255.0
serial restart-delay 0
!

router eigrp 64512
network 172.16.0.0
no auto-summary
!
router bgp 64512
no synchronization
bgp log-neighbor-changes
network 172.16.0.0
neighbor 172.16.32.1 remote-as 64512
neighbor 172.16.32.1 update-source Loopback0
neighbor 172.16.32.1 next-hop-self
neighbor 192.168.1.5 remote-as 200
neighbor 192.168.1.5 route-map zhang in
neighbor 192.168.1.5 route-map zhang-out out
no auto-summary
!
ip default-network 192.168.100.0               默认路由
ip route 172.16.0.0 255.255.0.0 Null0          路由汇总到null0
!
no ip http server
no ip http secure-server

route-map zhang-out permit 10
set metric 50
!
route-map zhang permit 10
set local-preference 150

control-plane

gatekeeper
shutdown
!
!
line con 0
exec-timeout 0 0
logging synchronous
stopbits 1
line aux 0
stopbits 1
line vty 0 4
!
!
end


Sanjose2# show run
Building configuration...

Current configuration : 1749 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Sanjose2     路由器名 Sanjose2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
!
!
ip cef
no ip domain lookup

interface Loopback0
ip address 172.16.32.1 255.255.255.0
!
interface FastEthernet0/0
no ip address
shutdown
duplex half
!
interface Serial1/0
ip address 172.16.1.2 255.255.255.252
serial restart-delay 0
!
interface Serial1/1
ip address 192.168.1.2 255.255.255.252
serial restart-delay 0
!

router eigrp 64512             配置eigrp 64512
network 172.16.0.0
no auto-summary
!
router bgp 64512               启动bgp 64512
no synchronization
bgp log-neighbor-changes
network 172.16.0.0
neighbor 172.16.64.1 remote-as 64512              
neighbor 172.16.64.1 update-source Loopback0   更新源 lo0
neighbor 172.16.64.1 next-hop-self
neighbor 192.168.1.1 remote-as 200          
neighbor 192.168.1.1 route-map yun in         应用路由策略
neighbor 192.168.1.1 route-map yun-out out    应用路由策略
no auto-summary
!
ip route 172.16.0.0 255.255.0.0 Null0         路由汇总到 null0
!
no ip http server
no ip http secure-server

route-map yun-out permit 10                   路由策略 permit 10
set metric 75                                设置metric值 75
!
route-map yun permit 10
set local-preference 125

control-plane


gatekeeper
shutdown
!
!
line con 0
exec-timeout 0 0
logging synchronous
stopbits 1
line aux 0
stopbits 1
line vty 0 4
!          
!
end


Sanjose2#show ip bgp
BGP table version is 14, local router ID is 172.16.32.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
             r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

  Network          Next Hop            Metric LocPrf Weight Path
*> 172.16.0.0       0.0.0.0                  0         32768 i
* i                 172.16.64.1              0    100      0 i
r>i192.168.1.0/30   172.16.64.1              0    150      0 200 i
r                   192.168.1.1              0    125      0 200 i
*>i192.168.1.4/30   172.16.64.1              0    150      0 200 i
*                   192.168.1.1              0    125      0 200 i
*>i192.168.100.0    172.16.64.1              0    150      0 200 i
*                   192.168.1.1              0    125      0 200  


ISP#show ip bgp  
BGP table version is 7, local router ID is 192.168.100.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
             r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

  Network          Next Hop            Metric LocPrf Weight Path
*  172.16.0.0       192.168.1.2             75             0 64512 i
*>                  192.168.1.6             50             0 64512 i
*> 192.168.1.0/30   0.0.0.0                  0         32768 i
*> 192.168.1.4/30   0.0.0.0                  0         32768 i
*> 192.168.100.0    0.0.0.0                  0         32768 i





ISP#tclsh
ISP(tcl)#foreach address {
+>192.168.100.1
+>172.16.64.1
+>172.16.32.1
+>192.168.1.1
+>192.168.1.2
+>192.168.1.5
+>192.168.1.6
+>172.16.1.1
+>172.16.1.2
+>} {
+>ping $address }

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.100.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.64.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/62/164 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.32.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/44/108 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/32/72 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/32/68 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/36/68 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/31/64 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/60/108 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/72/176 ms
ISP(tcl)#tclquit