Skip to main content

Primary links

  • Home
  • AI
  • Kubernetes
  • Incus
  • Ansible
  • Terraform
  • OpenStack
  • Virtualization
  • Linux
  • SmartHome
  • HowTo

Misc

  • Linux
  • Hardware
  • Programming
  • Databases
  • Multimedia
  • Windows

Cloud

  • OpenStack
  • cloud-config
  • nextcloud

Virtualization

  • Virtualization
  • Incus
  • Docker
  • KVM
  • Kubernetes
  • LXC
  • LXD
  • QEMU
  • VMware
  • VirtualBox
  • multipass
  • podman
  • vagrant
  • XEN

Network

  • DNS
  • Firewall
  • Linux
  • OpenvSwitch
  • SSL
  • VLAN
  • VPN
  • iPXE
  • namespaces
  • nmcli
  • tcpdump

Storage

  • CEPH
  • DRBD
  • LVM
  • S3
  • ZFS
  • btrfs

Automation / CI/CD

  • Install
  • Ansible
  • GitLab
  • LLM
  • Preseed
  • Puppet
  • Terraform
  • Ubuntu autoinstall

Monitoring / Visualisation

  • Grafana
  • Icinga
  • Prometheus
  • Monitoring
  • ELK
  • mermaid

Site to Site IPSec VPN with strongSwan and OpenStack VPNaaS (IPsec)

List

openstack vpn ipsec site connection list
openstack vpn endpoint group list
openstack vpn service list
openstack vpn ipsec policy list
openstack vpn ike policy list

Setup

# install
sudo apt-get install -y strongswan

# Left (Peer client, behind NAT)
Ubuntu Client IP: 212.8.9.10
Ubuntu net: 192.168.178.0/24

OpenStack VPN IP: 217.50.60.70
OpenStack Net: 10.0.1.0/24

Create OpenStack VPN endpoint
http://www.panticz.de/openstack/vpn-fritzbox

/etc/ipsec.conf

# Peer, e.g. FritzBox
VPN_LEFT_IP=$(curl -s ipinfo.io/ip)
VPN_LEFT_NET=$(ip -o -4 a | grep -v ": lo" | cut -d " " -f7)   # e.g 10.0.100.0/24 

# Right (OpenStack VPNaaS)
# OpenStack VPN Service IP:
# VPN_SERVICE_ID=$(openstack vpn service list -c ID -f value)
# openstack vpn service show ${VPN_SERVICE_ID} -c external_v4_ip -f value
VPN_RIGHT_IP=1.2.3.4

# OpenStack subnet netmask
# for eatch subnet
# openstack vpn ipsec site connection list -f json --long | jq -r ".[] | select(.\"VPN Service\" == \"${VPN_SERVICE_ID}\") .\"Local Endpoint Group ID\""
# openstack subnet show ${SUBNET_ID} -c cidr -f value
VPN_RIGHT_NET=10.0.1.0/24 

mv /etc/ipsec.conf /etc/ipsec.conf.org
cat < /etc/ipsec.conf
config setup

conn vpn1
 keyexchange=ikev1
 left=%defaultroute
 leftid=${VPN_LEFT_IP}
 leftsubnet=${VPN_LEFT_NET}
 leftauth=psk
 leftfirewall=yes
 authby=psk
 auto=start
 ike=aes256-sha512-modp1024
 esp=aes256-sha512
 right=${VPN_RIGHT_IP}
 rightsubnet=${VPN_RIGHT_NET}
 rightauth=psk
 ikelifetime=3600s
 keylife=3600s
 type=tunnel
EOF

/etc/ipsec.secrets

Ubuntu 25.04 Plucky Puffin LTS

Schedule
https://wiki.ubuntu.com/PluckyPuffin/ReleaseSchedule

ReleaseNotes
https://wiki.ubuntu.com/PluckyPuffin/ReleaseNotes

Known issues
https://wiki.ubuntu.com/FocalFossa/ReleaseNotes#Known_issues

Download
Releases: https://releases.ubuntu.com/releases/25.04
Cloud image (minimal): https://cloud-images.ubuntu.com/minimal/daily/focal/current/focal-minimal-cloudimg-amd64.img
Netboot: http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/current/images/netboot/mini.iso
Torrent: http://releases.ubuntu.com/20.04/ubuntu-20.04-desktop-amd64.iso.torrent

