From 27ece3ddea2ab7d6aaee1e4ec5de4d7b0942c7c9 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 28 Jul 2018 18:47:08 +0000 Subject: [PATCH] getting very very close --- debian/control | 2 +- debian/wit-hypervisor.install | 1 + debian/wit-hypervisor.postinst | 19 ++++++++++++++----- files/10-frr.conf | 4 ---- files/11-mgmt1.conf | 2 ++ files/frr.conf.wit | 4 ++-- 6 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 files/11-mgmt1.conf diff --git a/debian/control b/debian/control index c1678db..f467151 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.2 Package: wit-hypervisor Architecture: all -Depends: ${misc:Depends}, frr (>= 4.0-wit), sed, tcpdump, mtr-tiny, iproute2, ifupdown, ipmitool, iptables, lldpd, strongswan, telnet, netcat, fping, curl, wget, ifstat, rsyslog, ncurses-term, net-tools, bridge-utils, vlan +Depends: ${misc:Depends}, frr (>= 4.0-wit), sed, tcpdump, mtr-tiny, iproute2, ifupdown, ipmitool, iptables, lldpd, strongswan, telnet, netcat, fping, curl, wget, ifstat, rsyslog, ncurses-term, net-tools, bridge-utils, vlan, gnupg Provides: ${diverted-files} Conflicts: ${diverted-files} Description: Installs basic network packages and diff --git a/debian/wit-hypervisor.install b/debian/wit-hypervisor.install index d9159b7..6371005 100644 --- a/debian/wit-hypervisor.install +++ b/debian/wit-hypervisor.install @@ -4,6 +4,7 @@ files/vrf-dhcp-exit etc/dhcp/dhclient-exit-hooks.d files/dhcp-sethostname etc/dhcp/dhclient-exit-hooks.d files/rc.local etc files/10-frr.conf etc/sysctl.d +files/11-mgmt1.conf etc/sysctl.d files/wit-gc usr/bin files/resolv.conf etc files/bashrc-witaddon etc diff --git a/debian/wit-hypervisor.postinst b/debian/wit-hypervisor.postinst index 73c2c9a..57e501d 100755 --- a/debian/wit-hypervisor.postinst +++ b/debian/wit-hypervisor.postinst @@ -21,7 +21,6 @@ set -e case "$1" in configure) - [ -z $NODE_ID ] && export NODE_ID=$(ip -4 -br addr | grep 10.0. | awk '{ print $3 }' | awk 'BEGIN{FS="[./]"} { print $4 }') export MGMT_ID=$(ip -4 -br addr | grep 10.0. | awk '{ print $3 }' | awk 'BEGIN{FS="[./]"} { print $3 }') @@ -51,24 +50,34 @@ case "$1" in exit 2 fi - export NODE_ASN="$(printf "%03d" $TIER_ID)$(printf "%03d" $NODE_ID)" + export NODE_ASN="4200$(printf "%03d" $TIER_ID)$(printf "%03d" $NODE_ID)" + export LOOPBACKv4="10.1.$TIER_ID.$NODE_ID" + export LOOPBACKv6="2604:bbc0::$TIER_ID:$NODE_ID" echo "auto lo:0" >/etc/network/interfaces.d/lo - echo "iface lo:0 inet static\n address 10.1.$TIER_ID.$NODE_ID/32" >> /etc/network/interfaces.d/lo - echo "iface lo:0 inet6 static\n address 2604:bbc0::$TIER_ID:$NODE_ID/128" >> /etc/network/interfaces.d/lo + echo "iface lo:0 inet static" >> /etc/network/interfaces.d/lo + echo " address ${LOOPBACKv4}/32" >> /etc/network/interfaces.d/lo + echo "iface lo:0 inet6 static" >> /etc/network/interfaces.d/lo + echo " address ${LOOPBACKv6}/128" >> /etc/network/interfaces.d/lo - sed -i -e "s/VTEPINDEX/$NODE_ID/" -e "s/TIERID/$TIER_ID/" -e "s/NODEASN/$NODE_ASN/" /etc/frr/frr.conf.wit + + sed -i -e "s/FRRROUTERID/${LOOPBACKv4}/" -e "s/NODEASN/${NODE_ASN}/" /etc/frr/frr.conf.wit chown frr.frr /etc/frr/frr.conf.wit /etc/frr/daemons.wit + sed -i -e "/.*debcore1/d" -e "/.*${HOSTNAME}/d" -e "$ s/$/\n${LOOPBACKv4} ${HOSTNAME}${DOMAINNAME} ${HOSTNAME}/" /etc/hosts + + sed -i -e "s/HOSTNAME\.DOMAINNAME/${HOSTNAME}${DOMAINNAME}/" /etc/ipsec.conf.wit echo ": RSA ${HOSTNAME}${DOMAINNAME}.key" >/etc/ipsec.secrets chmod 600 /etc/ipsec.secrets + + echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$MGMT_MAC'", ATTR{type}=="1", NAME="mgmt1"' >/etc/udev/rules.d/70-persistent-net.rules i=0 for nic in $(ip -br link | awk '{ print $1 }'); do diff --git a/files/10-frr.conf b/files/10-frr.conf index ee9374b..28446c2 100644 --- a/files/10-frr.conf +++ b/files/10-frr.conf @@ -48,7 +48,3 @@ net.ipv4.fib_multipath_use_neigh=1 # Allows Apps to Work with VRF net.ipv4.tcp_l3mdev_accept=1 - - -# disable forwarding for mgmt interface -net.ipv6.conf.mgmt1.forwarding = 0 diff --git a/files/11-mgmt1.conf b/files/11-mgmt1.conf new file mode 100644 index 0000000..472cccc --- /dev/null +++ b/files/11-mgmt1.conf @@ -0,0 +1,2 @@ +# disable forwarding for mgmt interface +net.ipv6.conf.mgmt1.forwarding = 0 diff --git a/files/frr.conf.wit b/files/frr.conf.wit index 2868c08..3a9984f 100644 --- a/files/frr.conf.wit +++ b/files/frr.conf.wit @@ -13,8 +13,8 @@ interface feth2 ipv6 nd ra-interval 10 no ipv6 nd suppress-ra ! -router bgp 4200NODEASN - bgp router-id 10.1.TIERID.VTEPINDEX +router bgp NODEASN + bgp router-id FRRROUTERID no bgp default ipv4-unicast coalesce-time 1000 bgp bestpath as-path multipath-relax