summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPaul Jakma <paul.jakma@sun.com>2007-11-01 14:29:11 +0000
committerPaul Jakma <paul.jakma@sun.com>2007-11-01 14:29:11 +0000
commit3a02d1f7fb778a1ea4f45d037f13dfcd126e2337 (patch)
tree2ffa6c8c2c2feb9d423a277c0761151e56884d38 /tools
parent5619f56ba38b255f699f76b327cf82388c4a90cf (diff)
2007-10-30 Nick Hilliard <nick@inex.ie>
* bgp_main.c: Add 'listenon' argument, to pass address to bind to. * bgp_network.c: (bgp_socket) Extend to take bind address. * bgpd.c: (bgp_init) Pass stored address. * bgpd.h: (struct bgp_master) storage for bind address 2007-11-01 Paul Jakma <paul.jakma@sun.com> * tools/multiple-bgpd.sh: New, quick script to launch a bunch of bgpds.
Diffstat (limited to 'tools')
-rw-r--r--tools/multiple-bgpd.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/multiple-bgpd.sh b/tools/multiple-bgpd.sh
new file mode 100644
index 00000000..40977544
--- /dev/null
+++ b/tools/multiple-bgpd.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+# Public domain, not copyrighted..
+
+NUM=5
+VTYBASE=2610
+ASBASE=64560
+BGPD=/path/to/bgpd
+PREFIX=192.168.145
+
+for H in `seq 1 ${NUM}` ; do
+ CONF=/etc/quagga/bgpd${H}.conf
+ ADDR=${PREFIX}.${H}
+
+ if [ ! -e "$CONF" ] ; then
+ # This sets up a ring of bgpd peerings
+ NEXT=$(( ($H % ${NUM}) + 1 ))
+ PREV=$(( (($H + 3) % ${NUM}) + 1 ))
+ NEXTADDR="${PREFIX}.${NEXT}"
+ NEXTAS=$((${ASBASE} + $NEXT))
+ PREVADDR="${PREFIX}.${PREV}"
+ PREVAS=$((${ASBASE} + $PREV))
+
+ # Edit config to suit.
+ cat > "$CONF" <<- EOF
+ password whatever
+ service advanced-vty
+ !
+ router bgp $((64560+${H}))
+ bgp router-id ${ADDR}
+ network 10.${H}.1.0/24 pathlimit 1
+ network 10.${H}.2.0/24 pathlimit 2
+ network 10.${H}.3.0/24 pathlimit 3
+ neighbor default peer-group
+ neighbor default update-source ${ADDR}
+ neighbor default capability orf prefix-list both
+ neighbor default soft-reconfiguration inbound
+ neighbor ${NEXTADDR} remote-as ${NEXTAS}
+ neighbor ${NEXTADDR} peer-group default
+ neighbor ${PREVADDR} remote-as ${PREVAS}
+ neighbor ${PREVADDR} peer-group default
+ EOF
+ chown quagga:quagga "$CONF"
+ fi
+ # You may want to automatically add configure a local address
+ # on a loop interface.
+ #
+ # Solaris: ifconfig vni${H} plumb ${ADDR}/32 up
+ # Linux: ip address add ${ADDR}/32 dev lo 2> /dev/null
+ ${BGPD} -i /var/run/quagga/bgpd${H}.pid \
+ -l ${ADDR} \
+ -f /etc/quagga/bgpd${H}.conf \
+ -P $((${VTYBASE}+${H})) \
+ -d
+done