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:

[email protected]:~$ configure
[edit]
[email protected]#

2.1. vyatta-bgp1

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

[edit]
[email protected]# set interfaces ethernet eth0 address 192.168.2.10/24
[edit]
[email protected]# set interfaces ethernet eth1 address 172.16.163.1/24
[edit]
[email protected]# set interfaces ethernet eth2 address 1.1.1.1/24

Then, set up the default route to be 192.168.2.1:

[edit]
[email protected]# set system gateway-address 192.168.2.1

and optionally you can set the DNS server to query:

[edit]
[email protected]# set system name-server 192.168.2

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

[edit]
[email protected]# commit
[edit]
[email protected]# 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]
[email protected]# set interfaces ethernet eth0 address 192.168.2.20/24
[edit]
[email protected]# set interfaces ethernet eth1 address 172.16.163.2/24
[edit]
[email protected]# set interfaces ethernet eth2 address 2.2.2.2/24
[edit]
[email protected]# set system gateway-address 192.168.2.1
[edit]
[email protected]# set system name-server 192.168.2.1
[edit]
[email protected]# commit
[edit]
[email protected]# 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.