How-To: Setting up BGP on Vyatta — page 2 — Network interfaces

1 minute read

Now that we have defined what we will be setting up, let’s build this up.

2. Setting the network interfaces

During this part, we are going to set up the 2 Border Gateway routers’network interfaces. In vyatta world, you need to enter the interactive configuration shell by typing:

vyatta@vyatta-bgp1:~$ configure
[edit]
vyatta@vyatta-bgp1#

2.1. vyatta-bgp1

Once you are in edition mode, type the following to set up eth0, eth1 and eth2:

[edit]
vyatta@vyatta-bgp1# set interfaces ethernet eth0 address 192.168.2.10/24
[edit]
vyatta@vyatta-bgp1# set interfaces ethernet eth1 address 172.16.163.1/24
[edit]
vyatta@vyatta-bgp1# set interfaces ethernet eth2 address 1.1.1.1/24

Then, set up the default route to be 192.168.2.1:

[edit]
vyatta@vyatta-bgp1# set system gateway-address 192.168.2.1

and optionally you can set the DNS server to query:

[edit]
vyatta@vyatta-bgp1# set system name-server 192.168.2

and finally commit and save so the setting stays upon reboot:

[edit]
vyatta@vyatta-bgp1# commit
[edit]
vyatta@vyatta-bgp1# save
Saving configuration to '/opt/vyatta/etc/config/config.boot'...
Done

2.2. vyatta-bgp2

On vyatta-bgp2, the settings are similar except that we have to change some addressing. Here is the resulting command line serie:

[edit]
vyatta@vyatta-bgp2# set interfaces ethernet eth0 address 192.168.2.20/24
[edit]
vyatta@vyatta-bgp2# set interfaces ethernet eth1 address 172.16.163.2/24
[edit]
vyatta@vyatta-bgp2# set interfaces ethernet eth2 address 2.2.2.2/24
[edit]
vyatta@vyatta-bgp2# set system gateway-address 192.168.2.1
[edit]
vyatta@vyatta-bgp2# set system name-server 192.168.2.1
[edit]
vyatta@vyatta-bgp2# commit
[edit]
vyatta@vyatta-bgp2# save
Saving configuration to '/opt/vyatta/etc/config/config.boot'...
Done

2.3. Resulting routes

At this stage, the route table on vyatta-bgp1 looks like:

vyatta-bgp1:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG    0      0        0 eth0
1.1.1.0         0.0.0.0         255.255.255.0   U     0      0        0 eth2
172.16.163.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

and on vyatta-bgp2:

vyatta414-tpl:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG    0      0        0 eth0
2.2.2.0         0.0.0.0         255.255.255.0   U     0      0        0 eth2
172.16.163.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

And thus, the default gateway of vyatta-bgp1 and vyatta-bgp2 will be used when attempting to contact respectively 2.2.2.0/24 and 1.1.1.0/24.

We now need to set up BGP on those 2 servers to advertise new routes to each others.