Skip to main content

Primary links

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

Misc

  • Linux
  • Hardware
  • Programming
  • Databases
  • CLI
  • Multimedia
  • Plugins
  • Windows

Cloud

  • OpenStack
  • cloud-config
  • nextcloud

Virtualization

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

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

LLDP: Identify switch port to which the server is connected

Show LLDP neighbors

networkctl lldp

lldpctl
http://www.panticz.de/lldpd

for NIC in $(find /sys/class/net -type l -not -lname "*virtual*" -printf "%f\n" | sort); do
    echo "NIC: ${NIC}"
    echo "NIC MAC: $(ethtool -P ${NIC})"
    timeout 300 tcpdump -nn -v -i ${NIC} -s 1500 -c 1 "ether[20:2] == 0x2000"
done

Get host port, switch, switch port assignment

LLDP_JSON=$(lldpctl -f json)

NICS=$(echo ${LLDP_JSON} | jq -r '.lldp.interface[] | select(.[].port.id.type != "mac") | keys[]')
# echo ${NICS}

for NIC in ${NICS}; do
    # echo ${HOSTNAME}
    # echo ${NIC}

    SWITCH_NAME=$(echo ${LLDP_JSON} | jq -r ".lldp.interface[].${NIC} | select(.chassis != null) .chassis | keys[]")
    # echo ${SWITCH_NAME}

    SWITCH_PORT=$(echo ${LLDP_JSON} | jq -r ".lldp.interface[].${NIC} | select(.chassis != null) .port.id.value")
    # echo ${SWITCH_PORT}

    SWITCH_VLAN=$(echo ${LLDP_JSON} | jq -r ".lldp.interface[].${NIC} | select(.chassis != null) .vlan.\"vlan-id\"")
    # echo ${SWITCH_VLAN}

    echo "${HOSTNAME},${NIC},${SWITCH_NAME},${SWITCH_PORT},${SWITCH_VLAN}"
done

nmcli - NetworkManager command line tool

# list all connections
nmcli con
nmcli con show --active | grep -i vpn

# show connection details
nmcli con show 'MY_CONNECTION_1'

# start vpn from command line (ubuntu)
nmcli con up id VPN_NAME

nmcli device wifi list

# create wifi configuration
SSID="FRITZ!Box 5960"
PASS=00011090700208423311

nmcli con add con-name "${SSID}" ifname wlan0 type wifi ssid "${SSID}"
nmcli con modify "c}" wifi-sec.key-mgmt wpa-psk
nmcli con modify "${SSID}" wifi-sec.psk "${PASS}"

# set DNS
nmcli con mod wg0 ipv4.dns "8.8.8.8 8.8.4.4."

nmcli con up "${SSID}"

# get connection UUID
nmcli -g connection.uuid connection show 
nmcli -t -f UUID con


# test: bounding
nmcli con add type bond con-name bond1 ifname bond1 mode 802.3ad ipv4 179.254.0.2/16
nmcli con mod id bond1 bond.options mode=802.3ad,miimon=100,lacp_rate=fast,xmit_hash_policy=layer2+3
nmcli con mod id bond1 802-3-ethernet.mtu 9000
nmcli con add type bond-slave ifname p5p1 con-name p5p1 master bond1
nmcli con add type bond-slave ifname p5p1 con-name p5p2 master bond1

# prority
nmcli connection modify "Samsung Galaxy A7" connection.autoconnect-priority 999

# disable autoconnect
nmcli connection modify wg0 autoconnect no

# configure secondaries hack (static DNS required)
nmcli connection modify my-wireguard connection.secondaries my-anyconnect

Autostart delayed VPN connection

# /home/foo/.config/autostart/vpn.desktop 
[Desktop Entry]
Type=Application
Exec=nmcli con up VPN1
Hidden=false
NoDisplay=false
X-GNOME-Autostart-Delay=3
X-GNOME-Autostart-enabled=true
Name=Auto connect to VPN1

NetworkManager event scripts

/etc/NetworkManager/dispatcher.d/

Network manager GUI

DNS

dig

dig txt example.com @8.8.8.8
dig example.com | grep -v ";" | grep A
dig -x 8.9.10.11 | grep IN

DNS

# Get DNS resolv status
resolvectl status
systemd-resolve --status

# Flush DNS cache
sudo systemd-resolve --flush-caches

Flush DNS cache

sudo systemd-resolve --flush-caches

SystemV

# flush DNS
systemctl restart nscd

# resolvconf
sudo systemctl enable resolvconf

SPF
http://wiki.hetzner.de/index.php/DNS_SPF

DIG
https://www.cyberciti.biz/faq/linux-unix-dig-command-examples-usage-syntax/
https://intodns.com/

dig @10.0.0.22 -p 8500 +short A www1.example.com

DNSSEC
https://www.scip.ch/?labs.20140911
# validator
https://dnsviz.net/
https://dnssec-analyzer.verisignlabs.com/

