Origin code is one of the BGP attribute used for PATH selection. There are 3 origin codes that BGP have,
- IGP (shows as "i" )
- EGP (shows as "e" )
- incomplete (shows as "?" )
- You will see "i" when you manually advertise using the "network" command.
- You will see "?", when you have redistributed something into BGP.
- "e" is old and will not be seen in the BGP table anymore.
Let's me demonstrate this using the below topology:
- We have three routers. R1 is in AS_1 and R2 and R3 are in AS_23.
- Loopback 0 (IP: 23.23.23.23/32) configured in both R2 and R3.
- In R2, we advertise Loopback 0 using the redistribute command and in R3 we advertise using the network command.
Below are the configuration in each routers. Please note that I have redistributed in both R2 and R3.
R1 Interface Configuration:
R1#show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.12.1 YES manual up up
FastEthernet0/1 192.168.13.1 YES manual up up
R1#
R2 Interface Configuration:
R2#show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.12.2 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Loopback0 23.23.23.23 YES manual up up
R2#
R3 Interface Configuration:
R3#show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.13.3 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Loopback0 23.23.23.23 YES manual up up
R3#
R1 BGP Configuration:
R1#conf terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.12.2 remote-as 23
R1(config-router)#neighbor 192.168.13.3 remote-as 23
R1(config-router)#end
R1#show running-config | section router bgp
router bgp 1
no synchronization
bgp log-neighbor-changes
neighbor 192.168.12.2 remote-as 23
neighbor 192.168.13.3 remote-as 23
no auto-summary
R1#
R2 BGP Configuration:
R2#conf terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#router bgp 23
R2(config-router)#neighbor 192.168.12.1 remote-as 1
R2(config-router)#redistribute connected
R2(config-router)#end
R2#
R2#show running-config | section router bgp
router bgp 23
no synchronization
bgp log-neighbor-changes
network 23.23.23.23 mask 255.255.255.255
neighbor 192.168.12.1 remote-as 1
no auto-summary
R2#
R3 BGP Configuration:
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router bgp 23
R3(config-router)#neighbor 192.168.12.1 remote-as 1
R3(config-router)#redistribute connected
R3(config-router)#end
R3#
R3#show running-config | section router bgp
router bgp 23
no synchronization
bgp log-neighbor-changes
redistribute connected
neighbor 192.168.13.1 remote-as 1
no auto-summary
R3#
- From the below BGP table, you can see that the ip address 23.23.23.23/32 has two entries, one via next-hop as R2 (192.168.12.2) and the other via R3 (192.168.13.3).
- R1 selects R2 as the best path for the network 23.23.23.23/32.
- Also you can see that both the path are indicated by the symbol "?", which means redistributed.
R3#conf terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router bgp 23
R3(config-router)#no redistribute connected
R3(config-router)#network 23.23.23.23 mask 255.255.255.255
R3(config-router)#end
R3#
After advertising the network 23.23.23.23/32 manually (using network command in BGP), you can see that the R1 is preferring the path through R3. You can also find that now "?" is changed to "i" because of advertising it using the network command.
You can also look into my tutorial in Tamil:
Post a Comment
Post a Comment