BGP origin attribute: how BGP initially learned of the network.

The Origin attribute is a well-known mandatory attribute. It can be used to differentiate between BGP routes based on the source that initially injected the route into BGP. The BGP speaker that originates a route sets the attribute. The origin attribute has one of the following values;

    • I: Internal (0): routing information is interior to the originating AS
    • E: External (1): routing information learned via EGP protocol
    • ?: Incomplete (2): routing information learned by other means

A low origin value is better. Hence, Internal supersedes External and External supersedes incomplete. Take a look at the following example;


The Junos BGP speaking router in AS 1 is redistributing a static route into its BGP table. The origin attribute for that prefix will be set to ’I’, or internal. This is Junos’ default behavior and it is unlike some other vendors. For example, Cisco has a different take on this. With Cisco, the attribute is set to internal when networks are injected into BGP with the ‘network’ command. The attribute is set to incomplete when routing information is redistributed using the ‘redistribute’ command.

In AS 2, the prefix originated in AS 1 will still have the origin attribute set to ‘I’. This is because the attribute is not updated across EBGP sessions by default. The same logic applies when AS advertises the routing information to AS 3.