RT 借了一个asn和一个c段后,在vultr上学着配置了bgp互连和广播相关
其中涉及一些非技术向的内容,需要有一些耐心,系统依旧是debian 9 + root账号
1、申请广播
给vultr客服发工单,告知你要用bgp功能,他们会给你开通这个功能在你的面板上
拿到入口的url后,选择“我拥有私有asn”和“我拥有私有ip段”并输入你的as号和你的ip段落,并设置一个互连密码,然后写一封LOA(letter of authorization),模版如下:
AUTHORIZATION LETTER 今天的日期 To whom it may concern, This letter serves as authorization for Vultr with 你的AS号 to announce the following IP address blocks: 你的ip段 / 你的as号 As a representative of the company Aiyun Technology Co.,Ltd that is the owner of the subnet and/or ASN, I hereby declare that I'm authorized to represent and sign for this LOA. Should you have questions about this request, email me at 你的邮箱, or call: 你的电话 From, 你的名字 你的公司名 你的职位 你的电话
*(这个模版是vultr给我的,其他几家的话请自行向服务商索要,或者问清楚公司名后将vultr修改为你的提供商给你的名字)
用txt保存后,上传到附件上然后提交等待审核即可。
审核通过后,会在页面上显示两个确认身份的url,点击后会让你选择在whois上查询到的这个ip和这个asn的邮箱,选择后送信,然后等待邮件到达后,点击确认的链接确认即可。
确认完成后这一步就完成了。
2、配置广播
一般需要等待24-48小时,或者你发一个工单让他们提醒你,等他们通知你可用后,就可以开始配置了。
首先进入服务器的详情页面,最后面会多出来一个bgp选项卡,里面提供了vu的互连ip等信息,下面有一个配置模版可以打开(因为里面就是写好的配置文件,其实你直接复制都是可以的)
登陆服务器,安装bird
apt-get install bird
安装完成后先关闭掉服务
systemctl stop bird.service systemctl stop bird6.service
然后修改配置文件
vim /etc/bird/bird.conf
router id <Instance里的ip>;
protocol bgp vultr
{
local as <你的as号>;
source address <Instance里的ip>;
import none;
export all;
graceful restart on;
multihop 2;
neighbor <Vultr里的ip> as <Vultr里的as号>;
password "<Vultr里的密码>";
}
protocol static
{
route <你计划用的ip段>/24 via <Instance里的ip>;
}
protocol device
{
scan time 5;
}
多台服务器的时候一定要提前规划好自己的ip划分并做好文档记录,要不然等以后再改会比较麻烦,用多少ip只需要修改static部分即可。
保存退出,然后启动bird
systemctl start bird.service
之后可以检查一下是否正常工作
birdc show proto all vultr
BIRD 1.4.5 ready.
name proto table state since info
vultr BGP master up 14:11:36 Established
Preference: 100
Input filter: REJECT
Output filter: (unnamed)
Routes: 0 imported, 581634 filtered, 1 exported, 0 preferred
Route change stats: received rejected filtered ignored accepted
Import updates: 581674 0 581674 0 0
Import withdraws: 2 0 --- 581675 0
Export updates: 1 0 0 --- 1
Export withdraws: 0 --- --- --- 0
BGP state: Established
Neighbor address: 169.254.169.254
Neighbor AS: 64515
Neighbor ID: 169.254.169.254
Neighbor caps: refresh restart-able AS4
Session: external multihop AS4
Source address: 203.0.113.123
Hold timer: 208/240
Keepalive timer: 57/80
(输出信息参考了vultr的官方docs:Configuring BGP on Vultr)
重点查看info应该是Established状态
之后进行系统里ip的配置
ip addr add <你的ip>/24 dev <你的网卡名字>
然后可以查看一下是否生效:
ip addr
如果里面有你刚才添加过的地址即为生效
然后就可以从公网ping一下看一看,正常情况下就已经通了
为了方便我们也可以直接写一个永久的到interfaces里面
vim /etc/network/interfaces
auto <网卡名>:1
iface <网卡名>:1 inet static
address <你的ip>
netmask <子网掩码>
完成后保存退出即可,可以直接用ifup立刻启动起来
以上就是配置的全部教程~