How to configure EBGP (External BGP)

neighbor password is the best way to secure bgp ?

Hello Juan

Using a neighbor password with MD5 authentication definitely improves BGP security as it mitigates against an attacker masquerading as a BGP router. Additional precautions that can be taken include maintaining proper prefix filters (especially for ISPs) to avoid having customers advertising prefixes that don’t actually belong to them. Also, you can make sure that you remove any private AS’es from the path.

I hope this has been helpful!

Laz

Hii .

when i am configuring EBGP on 2 directly connected interfaces. EBGP is not establishing,and i am getting below console logs.
R1 interface 0/0 is configured as 192.168.1.1 /24 and R2 interface 0/0 is 192.168.1.2/24

R1:
router bgp 1
 bgp log-neighbor-changes
 neighbor 192.168.1.2 remote-as 200
R2:
router bgp 1
 bgp log-neighbor-changes
 neighbor 192.168.1.1 remote-as 100

Logs on R1:

*Dec  4 17:50:23.067: %BGP-4-MSGDUMP: unsupported or mal-formatted message received from 192.168.1.2:
FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 0039 0104 0002 00B4 C0A8 0102 1C02 0601
0400 0100 0102 0280 0002 0202 0002 0246 0002 0641 0400 0000 02
R1#
*Dec  4 17:50:27.959: %BGP-5-NBR_RESET: Neighbor 192.168.1.2 passive reset (BGP Notification sent)
*Dec  4 17:50:27.963: %BGP-5-ADJCHANGE: neighbor 192.168.1.2 passive Down BGP Notification sent
R1#
*Dec  4 17:50:36.243: %BGP-3-NOTIFICATION: received from neighbor 192.168.1.2 active 2/2 (peer in wrong AS) 2 bytes 0001
*Dec  4 17:50:36.243: %BGP-5-NBR_RESET: Neighbor 192.168.1.2 active reset (BGP Notification received)
*Dec  4 17:50:36.247: %BGP-5-ADJCHANGE: neighbor 192.168.1.2 active Down BGP Notification received
*Dec  4 17:50:36.251: %BGP_SESSION-5-ADJCHANGE: neighbor 192.168.1.2 IPv4 Unicast topology base removed from session  BGP Notification received
*Dec  4 17:50:36.371: %BGP-3-NOTIFICATION: sent to neighbor 192.168.1.2 passive 2/2 (peer in wrong AS) 2 bytes 0002
R1#
*Dec  4 17:50:36.375: %BGP-4-MSGDUMP: unsupported or mal-formatted message received from 192.168.1.2:
FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 0039 0104 0002 00B4 C0A8 0102 1C02 0601
0400 0100 0102 0280 0002 0202 0002 0246 0002 0641 0400 0000 02

Logs on R2:

*Dec  4 17:51:11.487: %BGP-4-MSGDUMP: unsupported or mal-formatted message received from 192.168.1.1:
FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 0039 0104 0001 00B4 C0A8 0101 1C02 0601
0400 0100 0102 0280 0002 0202 0002 0246 0002 0641 0400 0000 01
R2#
*Dec  4 17:51:15.679: %BGP-5-NBR_RESET: Neighbor 192.168.1.1 passive reset (BGP Notification sent)
*Dec  4 17:51:15.683: %BGP-5-ADJCHANGE: neighbor 192.168.1.1 passive Down BGP Notification sent
R2#
*Dec  4 17:51:18.831: %BGP-3-NOTIFICATION: received from neighbor 192.168.1.1 active 2/2 (peer in wrong AS) 2 bytes 0002
R2#
*Dec  4 17:51:18.831: %BGP-5-NBR_RESET: Neighbor 192.168.1.1 active reset (BGP Notification received)
*Dec  4 17:51:18.835: %BGP-5-ADJCHANGE: neighbor 192.168.1.1 active Down BGP Notification received
*Dec  4 17:51:18.835: %BGP_SESSION-5-ADJCHANGE: neighbor 192.168.1.1 IPv4 Unicast topology base removed from session  BGP Notification received
R2#
*Dec  4 17:51:26.843: %BGP-3-NOTIFICATION: sent to neighbor 192.168.1.1 passive 2/2 (peer in wrong AS) 2 bytes 0001
R2#
*Dec  4 17:51:26.847: %BGP-4-MSGDUMP: unsupported or mal-formatted message received from 192.168.1.1:
FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 0039 0104 0001 00B4 C0A8 0101 1C02 0601
0400 0100 0102 0280 0002 0202 0002 0246 0002 0641 0400 0000 01

Hello Chandrasekhar

When configuring BGP, the number you insert after the router bgp command is the AS of the local router. So you have configured both routers in AS1, and with your neighbor commands, you are stating that the remote AS is 100 and 200.

The configuration should be:

R1:

router bgp 100
 bgp log-neighbor-changes
 neighbor 192.168.1.2 remote-as 200

R2:

router bgp 200
 bgp log-neighbor-changes
 neighbor 192.168.1.1 remote-as 100

The remote AS configured in each router should match the AS of the neighbor as shown above.

I hope this has been helpful!

Laz

1 Like

