Page 1 of 1

[Linux] Debian + pi-hole + bandwidthd

Posted: Mon, 2. Apr 2018, 16:59
by News-Writer
  1. Installation Debian 9.4 aus dem internet mit dem net-Installer-ISO
  2. Umbenennen der Interfaces von ens* zu eth*
  3. Installation und Konfiguration von pi-hole
  4. Vorbereitung der Datenbank (MariaDB) für
  5. Installation von Bandwidthd

Linux-Installation

Posted: Mon, 2. Apr 2018, 17:00
by News-Writer
xxx

Nachinstallation von netstat:

Code: Select all

apt-get install net-tools

rename Interfaces

Posted: Mon, 2. Apr 2018, 17:00
by News-Writer
Mit dem Befehl

Code: Select all

dmesg | grep vmxnet3
(in diesem Fall ist der Netzwerk-Adapter ein vmxnet3, da die Maschine auf einem ESXi läuft) kann man sehen, das während des Bootes die Adapter umbenannt werden:

Code: Select all

[    0.460404] VMware vmxnet3 virtual NIC driver - version 1.4.a.0-k-NAPI
[    0.460415] vmxnet3 0000:0b:00.0: # of Tx queues : 1, # of Rx queues : 1
[    0.461158] vmxnet3 0000:0b:00.0 eth0: NIC Link is Up 10000 Mbps
[    0.461177] vmxnet3 0000:13:00.0: # of Tx queues : 1, # of Rx queues : 1
[    0.461938] vmxnet3 0000:13:00.0 eth1: NIC Link is Up 10000 Mbps
[    0.495939] vmxnet3 0000:0b:00.0 ens192: renamed from eth0
[    0.497533] vmxnet3 0000:13:00.0 ens224: renamed from eth1
[    5.484375] vmxnet3 0000:0b:00.0 ens192: intr type 3, mode 0, 2 vectors allocated
[    5.484448] vmxnet3 0000:0b:00.0 ens192: NIC Link is Up 10000 Mbps
Um dies zu unterbinden ist es nötig einen Eintrag in der Datei /etc/default/grub anzupassen:

Code: Select all

vi /etc/default/grub
Aus

Code: Select all

GRUB_CMDLINE_LINUX=""
in Zeile 10 muss

Code: Select all

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
werden.

Ich habe dann das System einmal neugestartet, um alle Änderungen zu übernehmen:

Code: Select all

init 6
Als letztesmuss nun noch in der Datei /etc/network/interfaces alles, was auf die alten Interface-Name gezeigt hat auf die neuen umgestellt werden:

Code: Select all

vi /etc/network/interfaces
Hier, wie es vorher aussah:

Code: Select all

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens192
iface ens192 inet dhcp

allow-hotplug ens224
iface ens224 inet dhcp
Und jetzt:

Code: Select all

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
        address 192.168.178.4
        netmask 255.255.255.0
        dns-nameservers 192.168.178.1
        gateway 192.168.178.1

allow-hotplug eth1
iface eth1 inet static
        address 192.168.178.9
        netmask 255.255.255.0
        dns-nameservers 192.168.178.1
        gateway 192.168.178.1
Ich habe bei dieser Gelegenheit gleich feste IP-Adressen konfiguriert. Es handelt sich bei dieser Maschine schließlich um "Infrastruktur". Daher mein Tipp: besser feste als dynamische Adressen konfigurieren.

pi-hole

Posted: Mon, 2. Apr 2018, 17:02
by News-Writer
Als root muss auf der Console nur der Befehl

Code: Select all

curl -sSL https://install.pi-hole.net | bash
aufgerufen werden. Damit wird der pi-hole-Installer heruntergeladen und auch gleich die Installation gestartet.

Hier ein paar Screenshots von der Installation:

DB-Vorbereitung

Posted: Mon, 2. Apr 2018, 17:02
by News-Writer
xxx

Bandwidthd-Installation und lighttpd-Config

Posted: Mon, 2. Apr 2018, 17:03
by News-Writer
Installation von bandwidthd via apt:

Code: Select all

apt-get install bandwidthd
Erstellen von /etc/lighttpd/conf-available/91-aliases.conf:

Code: Select all

alias.url += (
        "/bandwidth/" => "/var/lib/bandwidthd/htdocs/"
)
Erstellen eines Links in /etc/lighttpd/conf-enabled:

Code: Select all

cd /etc/lighttpd/conf-enabled
ln -s ../conf-available/91-aliases.conf 91-aliases.conf
Restart des Web-Servers:

Code: Select all

/etc/init.d/lighttpd restart