Difference between revisions of "BGP"
Line 33: | Line 33: | ||
1. Our AS Number is AS64512 | 1. Our AS Number is AS64512 | ||
2. Our IP Subnet is 192.168.0.0/24 | 2. Our IP Subnet is 192.168.0.0/24 | ||
3. Our Transit Peer BGP Router is 10.0.0.1 | 3. Our Transit Peer BGP Router is 10.0.0.1 | ||
4. Our IP Address on the Transit Network is 10.0.0.2 | 4. Our IP Address on the Transit Network is 10.0.0.2 | ||
5. Our Transit's AS Number is AS65513 | 5. Our Transit's AS Number is AS65513 | ||
6. Our Free Peer BGP Router is 172.16.0.1 | 6. Our Free Peer BGP Router is 172.16.0.1 | ||
7. Our IP Address on the Free Peer Network is 172.16.0.2 | 7. Our IP Address on the Free Peer Network is 172.16.0.2 | ||
8. Our Free Peer's AS Number is AS65514 | 8. Our Free Peer's AS Number is AS65514 | ||
9. Our Free Peer's IP Subnet is 192.168.1.0/24 | 9. Our Free Peer's IP Subnet is 192.168.1.0/24 | ||
10. Our Customer Peer BGP Router is 192.168.0.3 | 10. Our Customer Peer BGP Router is 192.168.0.3 | ||
11. Our Customer Peer IP Address on our network is 192.168.0.3 | 11. Our Customer Peer IP Address on our network is 192.168.0.3 | ||
12. Our Customer Peer AS Number is AS65515 | 12. Our Customer Peer AS Number is AS65515 | ||
13. Our Customer Peer IP Subnet is 192.168.2.0/24 | 13. Our Customer Peer IP Subnet is 192.168.2.0/24 | ||
router bgp 64512 | router bgp 64512 |
Revision as of 18:27, 6 July 2009
BGP is oriented toward the largest scale, such as the entire Internet. It might be used by an ISP who has multiple attachment points to the Internet from different upstream providers.
To use BGP to peer on the Internet you must have an AS Number and a public IP Subnet assigned to you.
BGP can be as simple as you want to make it.
To setup BGP you need to peer with someone else using BGP. This other network is called a "peer"
There are 3 types of neighbour relationship you can have on your BGP network.
1. Transit peer - this is a peer which you are paying for bandwidth
With Transit peers they will send you a full routing table, this table allowing your network know how to connect to hosts across the Internet
2. Free Peer - this a peer where two networks connect to share traffic.
Peers of this nature will usually not provide each other with a full routing table, but will provide each other with the IP Subnet (Networks) they each advertise, therefore you can send traffic to this peer bypassing your paid transit.
Peering like this is usually completed at Internet Exchange Points (IX or IXP)
3. Customer peer - this is where a customer is paying you for bandwidth.
In this case you are acting as the Transit peer for your customer and you need to provide them with access to all hosts on the Internet (via either default routes or a full routing table)
the following example shows a Sample BGP script used with StarOS v3 X86 Server Edition to peer with 1 Transit peer, 1 free peer and 1 customer.
The customer route is prefered, next is the free peer, and last is the transit peer.
I've used the following details for this example
1. Our AS Number is AS64512
2. Our IP Subnet is 192.168.0.0/24
3. Our Transit Peer BGP Router is 10.0.0.1
4. Our IP Address on the Transit Network is 10.0.0.2
5. Our Transit's AS Number is AS65513
6. Our Free Peer BGP Router is 172.16.0.1
7. Our IP Address on the Free Peer Network is 172.16.0.2
8. Our Free Peer's AS Number is AS65514
9. Our Free Peer's IP Subnet is 192.168.1.0/24
10. Our Customer Peer BGP Router is 192.168.0.3
11. Our Customer Peer IP Address on our network is 192.168.0.3
12. Our Customer Peer AS Number is AS65515
13. Our Customer Peer IP Subnet is 192.168.2.0/24
router bgp 64512 bgp router-id 10.0.0.2 network 192.168.0.0/24
neighbor 10.0.0.1 remote-as 65513 neighbor 10.0.0.1 description Transit Peer neighbor 10.0.0.1 soft-reconfiguration inbound neighbor 10.0.0.1 prefix-list IP-Transit-in in neighbor 10.0.0.1 prefix-list IP-out out neighbor 10.0.0.1 route-map AS-Transit-in in neighbor 10.0.0.1 route-map AS-out out neighbor 172.16.0.1 remote-as 65514 neighbor 172.16.0.1 description Free Peer neighbor 172.16.0.1 soft-reconfiguration inbound neighbor 172.16.0.1 prefix-list IP-Free-Peer-in in neighbor 172.16.0.1 prefix-list IP-out out neighbor 172.16.0.1 route-map AS-Free-Peer-in in neighbor 172.16.0.1 route-map AS-out out neighbor 192.168.0.3 remote-as 65514 neighbor 192.168.0.3 description Customer neighbor 192.168.0.3 soft-reconfiguration inbound neighbor 192.168.0.3 prefix-list IP-Customer-in in neighbor 192.168.0.3 prefix-list IP-Customer-out out neighbor 192.168.0.3 route-map AS-Customer-in in neighbor 192.168.0.3 route-map AS-Customer-out out
ip prefix-list IP-Transit-in seq 10 permit any ip prefix-list IP-out seq 10 permit 192.168.0.0/24 ip prefix-list IP-out seq 20 permit 192.168.2.0/24 ip prefix-list IP-Free-Peer-in seq 10 permit 192.168.1.0/24 ip prefix-list IP-Free-Peer-in seq 10 deny any ip prefix-list IP-Customer-in seq 10 permit 192.168.2.0/24 ip prefix-list IP-Customer-in seq 20 deny any ip prefix-list IP-Customer-out seq 10 permit any
ip as-path access-list 1 permit .* ip as-path access-list 3 permit ^65512$ ip as-path access-list 3 permit ^65514$ ip as-path access-list 3 permit ^$ ip as-path access-list 65513 permit ^65513$
route-map AS-Transit-in permit 10 match as-path 1 set local-preference 80 route-map AS-out permit 10 match as-path 3 route-map AS-Free-Peer-in permit 10 match as-path 65513 set local-preference 100 route-map AS-Customer-in permit 10 match as-path 65514 set local-preference 120 route-map AS-Customer-out permit 10 match as-path 1