Hi Rene,
Great lesson, i’m a little confused about advertising the loopback network, i thought there was another command that’s used if we want to advertise the loopback network in BGP.

Hello Irfan

Loopback networks are shared just like any other network in BGP. There is no distinction made between those and others configured on particular physical interfaces, SVIs, tunnel interfaces, or anywhere else for that matter.

You may be thinking about the situation in which you use loopback addresses of routers as the BGP source addresses. In such cases you will need to configure EBGP multihop as described in the following lesson:

This is valid for eBGP only. Was that what you were thinking?

I hope this has been helpful, and that you stay healthy and safe!

Laz

1 Like

Hi Laz,
Yes, that’s exactly what i was thinking as an EBGP scenario, as a matter of fact as soon as i sent the question, i realized what i was thinking.

Thanks for clearing it up for me.

1 Like

Hi,
As you expalined why we need BGP Re- To advertise static public IP but when I study EBGP there is no confiugration for static public IP

Hello Dinesh

BGP in an enterprise network is necessary to advertise any public IP addresses you may have on devices within your network, to the ISP, and into the Internet in general. Now these will be static addresses, because in most cases, if you want to advertise the public address of your server, for example, it will indeed be static.

Whether a host receives a static IP address, or an address via DHCP, it doesn’t make a difference for BGP. If that address, or address range (known as a prefix in BGP parlance) is to be advertised, BGP simply advertises it.

I hope this has been helpful!

Laz

Hello everyone, I’m new here
I have a question, actually two:
I have BGP and OSPF on my router.
In BGP I have seen a command of the type impor route ospf, this means that I will inject to BGP the routes that ospf learns? If so, how can I discriminate the private routes known to ospf and not send them to BGP?
regards

Hello Claudio

Welcome to the forum! Networks can be advertised to BGP in two primary ways: using the network command, and using redistribution. Redistribution is the way to inject the routes learned via an IGP (like OSPF or EIGRP for example) into BGP.

By default, these routes are not injected into BGP unless you configure them yourself. You can find out more about both methods of injecting routes into BGP by taking a look at the following lesson:

If you have any more questions, feel free to respond here!

I hope this has been helpful!

Laz

Thanks lagapides.
reviewing I understood.
If I need to filter what I redistribute from OSPF to BGP I can do it with filters, for example avoid redistributing private prefixes
regards

1 Like

Hi,
BGp requires IGP OR static route
to teach 2.2.2.2 from R1 does it not requires a route ?
in your config there is no such route
Please clarify
Thanks

Hello Sims

In order for BGP to function, you require the use of an IGP or static routing within an autonomous system (AS). This will allow iBGP routers to exchange information between them. All routes advertised between AS’es are advertised using only eBGP, and not any IGPs.

In the specific example in this lesson, 2.2.2.2 is in another AS from the point of view of R1, so any routing information found for this particular destination will only be learned via eBGP.

I hope this has been helpful!

Laz

Why Igp Or static route required for iBGp
Thanks

Hello Sims

Remember that the primary purpose of BGP is to route traffic between Autonomous Systems (AS’es). This is achieved using eBGP which is essentially the creation of BGP peerings between routers in different AS’es, or between routers on the edge different AS’es.

Now within an AS, you have iBGP, which is the result of peerings between routers in the same AS. The purpose of iBGP is to inform the edge routers (which form eBGP peerings with routers of other AS’es) of internal destination networks. In order for BGP peerings to take place, routing between those routers must exist. Unlike IGPs, which require a direct link between neighbors, iBGP peerings can take place over several hops. In order for BGP peers to communicate, some sort of routing between them is necessary.

Remember, that an IGP or static routing is necessary within AS’es to allow iBGP to share internal routes with all internal BGP routers. This in turn allows all of the edge routers in the AS to share these routes using eBGP with other AS’es.

I hope this has been helpful!

Laz

1 Like

Hello,

I tried to comprehend the reasoning behind this but couldn’t figure it out - I read in many articles that OSPF should not be configured on the edge router (we should have BGP since its scalable, traffic engineering is lot easier .etc ). But what if ISP sends only the default route? Can we run OSPF with ISP? What are its implications ?

Hello Manu

The edge of an enterprise network that connects with the Internet must run BGP since BGP is the routing protocol used on the Internet. There is no choice. However, the question arises “what is the edge of the enterprise network?” This depends on the kind of connection and policies that your ISP provides you with.

By definition, the edge router of any network is the one that connects to the Internet, the one that actually runs BGP. But your ISP may provide you with an implementation where the actual edge router is on their network. So they provide you with a circuit that has a private IP address as the default route, and you configure only IGPs on your network. You may have a router that connects directly with this circuit, and you may call it the “edge router” but in fact, it is not. In this case, the real edge router resides on the ISP’s network.

Alternatively, the ISP may choose to have an architecture that allows you to run BGP on your edge router, where your router creates BGP peers with the ISP’s routers. In this case, the edge router is indeed on your own premises.

I hope this has been helpful!

Laz

1 Like

Thank you Lazaros!!!

1 Like

Excellent stuff.
Is it good practice to use loopback interfaces for eBGP as well? If so would static routes be the ‘right’ way to achieve connectivity along with multihop?

Thanks!