Skip to content

Commit 5665691

Browse files
authored
Merge pull request #778 from b-ehlers/bird2
BIRD2: New Appliance
2 parents 0803888 + 7c6c96c commit 5665691

File tree

7 files changed

+137
-3
lines changed

7 files changed

+137
-3
lines changed

appliances/bird2.gns3a

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"appliance_id": "8fecbf89-5cd1-4aea-b735-5f36cf0efbb7",
3+
"name": "BIRD2",
4+
"category": "router",
5+
"description": "The BIRD project aims to develop a fully functional dynamic IP routing daemon primarily targeted on (but not limited to) Linux, FreeBSD and other UNIX-like systems and distributed under the GNU General Public License.",
6+
"vendor_name": "CZ.NIC Labs",
7+
"vendor_url": "https://bird.network.cz",
8+
"documentation_url": "https://bird.network.cz/?get_doc&f=bird.html&v=20",
9+
"product_name": "BIRD internet routing daemon",
10+
"registry_version": 4,
11+
"status": "stable",
12+
"maintainer": "Bernhard Ehlers",
13+
"maintainer_email": "[email protected]",
14+
"usage": "Username:\tgns3\nPassword:\tgns3\nTo become root, use \"sudo -s\".\n\nNetwork configuration:\nsudo nano /etc/network/interfaces\nsudo systemctl restart networking\n\nBIRD:\nRestart: sudo systemctl restart bird\nReconfigure: birdc configure",
15+
"port_name_format": "eth{0}",
16+
"qemu": {
17+
"adapter_type": "virtio-net-pci",
18+
"adapters": 4,
19+
"ram": 512,
20+
"hda_disk_interface": "scsi",
21+
"arch": "x86_64",
22+
"console_type": "telnet",
23+
"kvm": "allow"
24+
},
25+
"images": [
26+
{
27+
"filename": "bird2-debian-2.0.12.qcow2",
28+
"version": "2.0.12",
29+
"md5sum": "435218a2e90cba921cc7fde1d64a9419",
30+
"filesize": 287965184,
31+
"download_url": "https://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/",
32+
"direct_download_url": "http://downloads.sourceforge.net/project/gns-3/Qemu%20Appliances/bird2-debian-2.0.12.qcow2"
33+
}
34+
],
35+
"versions": [
36+
{
37+
"name": "2.0.12",
38+
"images": {
39+
"hda_disk_image": "bird2-debian-2.0.12.qcow2"
40+
}
41+
}
42+
]
43+
}

packer/debian/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,11 @@ containing `iso_checksum_type` from debian.json.
1313
```
1414
packer build debian.json
1515
```
16+
17+
## BIRDv2
18+
19+
A build of Debian with BIRD Internet Routing Daemon v2 preinstalled.
20+
21+
```
22+
packer build -var-file=bird2.json debian.json
23+
```

packer/debian/bird2.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"vm_name": "bird2-debian.qcow2",
3+
"setup_script": "bird2.sh"
4+
}