Repository

echo "deb http://de.archive.ubuntu.com/ubuntu focal main restricted universe multiverse" \
    sudo tee /etc/apt/sources.list.d/ubuntu-focal.list
echo "deb http://de.archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse" \
    sudo tee /etc/apt/sources.list.d/ubuntu-focal-updates.list

# v2
deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu focal main restricted universe multiverse
deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse
deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu focal-security main restricted universe multiverse
deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse

sudo apt update

DEP

Workarounds

# skip disk check
fsck.mode=skip

# Install and configure python2 as default
sudo apt install -y python-is-python2

# set python3 as default
apt install -y python-is-python3

# Install PIP 2 under Ubuntu 20.04
wget https://bootstrap.pypa.io/2.7/get-pip.py -qO- | python2

Reenable hle and rtm CPU flags
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1853200
https://unix.stackexchange.com/questions/43539/what-do-the-flags-in-proc-cpuinfo-mean
https://access.redhat.com/articles/tsx-asynchronousabort

Gnome / Ubuntu: Configure MIME-Type

Show default mime
https://wiki.ubuntuusers.de/xdg-utils/

file --mime script1.sh
xdg-mime query filetype script1.sh
xdg-mime query default text/x-shellscript

xdg-mime query default inode/directory
xdg-mime query default text/html
xdg-mime query default x-scheme-handler/mailto
xdg-mime query default text/plain
xdg-mime query default image/jpeg
xdg-mime query default application/pdf

# set default browser?
https://askubuntu.com/questions/1161752/how-can-i-configure-a-domain-specific-default-browser
gio mime x-scheme-handler/http
gio mime x-scheme-handler/https
xdg-settings set default-web-browser chromium-browser.desktop

Configure user default MIME-Type application

#xdg-mime default code.desktop text/plain
xdg-mime default code_code.desktop text/plain
xdg-mime default code_code.desktop application/x-shellscript

# old
https://wiki.selfhtml.org/wiki/MIME-Type/%C3%9Cbersicht#T
by user

mkdir -p ~/.local/share/applications

cat <> ~/.local/share/applications/mimeapps.list
[Default Applications]
text/plain = code.desktop
text/x-shellscript = code.desktop
EOF

sed -i 's|text/plain = .*|text/plain = code.desktop|g' ~/.local/share/applications/mimeapps.list

Configure global

/etc/gnome/defaults.list
sudo sed -i 's|text/plain=gedit.desktop|text/plain=code.desktop|g' /etc/gnome/defaults.list

gio
https://help.gnome.org/admin/system-admin-guide/stable/mime-types-application-user.html.en

gio mime text/plain

Install: tinyproxy

sudo apt-get install -y tinyproxy

sed -i 's|#Allow 192.168.0.0/16|Allow 192.168.0.0/16|g' /etc/tinyproxy.conf
sed -i 's|Port 8888|Port 8080|g' /etc/tinyproxy.conf

Port 80
Allow 10.0.0.0/8

FilterExtended On
FilterURLs On
FilterDefaultDeny Yes
Filter "/etc/tinyproxy/whitelist"
#Filter "/etc/tinyproxy/filter"


service tinyproxy restart

Visual Studio Code

Install from snap repository

# install
sudo snap install code --classic

Install from APT repository

# deb download
# https://code.visualstudio.com/docs/setup/linux
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install code # or code-insiders

# manual download
wget -q https://update.code.visualstudio.com/latest/linux-deb-x64/stable -O /tmp/code.deb
sudo dpkg -i /tmp/code.deb

# create starter
cat << EOF> /usr/share/applications/code.desktop
[Desktop Entry]
Name=Visual Studio Code
Exec=/snap/bin/code %U
Icon=/snap/code/current/usr/share/pixmaps/com.visualstudio.code.png
Type=Application
StartupNotify=false
Categories=Utility;TextEditor;Development;IDE;
Actions=new-empty-window;
EOF

Configure Visual Studio Code as default text editor

xdg-mime default code.desktop text/html
# xdg-mime default code.desktop text/plain
xdg-mime default code_code.desktop text/plain

