文章介绍:本篇主要介绍博主在vyos中配置路由分流的方法,基于博主更新的docker镜像实现在vyos中配置路由分流功能,在我的docker hub镜像库中,bgpserver镜像目前存放着三个镜像,本篇将详细说明在vyos中的使用方法和注意事项。
一、bgpserver:cn
1.1、config.ini配置
sudo nano /config/config.ini
[server]
RouterId = 100.66.66.2
ASN = 65000
NextHop = 10.225.97.1
UpdateSource = 100.66.66.2
[peer]
IP = 100.66.66.1
ASN = 65000
1.2、拉取镜像
add container image docker.io/yangpin/bgpserver:cn
sudo podman pull docker.io/yangpin/bgpserver:cn
1.3、vyos完整配置
set container name bgpserver cap-add 'net-admin'
set container name bgpserver cap-add 'sys-admin'
set container name bgpserver host-name 'bgpserver'
set container name bgpserver image 'docker.io/yangpin/bgpserver:cn'
set container name bgpserver memory '2048'
set container name bgpserver network bgpnetwork address '100.66.66.2'
set container name bgpserver restart 'always'
set container name bgpserver volume config destination '/opt/config.ini'
set container name bgpserver volume config source '/config/config.ini'
set container network bgpnetwork prefix '100.66.66.0/30'
set interfaces ethernet eth0 address '10.225.97.9/24'
set nat source rule 100 outbound-interface name 'eth0'
set nat source rule 100 source address '100.66.66.0/30'
set nat source rule 100 translation address 'masquerade'
set protocols bgp neighbor 100.66.66.2 address-family ipv4-unicast soft-reconfiguration inbound
set protocols bgp neighbor 100.66.66.2 remote-as '65000'
set protocols bgp neighbor 100.66.66.2 update-source '100.66.66.1'
set protocols bgp system-as '65000'
set protocols bgp timers holdtime '15'
set protocols bgp timers keepalive '3'
set protocols static route 0.0.0.0/0 next-hop 10.225.97.6
set service ssh port '22'
set system name-server '223.5.5.5'
set system name-server '223.6.6.6'
set container name bgpserver cap-add 'net-admin'
: 为名为 "bgpserver" 的容器添加网络管理权限。set container name bgpserver cap-add 'sys-admin'
: 为名为 "bgpserver" 的容器添加系统管理权限。set container name bgpserver host-name 'bgpserver'
: 设置名为 "bgpserver" 的容器的主机名为 "bgpserver"。set container name bgpserver image 'docker.io/yangpin/bgpserver:cn'
: 指定名为 "bgpserver" 的容器使用的镜像为 "docker.io/yangpin/bgpserver:cn"。set container name bgpserver memory '2048'
: 设置名为 "bgpserver" 的容器的内存限制为 2048MB。set container name bgpserver network bgpnetwork address '100.66.66.2'
: 将名为 "bgpserver" 的容器连接到名为 "bgpnetwork" 的网络,并分配给容器的 IP 地址为 100.66.66.2。set container name bgpserver restart 'always'
: 设置名为 "bgpserver" 的容器在退出时总是重新启动。set container name bgpserver volume config destination '/opt/config.ini'
: 将名为 "bgpserver" 的容器的配置文件存储到宿主机上的 '/opt/config.ini' 目录中。set container name bgpserver volume config source '/config/config.ini'
: 将宿主机上的 '/config/config.ini' 文件挂载到名为 "bgpserver" 的容器中。set container network bgpnetwork prefix '100.66.66.0/30'
: 配置名为 "bgpnetwork" 的网络的 IP 前缀为 '100.66.66.0/30'。set interfaces ethernet eth0 address '10.225.97.10/24'
: 配置以太网接口 'eth0' 的 IP 地址为 '10.225.97.10/24'。set nat source rule 100 outbound-interface name 'eth0'
: 设置 NAT 源地址转换规则,匹配出接口 'eth0' 的流量。set nat source rule 100 source address '100.66.66.0/30'
: 指定 NAT 源地址转换规则的源地址为 '100.66.66.0/30'。set nat source rule 100 translation address 'masquerade'
: 设置 NAT 源地址转换规则中的转换地址为 'masquerade'(伪装,即使用外部 IP 地址)。set protocols bgp neighbor 100.66.66.2 address-family ipv4-unicast soft-reconfiguration inbound
: 配置 BGP 邻居 '100.66.66.2' 支持 IPv4 单播地址族,并启用入站软重配置。set protocols bgp neighbor 100.66.66.2 remote-as '65000'
: 设置 BGP 邻居 '100.66.66.2' 的远程自治系统号为 '65000'。set protocols bgp neighbor 100.66.66.2 update-source '100.66.66.1'
: 设置 BGP 邻居 '100.66.66.2' 的更新消息的源 IP 地址为 '100.66.66.1'。set protocols bgp system-as '65000'
: 配置本地 BGP 实例的自治系统号为 '65000'。set protocols bgp timers holdtime '15'
: 设置 BGP 协议的保持时间为 '15' 秒。set protocols bgp timers keepalive '3'
: 设置 BGP 协议的保活时间为 '3' 秒。set protocols static route 0.0.0.0/0 next-hop 10.225.97.6
: 添加一个静态路由,将所有流量发送到下一跳 IP 地址 '10.225.97.6'。set service ssh port '22'
: 配置 SSH 服务的端口号为 '22'。set system name-server '223.5.5.5'
: 配置系统使用的 DNS 服务器为 '223.5.5.5'。set system name-server '223.6.6.6'
: 配置系统使用的 DNS 服务器为 '223.6.6.6'。
1.4、明细路由表
1.5、全局路由表
二、bgpserver:ncn
2.1、config.ini配置
sudo nano /config/config.ini
[server]
RouterId = 100.66.66.2
ASN = 65000
NextHop = 10.225.97.6
UpdateSource = 100.66.66.2
[peer]
IP = 100.66.66.1
ASN = 65000
2.2、拉取镜像
add container image docker.io/yangpin/bgpserver:ncn
sudo podman pull docker.io/yangpin/bgpserver:ncn
2.3、vyos完整配置
set container name bgpserver cap-add 'net-admin'
set container name bgpserver cap-add 'sys-admin'
set container name bgpserver host-name 'bgpserver'
set container name bgpserver image 'docker.io/yangpin/bgpserver:ncn'
set container name bgpserver memory '4096'
set container name bgpserver network bgpnetwork address '100.66.66.2'
set container name bgpserver restart 'always'
set container name bgpserver volume config destination '/opt/config.ini'
set container name bgpserver volume config source '/config/config.ini'
set container network bgpnetwork prefix '100.66.66.0/30'
set interfaces ethernet eth0 address '10.225.97.9/24'
set nat source rule 100 outbound-interface name 'eth0'
set nat source rule 100 source address '100.66.66.0/30'
set nat source rule 100 translation address 'masquerade'
set protocols bgp neighbor 100.66.66.2 address-family ipv4-unicast soft-reconfiguration inbound
set protocols bgp neighbor 100.66.66.2 remote-as '65000'
set protocols bgp neighbor 100.66.66.2 update-source '100.66.66.1'
set protocols bgp system-as '65000'
set protocols bgp timers holdtime '15'
set protocols bgp timers keepalive '3'
set protocols static route 0.0.0.0/0 next-hop 10.225.97.1
set service ssh port '22'
set system name-server '223.5.5.5'
set system name-server '223.6.6.6'
set container name bgpserver cap-add 'net-admin'
: 为名为 "bgpserver" 的容器添加了网络管理权限。set container name bgpserver cap-add 'sys-admin'
: 给名为 "bgpserver" 的容器添加了系统管理权限。set container name bgpserver host-name 'bgpserver'
: 将名为 "bgpserver" 的容器的主机名设置为 "bgpserver"。set container name bgpserver image 'docker.io/yangpin/bgpserver:ncn'
: 指定名为 "bgpserver" 的容器使用的镜像为 "docker.io/yangpin/bgpserver:ncn"。set container name bgpserver memory '4096'
: 将名为 "bgpserver" 的容器的内存限制为 4096MB。set container name bgpserver network bgpnetwork address '100.66.66.2'
: 将名为 "bgpserver" 的容器连接到名为 "bgpnetwork" 的网络,并分配给容器的IP地址为 100.66.66.2。set container name bgpserver restart 'always'
: 设置名为 "bgpserver" 的容器在退出时总是重新启动。set container name bgpserver volume config destination '/opt/config.ini'
: 将名为 "bgpserver" 的容器的配置文件存储到宿主机上的 '/opt/config.ini' 目录中。set container name bgpserver volume config source '/config/config.ini'
: 将宿主机上的 '/config/config.ini' 文件挂载到名为 "bgpserver" 的容器中。set container network bgpnetwork prefix '100.66.66.0/30'
: 配置名为 "bgpnetwork" 的网络的IP前缀为 '100.66.66.0/30'。set interfaces ethernet eth0 address '10.225.97.9/24'
: 更新以太网接口 'eth0' 的IP地址为 '10.225.97.9/24'。set nat source rule 100 outbound-interface name 'eth0'
: 设置 NAT 源地址转换规则,匹配出接口 'eth0' 的流量。set nat source rule 100 source address '100.66.66.0/30'
: 指定 NAT 源地址转换规则的源地址为 '100.66.66.0/30'。set nat source rule 100 translation address 'masquerade'
: 设置 NAT 源地址转换规则中的转换地址为 'masquerade'(伪装,即使用外部IP地址)。set protocols bgp neighbor 100.66.66.2 address-family ipv4-unicast soft-reconfiguration inbound
: 配置 BGP 邻居 '100.66.66.2' 支持 IPv4 单播地址族,并启用入站软重配置。set protocols bgp neighbor 100.66.66.2 remote-as '65000'
: 设置 BGP 邻居 '100.66.66.2' 的远程自治系统号为 '65000'。set protocols bgp neighbor 100.66.66.2 update-source '100.66.66.1'
: 设置 BGP 邻居 '100.66.66.2' 的更新消息的源IP地址为 '100.66.66.1'。set protocols bgp system-as '65000'
: 配置本地 BGP 实例的自治系统号为 '65000'。set protocols bgp timers holdtime '15'
: 设置 BGP 协议的保持时间为 '15' 秒。set protocols bgp timers keepalive '3'
: 设置 BGP 协议的保活时间为 '3' 秒。set protocols static route 0.0.0.0/0 next-hop 10.225.97.1
: 更新静态路由,将所有流量发送到下一跳IP地址 '10.225.97.1'。set service ssh port '22'
: 配置 SSH 服务的端口号为 '22'。set system name-server '223.5.5.5'
: 配置系统使用的 DNS 服务器为 '223.5.5.5'。set system name-server '223.6.6.6'
: 配置系统使用的 DNS 服务器为 '223.6.6.6.'。
2.4、明细路由表
2.5、全局路由表
三、bgpserver:auto
3.1、指定拉取CN路由
3.1.1、config.ini配置
sudo nano /config/config.ini
[server]
RouterId = 100.66.66.2
ASN = 65000
NextHop = 10.225.97.1
UpdateSource = 100.66.66.2
[peer]
IP = 100.66.66.1
ASN = 65000
3.1.2、拉取镜像
add container image docker.io/yangpin/bgpserver:auto
sudo podman pull docker.io/yangpin/bgpserver:auto
3.1.3、vyos完整配置
set container name bgpserver arguments './opt/bgp -c /opt/config.ini -l CN'
set container name bgpserver cap-add 'net-admin'
set container name bgpserver cap-add 'sys-admin'
set container name bgpserver host-name 'bgpserver'
set container name bgpserver image 'docker.io/yangpin/bgpserver:auto'
set container name bgpserver memory '2048'
set container name bgpserver network bgpnetwork address '100.66.66.2'
set container name bgpserver restart 'always'
set container name bgpserver volume config destination '/opt/config.ini'
set container name bgpserver volume config source '/config/config.ini'
set container network bgpnetwork prefix '100.66.66.0/30'
set interfaces ethernet eth0 address '10.225.97.9/24'
set nat source rule 100 outbound-interface name 'eth0'
set nat source rule 100 source address '100.66.66.0/30'
set nat source rule 100 translation address 'masquerade'
set protocols bgp neighbor 100.66.66.2 address-family ipv4-unicast soft-reconfiguration inbound
set protocols bgp neighbor 100.66.66.2 remote-as '65000'
set protocols bgp neighbor 100.66.66.2 update-source '100.66.66.1'
set protocols bgp system-as '65000'
set protocols bgp timers holdtime '15'
set protocols bgp timers keepalive '3'
set protocols static route 0.0.0.0/0 next-hop 10.225.97.6
set service ssh port '22'
set system name-server '223.5.5.5'
set system name-server '223.6.6.6'
set container name bgpserver arguments './opt/bgp -c /opt/config.ini -l CN'
: 设置名为 "bgpserver" 的容器的启动参数,指定运行时要执行的命令及其参数。set container name bgpserver cap-add 'net-admin'
: 为名为 "bgpserver" 的容器添加网络管理权限。set container name bgpserver cap-add 'sys-admin'
: 为名为 "bgpserver" 的容器添加系统管理权限。set container name bgpserver host-name 'bgpserver'
: 设置名为 "bgpserver" 的容器的主机名为 "bgpserver"。set container name bgpserver image 'docker.io/yangpin/bgpserver:auto'
: 指定名为 "bgpserver" 的容器使用的镜像为 "docker.io/yangpin/bgpserver:auto"。set container name bgpserver memory '2048'
: 设置名为 "bgpserver" 的容器的内存限制为 2048MB。set container name bgpserver network bgpnetwork address '100.66.66.2'
: 将名为 "bgpserver" 的容器连接到名为 "bgpnetwork" 的网络,并分配给容器的 IP 地址为 100.66.66.2。set container name bgpserver restart 'always'
: 设置名为 "bgpserver" 的容器在退出时总是重新启动。set container name bgpserver volume config destination '/opt/config.ini'
: 将名为 "bgpserver" 的容器的配置文件存储到宿主机上的 '/opt/config.ini' 目录中。set container name bgpserver volume config source '/config/config.ini'
: 将宿主机上的 '/config/config.ini' 文件挂载到名为 "bgpserver" 的容器中。set container network bgpnetwork prefix '100.66.66.0/30'
: 配置名为 "bgpnetwork" 的网络的 IP 前缀为 '100.66.66.0/30'。set interfaces ethernet eth0 address '10.225.97.9/24'
: 配置以太网接口 'eth0' 的 IP 地址为 '10.225.97.9/24'。set nat source rule 100 outbound-interface name 'eth0'
: 设置 NAT 源地址转换规则,匹配出接口 'eth0' 的流量。set nat source rule 100 source address '100.66.66.0/30'
: 指定 NAT 源地址转换规则的源地址为 '100.66.66.0/30'。set nat source rule 100 translation address 'masquerade'
: 设置 NAT 源地址转换规则中的转换地址为 'masquerade'(伪装,即使用外部 IP 地址)。set protocols bgp neighbor 100.66.66.2 address-family ipv4-unicast soft-reconfiguration inbound
: 配置 BGP 邻居 '100.66.66.2' 支持 IPv4 单播地址族,并启用入站软重配置。set protocols bgp neighbor 100.66.66.2 remote-as '65000'
: 设置 BGP 邻居 '100.66.66.2' 的远程自治系统号为 '65000'。set protocols bgp neighbor 100.66.66.2 update-source '100.66.66.1'
: 设置 BGP 邻居 '100.66.66.2' 的更新消息的源 IP 地址为 '100.66.66.1'。set protocols bgp system-as '65000'
: 配置本地 BGP 实例的自治系统号为 '65000'。set protocols bgp timers holdtime '15'
: 设置 BGP 协议的保持时间为 '15' 秒。set protocols bgp timers keepalive '3'
: 设置 BGP 协议的保活时间为 '3' 秒。set protocols static route 0.0.0.0/0 next-hop 10.225.97.6
: 添加一个静态路由,将所有流量发送到下一跳 IP 地址 '10.225.97.6'。set service ssh port '22'
: 配置 SSH 服务的端口号为 '22'。set system name-server '223.5.5.5'
: 配置系统使用的 DNS 服务器为 '223.5.5.5'。set system name-server '223.6.6.6'
: 配置系统使用的 DNS 服务器为 '223.6.6.6'。
3.1.4、路由信息
3.2、指定拉取NCN路由
3.2.1、config.ini配置
sudo nano /config/config.ini
[server]
RouterId = 100.66.66.2
ASN = 65000
NextHop = 10.225.97.6
UpdateSource = 100.66.66.2
[peer]
IP = 100.66.66.1
ASN = 65000
3.2.2、拉取镜像
add container image docker.io/yangpin/bgpserver:auto
sudo podman pull docker.io/yangpin/bgpserver:auto
3.2.3、vyos完整配置
set container name bgpserver arguments './opt/bgp -c /opt/config.ini -l NCN'
set container name bgpserver cap-add 'net-admin'
set container name bgpserver cap-add 'sys-admin'
set container name bgpserver host-name 'bgpserver'
set container name bgpserver image 'docker.io/yangpin/bgpserver:auto'
set container name bgpserver memory '4096'
set container name bgpserver network bgpnetwork address '100.66.66.2'
set container name bgpserver restart 'always'
set container name bgpserver volume config destination '/opt/config.ini'
set container name bgpserver volume config source '/config/config.ini'
set container network bgpnetwork prefix '100.66.66.0/30'
set interfaces ethernet eth0 address '10.225.97.9/24'
set nat source rule 100 outbound-interface name 'eth0'
set nat source rule 100 source address '100.66.66.0/30'
set nat source rule 100 translation address 'masquerade'
set protocols bgp neighbor 100.66.66.2 address-family ipv4-unicast soft-reconfiguration inbound
set protocols bgp neighbor 100.66.66.2 remote-as '65000'
set protocols bgp neighbor 100.66.66.2 update-source '100.66.66.1'
set protocols bgp system-as '65000'
set protocols bgp timers holdtime '15'
set protocols bgp timers keepalive '3'
set protocols static route 0.0.0.0/0 next-hop 10.225.97.1
set service ssh port '22'
set system name-server '223.5.5.5'
set system name-server '223.6.6.6'
set container name bgpserver arguments './opt/bgp -c /opt/config.ini -l NCN'
: 设置名为 "bgpserver" 的容器的启动参数,指定运行时要执行的命令及其参数。set container name bgpserver cap-add 'net-admin'
: 为名为 "bgpserver" 的容器添加网络管理权限。set container name bgpserver cap-add 'sys-admin'
: 为名为 "bgpserver" 的容器添加系统管理权限。set container name bgpserver host-name 'bgpserver'
: 设置名为 "bgpserver" 的容器的主机名为 "bgpserver"。set container name bgpserver image 'docker.io/yangpin/bgpserver:auto'
: 指定名为 "bgpserver" 的容器使用的镜像为 "docker.io/yangpin/bgpserver:auto"。set container name bgpserver memory '4096'
: 设置名为 "bgpserver" 的容器的内存限制为 4096MB。set container name bgpserver network bgpnetwork address '100.66.66.2'
: 将名为 "bgpserver" 的容器连接到名为 "bgpnetwork" 的网络,并分配给容器的 IP 地址为 100.66.66.2。set container name bgpserver restart 'always'
: 设置名为 "bgpserver" 的容器在退出时总是重新启动。set container name bgpserver volume config destination '/opt/config.ini'
: 将名为 "bgpserver" 的容器的配置文件存储到宿主机上的 '/opt/config.ini' 目录中。set container name bgpserver volume config source '/config/config.ini'
: 将宿主机上的 '/config/config.ini' 文件挂载到名为 "bgpserver" 的容器中。set container network bgpnetwork prefix '100.66.66.0/30'
: 配置名为 "bgpnetwork" 的网络的 IP 前缀为 '100.66.66.0/30'。set interfaces ethernet eth0 address '10.225.97.9/24'
: 配置以太网接口 'eth0' 的 IP 地址为 '10.225.97.9/24'。set nat source rule 100 outbound-interface name 'eth0'
: 设置 NAT 源地址转换规则,匹配出接口 'eth0' 的流量。set nat source rule 100 source address '100.66.66.0/30'
: 指定 NAT 源地址转换规则的源地址为 '100.66.66.0/30'。set nat source rule 100 translation address 'masquerade'
: 设置 NAT 源地址转换规则中的转换地址为 'masquerade'(伪装,即使用外部 IP 地址)。set protocols bgp neighbor 100.66.66.2 address-family ipv4-unicast soft-reconfiguration inbound
: 配置 BGP 邻居 '100.66.66.2' 支持 IPv4 单播地址族,并启用入站软重配置。set protocols bgp neighbor 100.66.66.2 remote-as '65000'
: 设置 BGP 邻居 '100.66.66.2' 的远程自治系统号为 '65000'。set protocols bgp neighbor 100.66.66.2 update-source '100.66.66.1'
: 设置 BGP 邻居 '100.66.66.2' 的更新消息的源 IP 地址为 '100.66.66.1'。set protocols bgp system-as '65000'
: 配置本地 BGP 实例的自治系统号为 '65000'。set protocols bgp timers holdtime '15'
: 设置 BGP 协议的保持时间为 '15' 秒。set protocols bgp timers keepalive '3'
: 设置 BGP 协议的保活时间为 '3' 秒。set protocols static route 0.0.0.0/0 next-hop 10.225.97.1
: 添加一个静态路由,将所有流量发送到下一跳 IP 地址 '10.225.97.1'。set service ssh port '22'
: 配置 SSH 服务的端口号为 '22'。set system name-server '223.5.5.5'
: 配置系统使用的 DNS 服务器为 '223.5.5.5'。set system name-server '223.6.6.6'
: 配置系统使用的 DNS 服务器为 '223.6.6.6'。
3.2.4、路由信息
3.3、指定拉取US路由
3.3.1、config.ini配置
sudo nano /config/config.ini
[server]
RouterId = 100.66.66.2
ASN = 65000
NextHop = 10.225.97.6
UpdateSource = 100.66.66.2
[peer]
IP = 100.66.66.1
ASN = 65000
3.3.2、拉取镜像
add container image docker.io/yangpin/bgpserver:auto
sudo podman pull docker.io/yangpin/bgpserver:auto
3.3.3、vyos完整配置
set container name bgpserver arguments './opt/bgp -c /opt/config.ini -l US'
set container name bgpserver cap-add 'net-admin'
set container name bgpserver cap-add 'sys-admin'
set container name bgpserver host-name 'bgpserver'
set container name bgpserver image 'docker.io/yangpin/bgpserver:auto'
set container name bgpserver memory '3072'
set container name bgpserver network bgpnetwork address '100.66.66.2'
set container name bgpserver restart 'always'
set container name bgpserver volume config destination '/opt/config.ini'
set container name bgpserver volume config source '/config/config.ini'
set container network bgpnetwork prefix '100.66.66.0/30'
set interfaces ethernet eth0 address '10.225.97.9/24'
set nat source rule 100 outbound-interface name 'eth0'
set nat source rule 100 source address '100.66.66.0/30'
set nat source rule 100 translation address 'masquerade'
set protocols bgp neighbor 100.66.66.2 address-family ipv4-unicast soft-reconfiguration inbound
set protocols bgp neighbor 100.66.66.2 remote-as '65000'
set protocols bgp neighbor 100.66.66.2 update-source '100.66.66.1'
set protocols bgp system-as '65000'
set protocols bgp timers holdtime '15'
set protocols bgp timers keepalive '3'
set protocols static route 0.0.0.0/0 next-hop 10.225.97.1
set service ssh port '22'
set system name-server '223.5.5.5'
set system name-server '223.6.6.6'
set container name bgpserver arguments './opt/bgp -c /opt/config.ini -l US'
: 设置名为 "bgpserver" 的容器的启动参数,指定运行时要执行的命令及其参数。set container name bgpserver cap-add 'net-admin'
: 为名为 "bgpserver" 的容器添加网络管理权限。set container name bgpserver cap-add 'sys-admin'
: 为名为 "bgpserver" 的容器添加系统管理权限。set container name bgpserver host-name 'bgpserver'
: 设置名为 "bgpserver" 的容器的主机名为 "bgpserver"。set container name bgpserver image 'docker.io/yangpin/bgpserver:auto'
: 指定名为 "bgpserver" 的容器使用的镜像为 "docker.io/yangpin/bgpserver:auto"。set container name bgpserver memory '3072'
: 设置名为 "bgpserver" 的容器的内存限制为 3072MB。set container name bgpserver network bgpnetwork address '100.66.66.2'
: 将名为 "bgpserver" 的容器连接到名为 "bgpnetwork" 的网络,并分配给容器的 IP 地址为 100.66.66.2。set container name bgpserver restart 'always'
: 设置名为 "bgpserver" 的容器在退出时总是重新启动。set container name bgpserver volume config destination '/opt/config.ini'
: 将名为 "bgpserver" 的容器的配置文件存储到宿主机上的 '/opt/config.ini' 目录中。set container name bgpserver volume config source '/config/config.ini'
: 将宿主机上的 '/config/config.ini' 文件挂载到名为 "bgpserver" 的容器中。set container network bgpnetwork prefix '100.66.66.0/30'
: 配置名为 "bgpnetwork" 的网络的 IP 前缀为 '100.66.66.0/30'。set interfaces ethernet eth0 address '10.225.97.9/24'
: 配置以太网接口 'eth0' 的 IP 地址为 '10.225.97.9/24'。set nat source rule 100 outbound-interface name 'eth0'
: 设置 NAT 源地址转换规则,匹配出接口 'eth0' 的流量。set nat source rule 100 source address '100.66.66.0/30'
: 指定 NAT 源地址转换规则的源地址为 '100.66.66.0/30'。set nat source rule 100 translation address 'masquerade'
: 设置 NAT 源地址转换规则中的转换地址为 'masquerade'(伪装,即使用外部 IP 地址)。set protocols bgp neighbor 100.66.66.2 address-family ipv4-unicast soft-reconfiguration inbound
: 配置 BGP 邻居 '100.66.66.2' 支持 IPv4 单播地址族,并启用入站软重配置。set protocols bgp neighbor 100.66.66.2 remote-as '65000'
: 设置 BGP 邻居 '100.66.66.2' 的远程自治系统号为 '65000'。set protocols bgp neighbor 100.66.66.2 update-source '100.66.66.1'
: 设置 BGP 邻居 '100.66.66.2' 的更新消息的源 IP 地址为 '100.66.66.1'。set protocols bgp system-as '65000'
: 配置本地 BGP 实例的自治系统号为 '65000'。set protocols bgp timers holdtime '15'
: 设置 BGP 协议的保持时间为 '15' 秒。set protocols bgp timers keepalive '3'
: 设置 BGP 协议的保活时间为 '3' 秒。set protocols static route 0.0.0.0/0 next-hop 10.225.97.1
: 添加一个静态路由,将所有流量发送到下一跳 IP 地址 '10.225.97.1'。set service ssh port '22'
: 配置 SSH 服务的端口号为 '22'。set system name-server '223.5.5.5'
: 配置系统使用的 DNS 服务器为 '223.5.5.5'。set system name-server '223.6.6.6'
: 配置系统使用的 DNS 服务器为 '223.6.6.6'。