Knowledgebase

Configuring BGP on Vultr With OpenBSD Print

  • 0

Rcs's BGP feature allows you to bring your own IP space and use it across any of our locations, with an OpenBSD instance no additional software is needed!

Getting started

In order to use BGP, you would need your own IP space (either v4 or v6). If you have your own ASN, you can use that or we can assign a private one.

Open a ticket with the following information:

  • Your IP ranges
  • Your ASN (if you have one)
  • A LOA for your IP ranges (only if you don't have your own ASN)

Once BGP has been configured on your account, you can proceed with configuring BGP.

Our examples are going to use the following:

  • ASN: 64512
  • Instance's IPv4 address: 203.0.113.123
  • Instance's IPv6 address: 2001:DB8:1000::1/64
  • IPv4 Block: 198.51.100.0/24
  • IPv6 Block: 2001:0db8::/32
  • BGP Password: hunter2

BGP Setup

OpenBSD ships with bgpd(8) already installed and only requires a few configuration file changes to start.

Edit rc.conf.local(8) to add the following line to allow the bgpd(8) daemon to start via rc.d(8)

bgpd_flags=

A complete example of bgpd.conf(8) can be found at /etc/examples/bgpd.conf and contains lots of extra configuration options you may need.

Adjust the example configuration below as required and write to /etc/bgpd.conf (ensure that the permissions for this file are 600)

   AS 64512
    router-id 203.0.113.123

    listen on 127.0.0.1
    listen on ::1
    log updates
    network 198.51.100.0/24
    network 2001:0db8::/32

    neighbor 169.254.169.254 {
            remote-as               64515
            descr                   "Rcs IPv4"
            announce IPv4           unicast
            announce IPv6           none
            tcp md5sig password     hunter2
            multihop                2
            local-address           203.0.113.123
    }
    neighbor 2001:19f0:ffff::1 {
            remote-as               64515
            descr                   "Rcs IPv6"
            announce IPv4           none
            announce IPv6           unicast
            tcp md5sig password     hunter2
            multihop                2
            local-address           2001:DB8:1000::1
    }

To make sure everything is in order, you can issue the command bgpd -f /etc/bgpd.conf -n. If bgpd(ok) is returned, you can start the daemon.

# rcctl enable bgpd
# rcctl start bgpd
bgpd(ok)

To check the status of your BGP sessions, you will need to use bgpctl(8). For example, to see a basic overview you can use bgpctl show summary

# bgpctl show summary
Neighbor                   AS    MsgRcvd    MsgSent  OutQ Up/Down  State/PrfRcvd
Rcs IPv6              64515        230        207     0 01:41:40      0
Rcs IPv4              64515        244        220     0 01:48:09      0

To see detailed information about a BPG neighbor use bgpctl show neighbor

BGP neighbor is 2001:19f0:ffff::1, remote AS 64515, Multihop (2)
 Description: Rcs IPv6
  BGP version 4, remote router-id 45.63.102.186, using md5sig
  BGP state = Established, up for 01:46:45
  Last read 00:00:08, holdtime 90s, keepalive interval 30s
  Neighbor capabilities:
    Multiprotocol extensions: IPv6 unicast
    Route Refresh
    Graceful Restart: Timeout: 120, IPv6 unicast
    4-byte AS numbers

  Message statistics:
		  Sent       Received  
  Opens                    1          1
  Notifications            0          0
  Updates                  2          1
  Keepalives             214        240
  Route Refresh            0          0
  Total                  217        242

  Update statistics:
		  Sent       Received  
  Updates                  4          0
  Withdraws                0          0
  End-of-Rib               1          1

  Local host:  2001:DB8:1000::1, Local port:  38298
  Remote host:    2001:19f0:ffff::1, Remote port:   179

BGP neighbor is 169.254.169.254, remote AS 64515, Multihop (2)
 Description: Rcs IPv4
  BGP version 4, remote router-id 45.63.102.186, using md5sig
  BGP state = Established, up for 01:53:14
  Last read 00:00:14, holdtime 90s, keepalive interval 30s
  Neighbor capabilities:
    Multiprotocol extensions: IPv4 unicast
    Route Refresh
    Graceful Restart: Timeout: 120, IPv4 unicast
    4-byte AS numbers

  Message statistics:
		  Sent       Received  
  Opens                    1          1
  Notifications            0          0
  Updates                  2          1
  Keepalives             227        253
  Route Refresh            0          0
  Total                  230        255

  Update statistics:
		  Sent       Received  
  Updates                  4          0
  Withdraws                0          0
  End-of-Rib               1          1

  Local host:         203.0.113.123, Local port:  19824
  Remote host:      169.254.169.254, Remote port:   179

At this point we can start assigning our IP addresses to interfaces (e.g. by configuring /etc/hostname.lo1 ) so applications can be configured to listen on these IPs.

If you intend to use your IP addresses on multiple instances you will need to adjust the network statements on each instance to announce a more specific route for those IPs.

Instance A

   AS 64512
    router-id 203.0.113.123

    listen on 127.0.0.1
    listen on ::1
    log updates
    network 198.51.100.0/24
    network 198.51.100.1/32
    network 2001:0db8::/32
    network 2001:0db8::/64

    neighbor 169.254.169.254 {
            remote-as               64515
            descr                   "Rcs IPv4"
            announce IPv4           unicast
            announce IPv6           none
            tcp md5sig password     hunter2
            multihop                2
            local-address           203.0.113.123
    }
    neighbor 2001:19f0:ffff::1 {
            remote-as               64515
            descr                   "Rcs IPv6"
            announce IPv4           none
            announce IPv6           unicast
            tcp md5sig password     hunter2
            multihop                2
            local-address           2001:DB8:1000::1
    }

Instance B

   AS 64512
    router-id 203.0.113.124

    listen on 127.0.0.1
    listen on ::1
    log updates
    network 198.51.100.0/24
    network 198.51.100.2/32
    network 2001:0db8::/32
    network 2001:0db8:0001::/64

    neighbor 169.254.169.254 {
            remote-as               64515
            descr                   "Rcs IPv4"
            announce IPv4           unicast
            announce IPv6           none
            tcp md5sig password     hunter2
            multihop                2
            local-address           203.0.113.124
    }
    neighbor 2001:19f0:ffff::1 {
            remote-as               64515
            descr                   "Rcs IPv6"
            announce IPv4           none
            announce IPv6           unicast
            tcp md5sig password     hunter2
            multihop                2
            local-address           2001:DB8:1000::2
    }

Note: Do not forget to use a different password from what is referenced in this article.

Rcs's BGP feature allows you to bring your own IP space and use it across any of our locations, with an OpenBSD instance no additional software is needed! Getting started In order to use BGP, you would need your own IP space (either v4 or v6). If you have your own ASN, you can use that or we can assign a private one. Open a ticket with the following information: Your IP ranges Your ASN (if you have one) A LOA for your IP ranges (only if you don't have your own ASN) Once BGP has been configured on your account, you can proceed with configuring BGP. Our examples are going to use the following: ASN: 64512 Instance's IPv4 address: 203.0.113.123 Instance's IPv6 address: 2001:DB8:1000::1/64 IPv4 Block: 198.51.100.0/24 IPv6 Block: 2001:0db8::/32 BGP Password: hunter2 BGP Setup OpenBSD ships with bgpd(8) already installed and only requires a few configuration file changes to start. Edit rc.conf.local(8) to add the following line to allow the bgpd(8) daemon to start via rc.d(8) bgpd_flags= A complete example of bgpd.conf(8) can be found at /etc/examples/bgpd.conf and contains lots of extra configuration options you may need. Adjust the example configuration below as required and write to /etc/bgpd.conf (ensure that the permissions for this file are 600) AS 64512 router-id 203.0.113.123 listen on 127.0.0.1 listen on ::1 log updates network 198.51.100.0/24 network 2001:0db8::/32 neighbor 169.254.169.254 { remote-as 64515 descr "Rcs IPv4" announce IPv4 unicast announce IPv6 none tcp md5sig password hunter2 multihop 2 local-address 203.0.113.123 } neighbor 2001:19f0:ffff::1 { remote-as 64515 descr "Rcs IPv6" announce IPv4 none announce IPv6 unicast tcp md5sig password hunter2 multihop 2 local-address 2001:DB8:1000::1 } To make sure everything is in order, you can issue the command bgpd -f /etc/bgpd.conf -n. If bgpd(ok) is returned, you can start the daemon. # rcctl enable bgpd # rcctl start bgpd bgpd(ok) To check the status of your BGP sessions, you will need to use bgpctl(8). For example, to see a basic overview you can use bgpctl show summary # bgpctl show summary Neighbor AS MsgRcvd MsgSent OutQ Up/Down State/PrfRcvd Rcs IPv6 64515 230 207 0 01:41:40 0 Rcs IPv4 64515 244 220 0 01:48:09 0 To see detailed information about a BPG neighbor use bgpctl show neighbor BGP neighbor is 2001:19f0:ffff::1, remote AS 64515, Multihop (2) Description: Rcs IPv6 BGP version 4, remote router-id 45.63.102.186, using md5sig BGP state = Established, up for 01:46:45 Last read 00:00:08, holdtime 90s, keepalive interval 30s Neighbor capabilities: Multiprotocol extensions: IPv6 unicast Route Refresh Graceful Restart: Timeout: 120, IPv6 unicast 4-byte AS numbers Message statistics: Sent Received Opens 1 1 Notifications 0 0 Updates 2 1 Keepalives 214 240 Route Refresh 0 0 Total 217 242 Update statistics: Sent Received Updates 4 0 Withdraws 0 0 End-of-Rib 1 1 Local host: 2001:DB8:1000::1, Local port: 38298 Remote host: 2001:19f0:ffff::1, Remote port: 179 BGP neighbor is 169.254.169.254, remote AS 64515, Multihop (2) Description: Rcs IPv4 BGP version 4, remote router-id 45.63.102.186, using md5sig BGP state = Established, up for 01:53:14 Last read 00:00:14, holdtime 90s, keepalive interval 30s Neighbor capabilities: Multiprotocol extensions: IPv4 unicast Route Refresh Graceful Restart: Timeout: 120, IPv4 unicast 4-byte AS numbers Message statistics: Sent Received Opens 1 1 Notifications 0 0 Updates 2 1 Keepalives 227 253 Route Refresh 0 0 Total 230 255 Update statistics: Sent Received Updates 4 0 Withdraws 0 0 End-of-Rib 1 1 Local host: 203.0.113.123, Local port: 19824 Remote host: 169.254.169.254, Remote port: 179 At this point we can start assigning our IP addresses to interfaces (e.g. by configuring /etc/hostname.lo1 ) so applications can be configured to listen on these IPs. If you intend to use your IP addresses on multiple instances you will need to adjust the network statements on each instance to announce a more specific route for those IPs. Instance A AS 64512 router-id 203.0.113.123 listen on 127.0.0.1 listen on ::1 log updates network 198.51.100.0/24 network 198.51.100.1/32 network 2001:0db8::/32 network 2001:0db8::/64 neighbor 169.254.169.254 { remote-as 64515 descr "Rcs IPv4" announce IPv4 unicast announce IPv6 none tcp md5sig password hunter2 multihop 2 local-address 203.0.113.123 } neighbor 2001:19f0:ffff::1 { remote-as 64515 descr "Rcs IPv6" announce IPv4 none announce IPv6 unicast tcp md5sig password hunter2 multihop 2 local-address 2001:DB8:1000::1 } Instance B AS 64512 router-id 203.0.113.124 listen on 127.0.0.1 listen on ::1 log updates network 198.51.100.0/24 network 198.51.100.2/32 network 2001:0db8::/32 network 2001:0db8:0001::/64 neighbor 169.254.169.254 { remote-as 64515 descr "Rcs IPv4" announce IPv4 unicast announce IPv6 none tcp md5sig password hunter2 multihop 2 local-address 203.0.113.124 } neighbor 2001:19f0:ffff::1 { remote-as 64515 descr "Rcs IPv6" announce IPv4 none announce IPv6 unicast tcp md5sig password hunter2 multihop 2 local-address 2001:DB8:1000::2 } Note: Do not forget to use a different password from what is referenced in this article.

Was this answer helpful?
Back

Powered by WHMCompleteSolution