Do you want to use a BGP router? You don't have to spend money to buy it. In this tutorial, you use CentOS as one (1)

Source: Internet
Author: User

Do you want to use a BGP router? You don't have to spend money to buy it. In this tutorial, you use CentOS as one (1)

Before we enter the details, some background knowledge about BGP is necessary. Border Gateway Protocol (BGP) is the actual standard of the Inter-Domain Routing Protocol of the Internet. In BGP terms, the global Internet is composed of thousands of associated Autonomous Systems (AS), each of which represents a network management domain provided by each specific operator. It is said that the former US president George. both have their own AS numbers ).

In order to make its network accessible on a global scale, each AS needs to know how to reach other AS in the Internet. At this time, BGP is required to assume this role. BGP is a language for AS to exchange routing information with adjacent. These routing information is usually called a BGP line or a BGP prefix. Including the AS number (ASN; a globally unique number) and related IP address blocks. Once all BGP lines are learned and recorded by the local BGP Route table, each AS will know how to reach any public IP address on the Internet.

The routing capability between different domains (AS) is the main reason why BGP is called the external Gateway Protocol (EGP) or the Inter-Domain protocol. For example, some routing protocols, such as OSPF, IS-IS, RIP, and OSPF, are both internal gateway protocols (IGPs) or intra-domain routing protocols used to process routes in one domain.

Test Plan

In this tutorial, let's use the following topology.

Assume that carrier A wants to establish a bgp peer-to-peer exchange route with carrier B. The details of their AS numbers and IP address space are AS follows:

  • Carrier: ASN (100), IP address space (100.100.0.0/22), IP address allocated to the BGP router eth1 NIC (100.100.1.1)

  • Carrier B: ASN (200), IP address space (200.200.0.0/22), IP address allocated to the BGP router eth1 NIC (200.200.1.1)

Vroa A and vrob B use the 100.100.0.0/30 subnet to connect to each other. Theoretically, any subnet is reachable and connectable from the operator. In real scenarios, we recommend that you use A public IP address space with A 30-bit mask to connect carrier A and carrier B.

Install Quagga in CentOS

If Quagga has not been installed, we can use yum to install Quagga.

 
 
  1. # yum install quagga

If you are using CentOS7, you need to apply a policy to set SELinux. Otherwise, SElinux will prevent the Zebra daemon from writing to its configuration directory. If you are using CentOS6, skip this step.

 
 
  1. # setsebool -P zebra_write_config 1

The Quagga software kit contains several daemon processes that can work together. For BGP routing, we will focus on establishing the following two daemon processes.

  • Zebra: A core daemon is used for Kernel interfaces and Static Routing.
  • BGPd: A bgp daemon.
Configuration Logging

After Quagga is installed, configure Zebra to manage the network interfaces of the BGP router. We start the first step by creating a Zebra configuration file and enabling logging.

 
 
  1. # cp /usr/share/doc/quagga-XXXXX/zebra.conf.sample /etc/quagga/zebra.conf

In CentOS6:

 
 
  1. # service zebra start
  2. # chkconfig zebra on

In CentOS7:

 
 
  1. # systemctl start zebra
  2. # systemctl enable zebra

Quagga provides a command line tool unique to vtysh. You can enter commands that are compatible with and supported by vro vendors (such as Cisco and Juniper. We will use vtysh shell to configure BGP routing in the rest of the tutorial.

Start the vtysh shell command and enter:

 
 
  1. # vtysh

The prompt will be changed to this host name, which indicates that you are in vtysh shell.

 
 
  1. Router-A#

Now we will use the following command to configure the log file for Zebra:

 
 
  1. Router-A# configure terminal
  2. Router-A(config)# log file /var/log/quagga/quagga.log
  3. Router-A(config)# exit

Permanently Save the Zebra Configuration:

 
 
  1. Router-A# write

Perform the same steps on vrob B.

Configure peer IP addresses

Next, we will configure the peer IP address on the available interface.

 
 
  1. Router-A # show interface # display interface information
 
 
  1. Interface eth0 is up, line protocol detection is disabled
  2. . . . . .
  3. Interface eth1 is up, line protocol detection is disabled
  4. . . . . .

Configure the parameters of the eth0 interface:

 
 
  1. site-A-RTR# configure terminal
  2. site-A-RTR(config)# interface eth0
  3. site-A-RTR(config-if)# ip address 100.100.0.1/30
  4. site-A-RTR(config-if)# description "to Router-B"
  5. site-A-RTR(config-if)# no shutdown
  6. site-A-RTR(config-if)# exit

Continue to configure the parameters of the eth1 interface:

 
 
  1. site-A-RTR(config)# interface eth1
  2. site-A-RTR(config-if)# ip address 100.100.1.1/24
  3. site-A-RTR(config-if)# description "test ip from provider A network"
  4. site-A-RTR(config-if)# no shutdown
  5. site-A-RTR(config-if)# exit

Now confirm the Configuration:

 
 
  1. Router-A# show interface
 
 
  1. Interface eth0 is up, line protocol detection is disabled
  2. Description: "to Router-B"
  3. inet 100.100.0.1/30 broadcast 100.100.0.3
  4. Interface eth1 is up, line protocol detection is disabled
  5. Description: "test ip from provider A network"
  6. inet 100.100.1.1/24 broadcast 100.100.1.255
 
 
  1. Router-A # show interface description # display interface description
 
 
  1. Interface Status Protocol Description
  2. eth0 up unknown "to Router-B"
  3. eth1 up unknown "test ip from provider A network"

If everything looks normal, do not forget to save the configuration.

 
 
  1. Router-A# write

Similarly, repeat the configuration in vrob B.

Before proceeding to the next step, make sure that the IP addresses of each other can be pinged.

 
 
  1. Router-A# ping 100.100.0.2
 
 
  1. PING 100.100.0.2 (100.100.0.2) 56(84) bytes of data.
  2. 64 bytes from 100.100.0.2: icmp_seq=1 ttl=64 time=0.616 ms

Next, we will continue to configure BGP peer and prefix settings.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.