c3d2-wiki/HQ%2FNetzwerk%2FPPPoE_failo...

233 lines
6.6 KiB
Plaintext
Raw Normal View History

2015-10-01 20:16:33 +02:00
[[Datei:Plitc_pppoe_failover.jpg|thumbnail|left|"serverseitiges PPPoE Failover]]
2015-10-01 20:35:54 +02:00
== Switch (Partitionierung) mit filter source-port ==
2015-10-01 20:20:15 +02:00
2015-10-01 20:53:19 +02:00
Der Switch "diethylether" (OBEN / mit der IP: '''.7''') hat per CLI ein [http://whp-hou4.cold.extweb.hp.com/pub/networking/software/Security-Oct2005-59906024-Chap10-Traf-Security-Filts.pdf HP ProCurve - filter source-port] Regelsatz
2015-10-01 20:26:06 +02:00
2015-10-01 20:31:10 +02:00
Dieser Regelsatz dient weitgehend zur Trennung der PPPoE Übertragung mit dem restlichen Netzwerk
2015-10-01 20:26:35 +02:00
* Port 1-4 dürfen nur mit Trk2 / Trk3 kommunizieren
2015-10-01 20:34:01 +02:00
* > Port 1 ist für das PPPoE DSL Modem
* > Port 2 (Notfall) Ratbert (generell ausgeschaltet)
* > Port 3 (für Debugzwecke zum Port-Mirroring)
* > Port 4 (Fritzbox für VoIP zum Asterisk LXC)
2015-10-01 20:32:56 +02:00
2015-10-01 20:34:01 +02:00
Der zweite Teil der Segmentierung sie wie folgt aus:
* > Port 5-8 (ist der Trunk von Trk2 & Trk3)
2015-10-01 20:35:54 +02:00
* > Trk2 ist freenas/storage server
* > Trk3 ist flatbert server
2015-10-01 20:46:02 +02:00
* (einige ) Port 9-20 und Trk1 (Port 21-24) dient der Kommunikation mit dem Switch (UNTEN / mit der IP: '''.6''') der das eigentliche HQ, über das Patchfeld, versorgt
2015-10-01 20:36:23 +02:00
(untagged als auch VLAN 100-105)
2015-10-01 20:28:55 +02:00
2015-10-01 20:46:02 +02:00
== PPPoE Failover Schema ==
2015-10-01 20:48:29 +02:00
* Der Flatbert Server hat den LXC Container: '''dropbert1''' mit der IP: '''.91''' (primärer PPPoE Dialin/Routing Container)
* Der FreeNAS/Storage Server hat die JAIL: '''dropbert2''' mit der IP: '''.92''' (backup PPPoE Dialin/Routing Container)
2015-10-01 20:53:19 +02:00
* Da es sich bei Flatbert um einen Linux (Debian) Server und FreeNAS/Storage um einen FreeBSD Server handelt, wird zur gegenseitigen "failover" Verständigung, innerhalb der Container, [http://www.pureftpd.org/project/ucarp ucarp] verwendet
2015-10-01 20:51:13 +02:00
2015-10-01 20:57:22 +02:00
== Funktionen der Container ==
2015-10-01 21:02:24 +02:00
* PPPoE Dialin ([https://wiki.debian.org/PPPoE Debian]/[https://www.freebsd.org/doc/handbook/pppoe.html FreeBSD])
* Routing ([https://www.debian.org/doc/manuals/network-administrator/ch-tcpip.html Debian]/[https://www.freebsd.org/doc/handbook/network-routing.html FreeBSD])
* NAT [https://wiki.debian.org/iptables iptables] unter Debian / [https://www.freebsd.org/doc/handbook/firewalls-ipfw.html ipfw] unter FreeBSD
== HOST System Einrichtung ==
=== Flatbert (Linux) ===
2015-10-01 21:34:07 +02:00
System auf den aktuellen Stand halten
<source lang=bash>
apt-get autoclean; apt-get clean; apt-get update; apt-get upgrade
</source>
Umgebungs-/Debugtools installieren
<source lang=bash>
apt-get install git iptables tcpdump sockstat iputils-ping
</source>
Kernelmodule laden
<source lang=bash>
vi /etc/modules
### pppoe routing // ###
pppoe
ip_tables
ip6_tables
ip6t_MASQUERADE
## ("pkttype" packet type match support) filter multicast
xt_pkttype
tun
### // pppoe routing ###
modprobe pppoe ip_tables ip6_tables ip6t_MASQUERADE xt_pkttype tun
</source>
Container erstellen
<source lang=bash>
lxc-fancy create
</source>
Container stoppen und LXC-Container-Config anpassen (für pppoe kernel support)
<source lang=bash>
lxc-stop -n dropbert1
vi /var/lib/lxc/dropbert1/config
#// ppp/pppoe support
lxc.cgroup.devices.allow = c 108:0 rwm
lxc.mount.entry = /dev/ppp dev/ppp none bind,optional,create=file
#// lxc-to-go bridge 1
lxc.network.link=vswitch0
</source>
WICHTIG: durch das Flatbert Netzwerkschema muss! vswitch1 nach vswitch0 umgeschrieben werden, damit „dropbert1“ direkt über die erste Bridge angebunden wird und nicht an der zweiten Bridge, die ProxyARP/ProxyNDP verwendet!
2015-10-01 21:47:25 +02:00
=== FreeNAS/Storage (FreeBSD) ===
<source lang=bash>
</source>
== Container Einrichtung ==
=== LXC: dropbert1 ===
2015-10-01 21:44:20 +02:00
„dropbert1“ Container: starten und einloggen
2015-10-01 21:23:06 +02:00
<source lang=bash>
2015-10-01 21:44:20 +02:00
lxc-start -n dropbert1
lxc-attach -n dropbert1
2015-10-01 21:23:06 +02:00
</source>
2015-10-01 21:02:24 +02:00
2015-10-01 21:44:20 +02:00
Der Container sollte automatisch per DHCP eine IP Adresse zugewiesen bekommen.
2015-10-01 21:34:07 +02:00
2015-10-01 21:44:20 +02:00
„dropbert1“ Container: ucarp und pppoeconf installieren
2015-10-01 21:34:07 +02:00
<source lang=bash>
2015-10-01 21:44:20 +02:00
apt-get autoclean; apt-get clean; apt-get update; apt-get upgrade
apt-get install ucarp pppoeconf
2015-10-01 21:34:07 +02:00
</source>
2015-10-01 21:44:20 +02:00
„dropbert1“ Container: pppoe einrichten
2015-10-01 21:34:07 +02:00
<source lang=bash>
2015-10-01 21:44:20 +02:00
pppoeconf
2015-10-01 21:34:07 +02:00
</source>
2015-10-01 21:44:20 +02:00
„dropbert1“ Container: Netzwerk Interface Konfiguration
2015-10-01 21:34:07 +02:00
<source lang=bash>
2015-10-01 21:44:20 +02:00
vi /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
pre-up ifconfig eth0 up
post-down ifconfig eth0 down
2015-10-01 21:34:07 +02:00
2015-10-01 21:44:20 +02:00
auto eth1
iface eth1 inet static
address 172.22.99.91
netmask 255.255.255.0
gateway 172.22.99.4
up /usr/sbin/ucarp -i eth1 -f daemon -B -p TOPSECRET -P -z -u /usr/share/ucarp/vip-up -d /usr/share/ucarp/vip-down -b 1 -k 1 -s 172.22.99.91 -a 172.22.99.4 -v 1
up ping -S 172.22.99.4 -c 2 -q 172.22.99.7
down pkill ucarp
# The carp network interface, on top of eth0
iface eth1:ucarp inet static
#/ address 172.22.99.90
address 172.22.99.4
netmask 255.255.255.0
auto dsl-provider
iface dsl-provider inet ppp
pre-up /bin/ip link set eth0 up # line maintained by pppoeconf
provider dsl-provider
# EOF
2015-10-01 21:34:07 +02:00
</source>
2015-10-01 21:44:20 +02:00
„dropbert1“ Container: damit nach dem failover Moduswechsel (von BACKUP auf MASTER) auch der tatsächliche Switch die neue MAC Adresse zur virtuellen (virtual shared) IP erhält, wird das ucarp-up Skript angepasst indem man einfach ein Ping anschließend senden lässt
2015-10-01 21:34:07 +02:00
<source lang=bash>
2015-10-01 21:44:20 +02:00
vi /usr/share/ucarp/vip-up
2015-10-01 21:34:07 +02:00
2015-10-01 21:44:20 +02:00
#!/bin/sh
# /sbin/ifup $1:ucarp
/sbin/ifup eth1:ucarp
sleep 1 && ping -S 172.22.99.4 -c 2 -q 172.22.99.7
2015-10-01 21:34:07 +02:00
</source>
2015-10-01 21:44:20 +02:00
„dropbert1“ Container: /etc/sysctl.conf & /etc/rc.local anpassen
2015-10-01 21:34:07 +02:00
<source lang=bash>
2015-10-01 21:44:20 +02:00
vi /etc/sysctl.conf
### ### ### ROUTING // ### ### ###
net.ipv4.conf.all.forwarding=1
net.ipv6.conf.eth0.accept_ra=0
### ### ### // ROUTING ### ### ###
# EOF
</source>
2015-10-01 21:34:07 +02:00
2015-10-01 21:44:20 +02:00
<source lang=bash>
vi /etc/rc.local
#!/bin/sh
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
#
### ### ### C3D2 // ### ### ###
#/ echo "stage0"
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
ip6tables -F
ip6tables -X
ip6tables -t nat -F
ip6tables -t nat -X
ip6tables -t mangle -F
ip6tables -t mangle -X
ip6tables -P INPUT ACCEPT
ip6tables -P FORWARD ACCEPT
ip6tables -P OUTPUT ACCEPT
#/ echo "stage1"
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
sysctl net.ipv4.conf.default.forwarding=1 > /dev/null 2>&1
sysctl net.ipv4.conf.eth0.forwarding=1 > /dev/null 2>&1
exit 0
### ### ### C3D2 // ### ### ###
# EOF
2015-10-01 21:34:07 +02:00
</source>
2015-10-01 21:44:20 +02:00
Sofern ich an dieser Stelle nichts nennenswertes vergessen habe zu erwähnen, sollte nach einem Container Neustart die PPPoE Einwahl und das Routing schon funktionieren
2015-10-01 21:02:24 +02:00
=== JAIL: dropbert2 ===
2015-10-01 21:23:06 +02:00
<source lang=bash>
</source>
2015-10-01 21:02:24 +02:00
#