static IP for CoreOS
networkd:
  units:
    - name: 10-ens.network
      contents: |
        [Match]
        Name=ens*

        [Network]
        Address=EXTERNAL_IP/32
        Gateway=EXTERNAL_IP
        DNS=8.8.8.8

        [Route]
        Destination=EXTERNAL_IP/32
        Scope=link

        [Route]
        Gateway=EXTERNAL_IP
        #route add -net EXTERNAL_IP/32 netmask 255.255.255.255 dev ens18
        #route add default gw EXTERNAL_IP


# https://blog.cloudflare.com/how-to-receive-a-million-packets/
# http://www.ntop.org/products/packet-capture/pf_ring/pf_ring-zc-zero-copy/
# https://github.com/HurricaneLabs/docker-pfring/blob/master/Dockerfile
# https://github.com/ntop/PF_RING/tree/6.6.0-stable
# https://github.com/waltermeyer/pfring-coreos/blob/master/entrypoint.sh

# CoreOS Development Container
. /usr/share/coreos/release
. /usr/share/coreos/update.conf
url="http://${GROUP:-stable}.release.core-os.net/$COREOS_RELEASE_BOARD/$COREOS_RELEASE_VERSION/coreos_developer_container.bin.bz2"
curl -L "$url" | tee >(bzip2 -d > coreos_developer_container.bin)
sudo systemd-nspawn --bind=/lib/modules --image=coreos_developer_container.bin
emerge-gitclone
emerge -gKv coreos-sources
gzip -cd /proc/config.gz > /usr/src/linux/.config
make -C /usr/src/linux modules_prepare
# Get pf_ring source code
git clone https://github.com/ntop/PF_RING.git /opt/pfring
cd /opt/pfring
git checkout 6.6.0-stable
# Compilation: pf_ring kernel module
cd /opt/pfring/kernel
cp linux/pf_ring.h /usr/src/linux/include/linux/
make -C /usr/src/linux/ M=$PWD
# Compilation: pf_ring drivers
# Fix problems for drivers (http://linux-pci.vger.kernel.narkive.com/ZRnIPhN0/patch-timberdale-use-pci-enable-msix-range-instead-of-pci-enable-msix)
cd /opt/pfring/drivers/intel/i40e/i40e-*/src/i40e/
  # In the new Kernels the location for num_tc was changed
  sed -i "s/tc->tc)/tc->mqprio->num_tc)/g" i40e_main.c
  make -C /usr/src/linux/ M=$PWD
cd /opt/pfring/drivers/intel/igb/igb-*/src/
  sed -i "s/pci_enable_msix(/pci_enable_msix_range(/g" igb_main.c
  sed -i "s/adapter->msix_entries, numvecs)/adapter->msix_entries, numvecs, numvecs)/g" igb_main.c
  sed -i "s/cycle_t/u64/g" igb_ptp.c
  make -C /usr/src/linux/ M=$PWD
cd /opt/pfring/drivers/intel/e1000e/e1000e-*/src/
  sed -i "s/cycle_t/u64/g" netdev.c
  make -C /usr/src/linux/ M=$PWD
cd /opt/pfring/drivers/intel/ixgbe/ixgbe-*/src/
  #sed -i "s/cycle_t/u64/g" igb_ptp.c
  sed -i "s/tc->tc)/tc->mqprio->num_tc)/g" ixgbe_main.c
  # ADD on the top
    #define LL_FLUSH_FAILED		-1
    #define LL_FLUSH_BUSY		-2
  make -C /usr/src/linux/ M=$PWD
# Output directories
cp /opt/pfring/kernel/pf_ring.ko /lib/modules/
cp /opt/pfring/drivers/intel/i40e/i40e-*/src/i40e/i40e.ko /lib/modules/
cp /opt/pfring/drivers/intel/e1000e/e1000e-*/src/e1000e.ko /lib/modules/
cp /opt/pfring/drivers/intel/igb/igb-*/src/igb.ko /lib/modules/
cp /opt/pfring/drivers/intel/ixgbe/ixgbe-*/src/ixgbe.ko /lib/modules/