[openwrt/nat64] add bgp config generator
This commit is contained in:
parent
efb9b1ca0d
commit
34df05c158
1 changed files with 30 additions and 3 deletions
|
@ -9,14 +9,17 @@
|
||||||
# - do not provide IPv4 or IPv6 dhcp/ra on any interface
|
# - do not provide IPv4 or IPv6 dhcp/ra on any interface
|
||||||
|
|
||||||
if [ $# -lt 4 ] ; then
|
if [ $# -lt 4 ] ; then
|
||||||
echo $0 "address hostname nat64prefix asn iBGPpeer1 [iBGPpeer2...]"
|
echo $0 "address hostname nat64prefix nat64route asn routerid iBGPpeer1 [iBGPpeer2...]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
address=$1; shift
|
address=$1; shift
|
||||||
hostname=$1; shift
|
hostname=$1; shift
|
||||||
nat64=$1; shift
|
nat64prefix=$1; shift
|
||||||
|
nat64route=$1; shift
|
||||||
asn=$1; shift
|
asn=$1; shift
|
||||||
|
routerid=$1; shift
|
||||||
|
ibgp_peers="$@"
|
||||||
|
|
||||||
# Now $@ only contains iBGP peers
|
# Now $@ only contains iBGP peers
|
||||||
|
|
||||||
|
@ -36,8 +39,32 @@ uci set system.@system[0].hostname="${hostname}"
|
||||||
# Do something wireless (?)
|
# Do something wireless (?)
|
||||||
# disable?
|
# disable?
|
||||||
|
|
||||||
echo "Setting up ibgp for $@ .."
|
echo "Setting up bird ..."
|
||||||
|
|
||||||
|
cat > /etc/bird.conf <<BBB
|
||||||
|
log syslog all;
|
||||||
|
router id ${routerid};
|
||||||
|
|
||||||
|
protocol static static6 {
|
||||||
|
ipv6;
|
||||||
|
route ${nat64prefix} unreachable;
|
||||||
|
}
|
||||||
|
BBB
|
||||||
|
|
||||||
|
for ibgp_peer in ${ibgp_peers}; do
|
||||||
|
cat >> /etc/bird.conf <<BBB
|
||||||
|
protocol bgp {
|
||||||
|
local as ${asn};
|
||||||
|
neighbor ${ibgp_peer} as ${asn};
|
||||||
|
|
||||||
|
ipv6 {
|
||||||
|
import none;
|
||||||
|
export where source ~ [ RTS_STATIC ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
BBB
|
||||||
|
|
||||||
uci commit
|
uci commit
|
||||||
|
/etc/init.d/bird restart
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Add table
Reference in a new issue