added digitalocean cluster
This commit is contained in:
parent
e8575df628
commit
0d329a2758
2 changed files with 240 additions and 0 deletions
34
docs/dump.sh
Normal file
34
docs/dump.sh
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#===================================================================================
|
||||||
|
#
|
||||||
|
# FILE: dump.sh
|
||||||
|
# USAGE: dump.sh [-i interface] [tcpdump-parameters]
|
||||||
|
# DESCRIPTION: tcpdump on any interface and add the prefix [Interace:xy] in front of the dump data.
|
||||||
|
# OPTIONS: same as tcpdump
|
||||||
|
# REQUIREMENTS: tcpdump, sed, ifconfig, kill, awk, grep, posix regex matching
|
||||||
|
# BUGS: ---
|
||||||
|
# FIXED: - In 1.0 The parameter -w would not work without -i parameter as multiple tcpdumps are started.
|
||||||
|
# - In 1.1 VLAN's would not be shown if a single interface was dumped.
|
||||||
|
# NOTES: ---
|
||||||
|
# - 1.2 git initial
|
||||||
|
# AUTHOR: Sebastian Haas
|
||||||
|
# COMPANY: pharma mall
|
||||||
|
# VERSION: 1.2
|
||||||
|
# CREATED: 16.09.2014
|
||||||
|
# REVISION: 22.09.2014
|
||||||
|
#
|
||||||
|
#===================================================================================
|
||||||
|
|
||||||
|
# When this exits, exit all background processes:
|
||||||
|
trap 'kill $(jobs -p) &> /dev/null && sleep 0.2 && echo ' EXIT
|
||||||
|
# Create one tcpdump output per interface and add an identifier to the beginning of each line:
|
||||||
|
if [[ $@ =~ -i[[:space:]]?[^[:space:]]+ ]]; then
|
||||||
|
tcpdump -l $@ | sed 's/^/[Interface:'"${BASH_REMATCH[0]:2}"'] /' &
|
||||||
|
else
|
||||||
|
for interface in $(ifconfig | grep '^[a-z0-9]' | awk '{print $1}')
|
||||||
|
do
|
||||||
|
tcpdump -l -i $interface -nn $@ | sed 's/^/[Interface:'"$interface"'] /' &
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
# wait .. until CTRL+C
|
||||||
|
wait
|
||||||
206
docs/proxmox_do.txt
Normal file
206
docs/proxmox_do.txt
Normal file
|
|
@ -0,0 +1,206 @@
|
||||||
|
apt update && apt install -y curl tcpdump
|
||||||
|
echo "deb http://download.proxmox.com/debian/pve buster pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list
|
||||||
|
curl -sSL http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg | apt-key add -
|
||||||
|
|
||||||
|
rm /etc/network/interfaces.d/50-cloud-init
|
||||||
|
echo "alias ll='ls -lah'" >>/root/.bashrc
|
||||||
|
cat <<EOF>/root/.vimrc
|
||||||
|
syntax on
|
||||||
|
set mouse=
|
||||||
|
set ttymouse=
|
||||||
|
EOF
|
||||||
|
# source /etc/network/interfaces.d/*
|
||||||
|
sed -i -e '24,29d' /etc/network/interfaces
|
||||||
|
sed -i '1isource /etc/network/interfaces.d/*' /etc/network/interfaces
|
||||||
|
iface=eth1
|
||||||
|
ip=$(ip a show $iface | grep "inet " | cut -d" " -f6 | cut -d"/" -f1)
|
||||||
|
hw=$(ip a show $iface | grep "link/" | cut -d" " -f6)
|
||||||
|
sed -i "s/127.0.1.1/$ip/" /etc/hosts
|
||||||
|
cat <<EOF>>/etc/network/interfaces
|
||||||
|
auto $iface
|
||||||
|
iface $iface inet static
|
||||||
|
hwaddress $hw
|
||||||
|
|
||||||
|
auto vmbr0
|
||||||
|
iface vmbr0 inet static
|
||||||
|
address $ip/24
|
||||||
|
bridge-ports $iface
|
||||||
|
bridge-stp off
|
||||||
|
bridge-fd 0
|
||||||
|
EOF
|
||||||
|
|
||||||
|
apt update && apt purge cloud-init -y && apt install ifupdown2 -y && systemctl restart networking
|
||||||
|
|
||||||
|
# install ifupdown2 ?
|
||||||
|
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt dist-upgrade -y -o DPkg::options::="--force-confold"; apt autoremove -y; DEBIAN_FRONTEND=noninteractive apt install --assume-yes -o DPkg::options::="--force-confdef" -y proxmox-ve vim isc-dhcp-server libpve-network-perl;
|
||||||
|
#systemctl disable hc-net-ifup@
|
||||||
|
reboot
|
||||||
|
apt remove -y os-prober linux-image-amd64 'linux-image-4.19*'; apt autoremove -y;
|
||||||
|
|
||||||
|
cat <<EOF>>/etc/network/interfaces
|
||||||
|
|
||||||
|
auto vmbr1
|
||||||
|
iface vmbr1 inet static
|
||||||
|
address 10.0.0.254/24
|
||||||
|
bridge-ports none
|
||||||
|
bridge-stp off
|
||||||
|
bridge-fd 0
|
||||||
|
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||||
|
post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o eth0 -j MASQUERADE
|
||||||
|
post-down iptables -t nat -F
|
||||||
|
EOF
|
||||||
|
systemctl restart networking
|
||||||
|
|
||||||
|
pvecm create pmx -link0 172.16.0.2
|
||||||
|
|
||||||
|
cat <<EOF>/etc/default/isc-dhcp-server
|
||||||
|
INTERFACESv4="vmbr1"
|
||||||
|
INTERFACESv6=""
|
||||||
|
EOF
|
||||||
|
cat <<EOF>/etc/dhcp/dhcpd.conf
|
||||||
|
default-lease-time 600;
|
||||||
|
max-lease-time 7200;
|
||||||
|
|
||||||
|
subnet 10.0.0.0 netmask 255.255.255.0 {
|
||||||
|
range 10.0.0.1 10.0.0.253;
|
||||||
|
option domain-name-servers 1.1.1.1, 8.8.8.8;
|
||||||
|
option routers 10.0.0.254;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
systemctl restart isc-dhcp-server
|
||||||
|
|
||||||
|
# controllers
|
||||||
|
# id: evpn
|
||||||
|
# asn: 65000
|
||||||
|
# peers: 172.16.0.2,172.16.0.3,172.16.0.4
|
||||||
|
|
||||||
|
# zones
|
||||||
|
# id: evpn
|
||||||
|
# tag: 10000
|
||||||
|
# exit-nodes: pmx01, pmx02
|
||||||
|
# controller: evpn
|
||||||
|
# mtu 1400
|
||||||
|
|
||||||
|
# vnets
|
||||||
|
# name: vnet1
|
||||||
|
# zone: evpn
|
||||||
|
# tag: 11000
|
||||||
|
# gateway: 192.168.1.1
|
||||||
|
|
||||||
|
# name: vnet2
|
||||||
|
# zone: evpn
|
||||||
|
# tag: 12000
|
||||||
|
# gateway: 192.168.2.1
|
||||||
|
|
||||||
|
cd /var/lib/vz/template/iso
|
||||||
|
curl -sSLO https://dl-cdn.alpinelinux.org/alpine/v3.14/releases/x86_64/alpine-virt-3.14.1-x86_64.iso
|
||||||
|
|
||||||
|
ip link set up dev eth0
|
||||||
|
ip link set mtu 1450 dev eth0
|
||||||
|
ip a add 192.168.1.2/24 dev eth0
|
||||||
|
ip route add default via 192.168.1.1
|
||||||
|
|
||||||
|
ip a add 192.168.2.2/24 dev eth0
|
||||||
|
ip route add default via 192.168.2.1
|
||||||
|
|
||||||
|
rm /etc/apt/sources.list.d/pve-enterprise.list
|
||||||
|
sed -i 's/buster\/updates/bullseye-security/g;s/buster/bullseye/g' /etc/apt/sources.list
|
||||||
|
sed -i -e 's/buster/bullseye/g' /etc/apt/sources.list.d/pve-install-repo.list
|
||||||
|
|
||||||
|
apt update && apt dist-upgrade
|
||||||
|
|
||||||
|
|
||||||
|
cd /tmp
|
||||||
|
curl -sSLO https://mutulin1.odiso.net/frr_7.5.1-2+pve_amd64.deb
|
||||||
|
curl -sSLO https://mutulin1.odiso.net/frr-pythontools_7.5.1-2+pve_all.deb
|
||||||
|
dpkg -i frr_7.5.1-2+pve_amd64.deb
|
||||||
|
dpkg -i frr-pythontools_7.5.1-2+pve_all.deb
|
||||||
|
|
||||||
|
ip route add table vrf_evpn default dev eth0 via 164.90.160.
|
||||||
|
|
||||||
|
# /etc/frr/frr.conf
|
||||||
|
bgp listen range 172.16.0.0/24
|
||||||
|
|
||||||
|
pvecm add 172.16.0.2
|
||||||
|
|
||||||
|
# vxlan zone
|
||||||
|
# id: vxlan
|
||||||
|
# peer: 172.16.0.2,172.16.0.3,172.16.0.4
|
||||||
|
# mut: 1400
|
||||||
|
|
||||||
|
# vnets
|
||||||
|
# name: vnet1
|
||||||
|
# zone: vxlan
|
||||||
|
# tag: 100000
|
||||||
|
|
||||||
|
fallocate -l 10G /var/osd.img
|
||||||
|
losetup -l -P /dev/loop1 /var/osd.img
|
||||||
|
wipefs -a /dev/loop1
|
||||||
|
lsblk
|
||||||
|
sed -i "s/'mpath'/'mpath', 'loop'/g" /usr/lib/python3/dist-packages/ceph_volume/util/disk.py
|
||||||
|
|
||||||
|
/usr/share/perl5/PVE/Diskmanage.pm
|
||||||
|
get_disks
|
||||||
|
$dev !~ m/^loop\d+$/;
|
||||||
|
|
||||||
|
get_sysdir_info
|
||||||
|
my $data = {};
|
||||||
|
if ($sysdir =~ /loop\d+/) {
|
||||||
|
$data->{size} = 1024;
|
||||||
|
$data->{rotational} = 1;
|
||||||
|
$data->{vendor} = 'unknown';
|
||||||
|
$data->{model} = 'unknown';
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
systemctl restart pvedaemon
|
||||||
|
|
||||||
|
|
||||||
|
cat <<'EOF'> /var/lib/vz/snippets/9000_bootstrap
|
||||||
|
#cloud-config
|
||||||
|
package_update: true
|
||||||
|
package_upgrade: true
|
||||||
|
ntp:
|
||||||
|
enabled: true
|
||||||
|
servers: ["pool.ntp.org"]
|
||||||
|
ssh_deletekeys: true
|
||||||
|
ssh_genkeytypes: ["ed25519", "rsa"]
|
||||||
|
runcmd:
|
||||||
|
- "apt-get -y clean"
|
||||||
|
- "apt-get -y autoremove --purge"
|
||||||
|
- "bash -c 'rm /home/ubuntu/.ssh/authorized_keys; exit 0'"
|
||||||
|
- "bash -c 'find /var/log -type f | while read f; do echo -ne >$f; done; exit 0'"
|
||||||
|
- "bash -c 'rm -rf /var/lib/cloud/*; exit 0'"
|
||||||
|
power_state:
|
||||||
|
mode: poweroff
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
curl -sSL https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img >/tmp/bionic-server-cloudimg-amd64.img
|
||||||
|
|
||||||
|
qm destroy 9000
|
||||||
|
qm create 9000 --memory 512 --net0 virtio,bridge=vmbr1
|
||||||
|
qm importdisk 9000 /tmp/bionic-server-cloudimg-amd64.img local
|
||||||
|
qm set 9000 --scsihw virtio-scsi-pci --scsi0 local:9000/vm-9000-disk-0.raw
|
||||||
|
qm set 9000 --ide0 local:cloudinit
|
||||||
|
qm set 9000 --boot c --bootdisk scsi0
|
||||||
|
qm set 9000 --serial0 socket --vga serial0
|
||||||
|
qm set 9000 --cicustom "user=local:snippets/9000_bootstrap"
|
||||||
|
qm set 9000 --ipconfig0 ip=dhcp,ip6=dhcp
|
||||||
|
qm set 9000 --kvm 0
|
||||||
|
qm set 9000 --balloon 0
|
||||||
|
qm set 9000 --cpu kvm64
|
||||||
|
|
||||||
|
qm start 9000
|
||||||
|
sleep 10;while :; do qm status 9000|grep -q stopped && break; done
|
||||||
|
qm set 9000 --cicustom ""
|
||||||
|
qm set 9000 --ipconfig0 ""
|
||||||
|
qm template 9000
|
||||||
|
|
||||||
|
|
||||||
|
# iptables
|
||||||
|
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 222 -j DNAT --to 10.0.0.11:22
|
||||||
|
iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o eth0 -j MASQUERADE
|
||||||
|
|
||||||
|
# ceph
|
||||||
|
https://www.netways.de/blog/2018/11/14/ceph-mimic-using-loop-devices-as-osd/
|
||||||
Loading…
Add table
Add a link
Reference in a new issue