Public recursive name server
https://en.wikipedia.org/wiki/Public_recursive_name_server

AdGuard free / public DNS filter
https://adguard.com/en/blog/adguard-dns-new-addresses.html

Compile iPXE

https://ipxe.org/download

[embed_url: https://raw.githubusercontent.com/panticz/preseed/master/ipxe/scripts/build_ipxe.sh]

EFI

#make bin-x86_64-linux/ipxe.pxe
make bin-x86_64-efi/ipxe.efi
ll ./bin-x86_64-efi/ipxe.efi

Build targets
https://ipxe.org/appnote/buildtargets

List of hardware
https://ipxe.org/appnote/hardware_drivers

ToDo: https boot
http://ipxe.org/cfg/crosscert
http://ipxe.org/cfg/trust

Links
http://ipxe.org
http://ipxe.org/download
http://www.coreboot.org/IPXE

Ubiquiti

Default credentials
IP: 192.168.1.1
User: ubnt
Password: ubnt

Firmware EdgeRouter 4 (ER-4)
https://www.ui.com/download/software/er-4

Wireguard
https://www.hostifi.com/blog/edgerouter-wireguard-remote-access-vpn

OpenVPN

Install
http://www.panticz.de/install_OpenVPN

Restore prevoius NetworkManager OpenVPN configurations
[embed_url: https://raw.githubusercontent.com/panticz/scripts/master/restoreOpenvpnConfig.sh]

# set file permission and owner
echo sudo chown root:root /etc/NetworkManager/system-connections/*.openvpn
echo sudo chmod 600 /etc/NetworkManager/system-connections/*.openvpn

config file

tls-client
client
dev tun
proto udp
tun-mtu 1400
remote YOUR_HOST.dyndns.org 1194
ca ca.pem
cert user.pem
key keys.pem
cipher BF-CBC
comp-lzo
verb 3
ns-cert-type server
tls-remote YOUR_HOST.dyndns.org
float

Connect to Client in same IP range

route add 192.168.1.31 dev tap0

extract p12 file

# Convert PKCS12 to PEM
openssl pkcs12 -nodes -in *.p12 -out ca.pem

# Extract private key
openssl pkey -in ca.pem -out priv.pem

# Extract certificate
openssl x509 -in ca.pem -out certificate.pem

# openssl pkcs12 -in *.p12 -clcerts -nokeys -nodes -out user.pem
# openssl pkcs12 -in *.p12 -cacerts -nodes -out ca.pem
# openssl pkcs12 -in *.p12 -nocerts -nodes -out keys.pem

remove passphrase from a pkcs12 certificate

openssl pkcs12 -in protected.p12 -nodes -out /tmp/temp.pem
openssl pkcs12 -export -in /tmp/temp.pem  -out unprotected.p12

OpenVPN Gui (Client for Windows)
http://man.chinaunix.net/linux/efw-admin-guide-html-chunk/efw.vpn.openvpn.html

C:\Programme\OpenVPN\config\YOUR_VPN.ovpn (old)
client
proto udp
remote YOUR_SERVER.dyndns.org
resolv-retry infinite
nobind
persist-key
persist-tun
ca YOUR_CERT.cer
auth-user-pass
comp-lzo
dev tap

Configure Gnome Network Applet for Endian
VPN-Connections > VPN-Configure
Add
Create
Connection Name: YOUR_VPN_NAME
Gateway: YOUR_VPN_SERVER_IP
Type: Password
Username: YOUR_VPN_USER_NAME
Password: YOUR_VPN_PASS
CA Certificate: YOUR_ENDIAN .pem file

Advanced:
Use LZO Data Compression: checked
Use a TAP Device: check
OK

IPv4 settings > Routing:
Add
Address: YOUR_VPN_NETWORK (192.168.1.0)
Netmask: 255.255.255.0

backup your OpenVPN connections
tar cjf ~/backup/system-connections.$(date -I).tar.bz2 /etc/NetworkManager/system-connections/

Android
https://play.google.com/store/apps/details?id=de.blinkt.openvpn&hl=de
http://www.rz.uni-kiel.de/pc/openvpn/AndroidVPN

Networks

Configure static IP

#  /etc/network/interfaces
auto eth0
iface eth0 inet static
address 10.10.0.12
netmask 255.255.255.0
#        network 192.168.0.0
#        broadcast 192.168.1.255
gateway 10.10.0.1
#dns-nameserver 8.8.8.8
dns-nameservers 10.10.1.253 10.10.1.254
dns-search example.com
dns-domain example.com
up route add -net 10.20.0.0 netmask 255.255.0.0 gw 10.10.1.1

#iface eth0 inet6 auto
iface eth0 inet6 static
  address 2001:db8:1:2::2
  netmask 64
  gateway fe80::1

Configure by DHCP IP

auto eth0
iface eth0 inet dhcp

Configure manual

Pagination

  • Previous page
  • 3
network
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