# old
mkdir -p ~/.local/share/applications
cat <> ~/.local/share/applications/mimeapps.list
[Default Applications]
text/plain = code.desktop
text/x-shellscript = code.desktop
EOF

sed -i 's|text/plain = .*|text/plain = code.desktop|g' ~/.local/share/applications/mimeapps.list

Keyboard shortcuts for Linux
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf

Oracle SQL Developer Extension for VSCode
https://marketplace.visualstudio.com/items?itemName=Oracle.sql-developer

ext install Oracle.sql-developer

Extensions
https://github.com/viatsko/awesome-vscode

Terraform
# code fromatting works only when directory is opened?
https://medium.com/nerd-for-tech/how-to-auto-format-hcl-terraform-code-in-visual-studio-code-6fa0e7afbb5e
https://marketplace.visualstudio.com/items?itemName=HashiCorp.terraform
https://github.com/hashicorp/vscode-terraform

Snap (Ubuntu package management)

Snap package search
https://snapcraft.io/store

Install

sudo apt install -y snapd

Configure proxy
https://snapcraft.io/docs/system-options
http://www.panticz.de/proxy (encrypt spedial characters in proxy password)

sudo snap set system proxy.https="${https_proxy}"
sudo snap set system proxy.http="${http_proxy}"

CLI

systemctl status snapd

snap find
snap install
snap info 

# update
snap refresh

# Update packages
snap refresh --list

# purge package
snap remove --purge libreoffice

Configure proxy (DEPRECTED)

# sudo mkdir -p /etc/systemd/system/snapd.service.d/
# echo "[Service]
# Environment=\"http_proxy=${http_proxy}\"
# Environment=\"https_proxy=${https_proxy}\"" | sudo tee /etc/systemd/system/snapd.service.d/http-proxy.conf

# sudo systemctl daemon-reload
# sudo systemctl restart snapd

# # debug proxy
# systemctl show snapd | grep proxy

# ###############################3
# # proxy test (broken?)
# # cat /etc/environment
# http_proxy="http://BENUTZER:PASSWORD@proxy.hostname.de:8080/"
# https_proxy="http://BENUTZER:PASSWORD@proxy.hostname.de:8080/"

# sudo systemctl edit snapd.service
# [Service]
# EnvironmentFile=/etc/environment

# sudo systemctl daemon-reload
# sudo systemctl restart snapd.service

Configure proxy (Ansible)

---
- hosts: localhost
  tasks:
    - name: Configure snap proxy
      become: yes
      ini_file:
        path: /etc/systemd/system/snapd.service.d/http-proxy.conf
        section: Service
        option: Environment
        value: '"http_proxy=http://proxy.example.com:8080"'
        mode: 0644
        create: yes
      notify: restart snapd

  handlers:
    - name: restart snapd
      systemd:
        name: snapd
        state: restarted
        daemon_reload: yes

Service
https://snapcraft.io/docs/service-management

Cleanup old versions

Cloud images (cloud-images)

Get images
https://docs.openstack.org/image-guide/obtain-images.html

Ubuntu
https://cloud-images.ubuntu.com/releases/
https://cloud-images.ubuntu.com/minimal/releases/

Ubuntu minimal cloud images
https://wiki.ubuntu.com/Minimal?_ga=2.234110487.847966267.1636368030-2121923539.1598520245

# 24.04 (noble)
https://cloud-images.ubuntu.com/minimal/daily/noble/current/noble-minimal-cloudimg-amd64.img
# 22.04 (jammy)
https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64-disk-kvm.img
# 20.04 (focal)
https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64-disk-kvm.img
# 18.04 (bionic)
https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img
# 16.04 (xenial)
https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img

Deploy OpenStack image

openstack image create "Ubuntu 24.04 minimal" \
  --file noble-minimal-cloudimg-amd64.img \
  --disk-format qcow2 \
  --min-disk 4 \
  --min-ram 1024 \
  --property hw_scsi_model=virtio-scsi \
  --property hw_disk_bus=scsi \
  --property hw_qemu_guest_agent=yes \
  --property os_distro=ubuntu \
  --property os_admin_user=ubuntu \
  --property os_version="24.04"