packer/debian/debian.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"variables": {
3-
"iso_url": "https://cloud.debian.org/images/cloud/bullseye/20221219-1234/debian-11-genericcloud-amd64-20221219-1234.qcow2",
4-
"iso_checksum": "ba0237232247948abf7341a495dec009702809aa7782355a1b35c112e75cee81",
3+
"iso_url": "https://cloud.debian.org/images/cloud/bookworm/20230612-1409/debian-12-genericcloud-amd64-20230612-1409.qcow2",
4+
"iso_checksum": "9a18ee4954800113ee130b66ef24c0e27124aaf90cff1eb339f744a52354f788",
55
"disk_size": "2G",
66
"vm_name": "debian.qcow2",
77
"setup_script": "debian.sh"
88
},
99
"provisioners": [
1010
{
1111
"type": "shell",
12-
"script": "scripts/remove_cloud-init_network.sh",
12+
"script": "scripts/networking.sh",
1313
"execute_command" : "sudo env {{ .Vars }} {{ .Path }}"
1414
},
1515
{

packer/debian/scripts/bird2.sh

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/sh
2+
set -ex
3+
4+
# Install bird2 (plus telnet)
5+
export DEBIAN_FRONTEND=noninteractive
6+
apt-get update
7+
apt-get -y install bird2 inetutils-telnet
8+
chmod g+rw /etc/bird
9+
chmod g+rw /etc/bird/*.conf
10+
11+
# Use traditional style interface names eth*
12+
sed -i '/^GRUB_CMDLINE_LINUX=/ s/"$/ net.ifnames=0"/' /etc/default/grub
13+
update-grub
14+
sed -i 's/\bens4\b/eth0/g' /etc/network/interfaces
15+
16+
# Enable IP forwarding
17+
cat > /etc/sysctl.d/50-ip_forwarding.conf << 'EOF'
18+
# /etc/sysctl.d/50-ip_forwarding.conf - Enable IP forwarding
19+
20+
# Uncomment the next line to enable packet forwarding for IPv4
21+
net.ipv4.ip_forward=1
22+
23+
# Uncomment the next line to enable packet forwarding for IPv6
24+
# Enabling this option disables Stateless Address Autoconfiguration
25+
# based on Router Advertisements for this host
26+
net.ipv6.conf.all.forwarding=1
27+
EOF
28+
29+
# Load dummy module
30+
echo dummy >> /etc/modules
31+
32+
# create GNS3 user
33+
printf 'gns3\ngns3\n' | adduser --gecos 'GNS3' gns3
34+
printf '# User rules for gns3\ngns3 ALL=(ALL) NOPASSWD:ALL\n' > /etc/sudoers.d/50-gns3-user
35+
36+
# Make BIRD easier to use
37+
usermod -a -G bird gns3
38+
cat >> /home/gns3/.profile << 'EOF'
39+
40+
# BIRD
41+
alias birdc='/usr/sbin/birdc'
42+
alias birdcl='/usr/sbin/birdcl'
43+
cd /etc/bird
44+
EOF
45+
46+
# Sample screen startup file
47+
cat > /home/gns3/.screenrc << 'EOF'
48+
# Disable startup message
49+
startup_message off
50+
51+
# use bash as default shell
52+
defshell -bash
53+
54+
# Set escape key to Ctrl+j
55+
#escape ^Jj
56+
57+
# Start at window 1
58+
#bind c screen 1
59+
#bind ^c screen 1
60+
#bind 0 select 10
61+
#screen 1
62+
EOF
63+
chown gns3:gns3 /home/gns3/.screenrc

packer/debian/scripts/remove_cloud-init_network.sh packer/debian/scripts/networking.sh

+15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
#!/bin/sh
22
set -ex
33

4+
# add hostname into /etc/hosts
5+
if [ -z "$(hostname -d)" ]; then
6+
printf '127.0.1.1\t%s\n' "$(hostname)" >> /etc/hosts
7+
else
8+
printf '127.0.1.1\t%s\t%s\n' "$(hostname -f)" "$(hostname)" >> /etc/hosts
9+
fi
10+
11+
# replace systemd-resolved by resolvconf
12+
cp /etc/resolv.conf /etc/resolv.conf.orig
13+
export DEBIAN_FRONTEND=noninteractive
14+
apt-get update
15+
apt-get -y install --purge ifupdown resolvconf
16+
cat /etc/resolv.conf.orig > /etc/resolv.conf
17+
rm -f /etc/resolv.conf.orig
18+
419
# replace cloud-init network configuration
520
cat > /etc/network/interfaces <<'EOF'
621
# This file describes the network interfaces available on your system

packer/debian/scripts/post_setup.sh

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set -ex
33

44
# clear repository
55
apt-get clean
6+
rm -rf /var/lib/apt/lists/*
67

78
# clear unused space
89
echo 'Clearing unused space...'

0 commit comments

Comments
 (0)