Skip to content

Instantly share code, notes, and snippets.

@higebu
Last active March 25, 2023 01:19
Show Gist options
  • Save higebu/6d1a5a229186734042ed3da1abae8804 to your computer and use it in GitHub Desktop.
Save higebu/6d1a5a229186734042ed3da1abae8804 to your computer and use it in GitHub Desktop.
gobgp cloud config for CML2
#cloud-config
hostname: gobgp1
manage_etc_hosts: True
timezone: Asia/Tokyo
system_info:
default_user:
name: cisco
password: cisco
chpasswd: { expire: False }
ssh_pwauth: True
ssh_authorized_keys:
- "YOUR_SSH_PUBLIC_KEY"
packages:
- unzip
write_files:
- path: /root/install-gobgp.sh
permissions: 0744
owner: root
content: |
#!/usr/bin/env bash
set -e
wget https://go.dev/dl/go1.20.2.linux-amd64.tar.gz
tar xf go1.20.2.linux-amd64.tar.gz
mv go /usr/local/
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
wget https://github.com/osrg/gobgp/archive/refs/heads/master.zip
unzip master.zip
cd gobgp-master
go build ./cmd/gobgp
go build ./cmd/gobgpd
mv gobgpd /usr/bin/
mv gobgp /usr/bin/
wget https://raw.githubusercontent.com/osrg/gobgp/master/tools/contrib/centos/gobgpd.service
mv gobgpd.service /etc/systemd/system/
mkdir /etc/gobgpd
cat <<'EOF' | tee /etc/gobgpd/gobgpd.conf
[global.config]
as = 65000
router-id = "10.0.0.1"
local-address-list = ["10.0.0.1"]
EOF
groupadd --system gobgpd
useradd --system -d /var/lib/gobgpd -s /bin/bash -g gobgpd gobgpd
systemctl enable gobgpd
systemctl start gobgpd
- path: /etc/netplan/50-cloud-init.yaml
content: |
network:
ethernets:
ens2:
dhcp4: true
ens3:
addresses:
- 10.0.0.1/24
dhcp4: false
version: 2
runcmd:
- sudo netplan apply
- sudo bash /root/install-gobgp.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment