https://github.com/ttsubo/sdwan_orchestrator_with_gobgp
http://networkstatic.net/gobgp-control-plane-evolving-software-networking/
gobgp 配置
https://gist.github.com/chenchun/d9b82152cbd847a4001ddb23873075a3
good : https://qiita.com/ttsubo/items/8f0f2cf04306686ed1bc
https://qiita.com/ttsubo/items/8f0f2cf04306686ed1bc
gobgp_2.19.0_linux_arm64.tar.gz 不需要安装golang
https://github.com/shusugmt/gobgp-tutorial/tree/master/prov
# go version to install export GO_VERSION=1.6.2 # set envvars for go cat << EOF > /etc/profile.d/golang.sh export GOROOT=/usr/local/go export GOPATH=/usr/local/opt/gopath export PATH=\$GOROOT/bin:\$PATH EOF source /etc/profile.d/golang.sh # install go mkdir -p $GOPATH mkdir -p $GOROOT cd $GOROOT/.. wget https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz > /dev/null 2>&1 tar zxf go${GO_VERSION}.linux-amd64.tar.gz # install git (required to run go get) apt-get update apt-get install -y git # install gobgp and gobgpd go get -v github.com/osrg/gobgp/gobgpd go get -v github.com/osrg/gobgp/gobgp # install bash completions for gobgp command cp $GOPATH/src/github.com/osrg/gobgp/tools/completion/*.bash /etc/bash_completion.d/ id gobgpd || useradd -r gobgpd cp $GOPATH/bin/* /usr/local/sbin mkdir -p /etc/gobgp cp /vagrant/prov/gobgpd.service /etc/systemd/system systemctl daemon-reload
gobgpd.service [Unit] Description=gobgpd After=network.target syslog.target [Service] Type=simple PermissionsStartOnly=yes User=gobgpd ExecStartPre=/sbin/setcap 'cap_net_bind_service=+ep' /usr/local/sbin/gobgpd ExecStart=/usr/local/sbin/gobgpd -f /etc/gobgp/gobgpd.conf -t yaml --cpus=2 ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID [Install] WantedBy=multi-user.target
cat > /etc/sysctl.d/80-router.conf <<-EOF net.ipv4.ip_forward = 1 net.ipv6.conf.all.forwarding = 1 EOF sysctl -p /etc/sysctl.d/80-router.conf
wget https://github.com/osrg/gobgp/releases/download/v2.7.0/gobgp_2.7.0_linux_amd64.tar.gz tar -xvf gobgp_2.7.0_linux_amd64.tar.gz mv gobgp{,d} /usr/local/bin/ cat > /etc/systemd/system/gobgp.service <<-EOF [Unit] Description=GoBGP daemon After=network-online.target [Service] ExecStart=/usr/local/bin/gobgpd -f /etc/gobgp/gobgpd.toml [Install] Alias=gobgpd.service WantedBy=multi-user.target EOF mkdir -p /etc/gobgp touch /etc/gobgp/gobgpd.toml
systemctl enable --now gobgp
root@ubuntu:~# systemctl enable --now gobgp Created symlink /etc/systemd/system/gobgpd.service → /etc/systemd/system/gobgp.service. Created symlink /etc/systemd/system/multi-user.target.wants/gobgp.service → /etc/systemd/system/gobgp.service. root@ubuntu:~#
root@ubuntu:~# ps -elf | grep gobgp 4 S root 1639 1 0 80 0 - 179168 futex_ 16:40 ? 00:00:00 /usr/local/bin/gobgpd -f /etc/gobgp/gobgpd.toml 0 S root 1671 1555 0 80 0 - 1097 pipe_w 16:40 pts/0 00:00:00 grep --color=auto gobgp root@ubuntu:~#
root@ubuntu:~# cat /etc/gobgp/gobgpd.toml [[neighbors]] [neighbors.config] neighbor-address = "192.168.122.166" peer-as = 65000 local-as = 65000 [global.config] as = 65000 router-id = "192.168.122.205" root@ubuntu:~#
root@ubuntu:~# gobgp neighbor 192.168.122.166 BGP neighbor is 192.168.122.166, remote AS 65000 BGP version 4, remote router ID 192.168.122.166 BGP state = ESTABLISHED, up for 00:00:57 BGP OutQ = 0, Flops = 0 Hold time is 90, keepalive interval is 30 seconds Configured hold time is 90, keepalive interval is 30 seconds Neighbor capabilities: multiprotocol: ipv4-unicast: advertised and received route-refresh: advertised and received extended-nexthop: advertised and received Local: nlri: ipv4-unicast, nexthop: ipv6 Remote: nlri: ipv4-unicast, nexthop: ipv6 4-octet-as: advertised and received Message statistics: Sent Rcvd Opens: 1 1 Notifications: 0 0 Updates: 0 0 Keepalives: 2 2 Route Refresh: 0 0 Discarded: 0 0 Total: 3 3 Route statistics: Advertised: 0 Received: 0 Accepted: 0 root@ubuntu:~#
root@ubuntu:~/work# mv gobgp{,d} /usr/local/bin/ root@ubuntu:~/work# ls /usr/local/bin/ gobgp gobgpd root@ubuntu:~/work#