Get image version

cat /etc/cloud/build.info
# allow root login
cp /home/ubuntu/.ssh/authorized_keys /root/.ssh/authorized_keys

Windows
https://cloudbase.it/windows-cloud-images/#download
https://www.linuxsysadmins.com/create-windows-server-image-for-openstack/

RedHat
https://access.redhat.com/downloads/content/479/ver=/rhel---8/8.1/x86_64/product-software
https://access.redhat.com/downloads/content/69/ver=/rhel---7/7.7/x86_64/product-software

ISP / DSL speedtest Internet connection measurement CLI

Install

curl -sL  https://packagecloud.io/ookla/speedtest-cli/gpgkey | sudo apt-key add -

cat < /etc/apt/sources.list.d/ookla_speedtest-cli.list 
deb https://packagecloud.io/ookla/speedtest-cli/ubuntu/ $(lsb_release -cs) main
deb-src https://packagecloud.io/ookla/speedtest-cli/ubuntu/ $(lsb_release -cs) main
EOF

sudo apt update

sudo apt-get install -y speedtest

Links
https://www.speedtest.net/apps/cli
https://www.speedtest.net/

cloud-image-utils

sudo apt install -y qemu-kvm cloud-image-utils
wget https://cloud-images.ubuntu.com/releases/18.04/release/ubuntu-18.04-server-cloudimg-amd64.img

#cloud-config
password: ubuntu
chpasswd: { expire: False }
ssh_pwauth: True
ssh_import_id: ${USER}

cloud-localds seed.img seed
sudo kvm-spice -m 2048 -drive file=ubuntu-18.04-server-cloudimg-amd64.img,if=virtio,cache=writeback -cdrom seed.img -net nic,model=virtio -net user,hostfwd=tcp::222-:22
# -balloon virtio  

# login credentials:
user: ubuntu
pass: ubuntu

ssh ubuntu@localhost:2222

Install prometheus under Ubuntu

Install from repository

sudo apt-get install -y prometheus
# optional
sudo apt-get install -y prometheus-node-exporter
sudo apt-get install -y prometheus-alertmanager
sudo apt-get install -y prometheus-pushgateway

Ansible installation

https://github.com/panticz/ansible/tree/master/roles/prometheus
- hosts: localhost
  roles:
    - prometheus

Login
http://SERVER_IP:9090/

Commands

avg_over_time(node_memory_MemAvailable[5m])/1024/1024

Repositroy
https://github.com/cloudalchemy/ansible-prometheus

Docker

docker run --name prometheus -d -p 127.0.0.1:9090:9090 quay.io/prometheus/prometheus

Ports
https://github.com/prometheus/prometheus/wiki/Default-port-allocations

API
http://SERVER_IP:9090/metrics

Query

node_disk_io_now{device="sda"}

Deploy node_exporter without installation

# https://prometheus.io/download/#node_exporter
wget https://github.com/prometheus/node_exporter/releases/download/v0.16.0/node_exporter-0.16.0.linux-amd64.tar.gz -qO /tmp/node_exporter.tar.gz
tar xzf /tmp/node_exporter.tar.gz -C /tmp/
mv /tmp/node_exporter-0.16.0.linux-amd64/node_exporter /usr/bin/prometheus-node-exporter
nohup /usr/bin/prometheus-node-exporter &
prometheus-node-exporter --version

node_exporter Ansible installation

https://github.com/panticz/ansible/tree/master/roles/prometheus-node-exporter
- hosts: localhost
  roles:
    - prometheus-node-exporter

Use SSH tunnel to access node_exporter metrics
https://mkezz.wordpress.com/2017/08/04/prometheus-in-docker-ssh-tunnel-to-target-nodes/

Alerting
http://prometheus.example.com:9093/

Pagination

  • 1
  • Next page
ubuntu
Profiles GitHub StackOverflow LinkedIn Xing
Contact Imprint
© panticz 2026

Cookie-Einstellungen

Diese Website nutzt eingebettete Inhalte von Drittanbietern (z.B. YouTube, SoundCloud). Beim Laden dieser Inhalte werden Daten an die jeweiligen Anbieter übermittelt. Datenverarbeitungserklärung