From 0143e262ec3b5f8ecc222d29f4a464ad4e5902bd Mon Sep 17 00:00:00 2001 From: eichehome Date: Fri, 18 Feb 2022 22:02:53 +0100 Subject: [PATCH] Dateien erstellt --- Ansible/ansible.cfg | 0 Ansible/playbook.yaml | 38 +++++++++++++++++++++++++ Ansible/roles/common/files/main.yaml | 0 Ansible/roles/common/tasks/main.yaml | 0 Ansible/roles/common/template/main.yaml | 0 Ansible/roles/common/vars/main.yaml | 0 Systemd/25-ethernet-default.network | 20 +++++++++++++ Systemd/25-wlan-default.nework | 19 +++++++++++++ Systemd/25-wwan-default.network | 19 +++++++++++++ Systemd/DHCPv4.network | 14 +++++++++ Systemd/resolv.conf | 8 ++++++ Systemd/wg0-client.netdev | 14 +++++++++ Systemd/wg0-client.network | 11 +++++++ Systemd/wg0-server.netdev | 13 +++++++++ Systemd/wg0-server.network | 10 +++++++ 15 files changed, 166 insertions(+) create mode 100644 Ansible/ansible.cfg create mode 100644 Ansible/playbook.yaml create mode 100644 Ansible/roles/common/files/main.yaml create mode 100644 Ansible/roles/common/tasks/main.yaml create mode 100644 Ansible/roles/common/template/main.yaml create mode 100644 Ansible/roles/common/vars/main.yaml create mode 100644 Systemd/25-ethernet-default.network create mode 100644 Systemd/25-wlan-default.nework create mode 100644 Systemd/25-wwan-default.network create mode 100644 Systemd/DHCPv4.network create mode 100644 Systemd/resolv.conf create mode 100644 Systemd/wg0-client.netdev create mode 100644 Systemd/wg0-client.network create mode 100644 Systemd/wg0-server.netdev create mode 100644 Systemd/wg0-server.network diff --git a/Ansible/ansible.cfg b/Ansible/ansible.cfg new file mode 100644 index 0000000..e69de29 diff --git a/Ansible/playbook.yaml b/Ansible/playbook.yaml new file mode 100644 index 0000000..43ee176 --- /dev/null +++ b/Ansible/playbook.yaml @@ -0,0 +1,38 @@ +--- +- name: Install Container-runtime Podman - misc + remote_user: eichehome + + tasks: + - name: Install Podman + ansible.builtin.package: + name: podman + state: present + + - name: Install Git + ansible.builtin.package: + name: git + state: present + + - name: Create Directory + ansible.builtin.file: + path: '/git/Network-Setup' + state: directory + + - name: Checkout Git + ansible.builtin.git: + repo: 'https://git.sp-codes.de/eichehome/Network-Setup' + dest: /git/Network-Setup + + - name: Setup wg0 + ansible.builtin.file: + src: '/git/Network-Setup/Systemd/{{ item.src }}' + dest: '/etc/systemd/network/{{ item.dest }}' + loop: + - { src: wg0.netdev, dest: wg0.netdev } + - { src: wg0.network, dest: wg0.network } + + - name: Link resolve.conf + ansible.builtin.file: + src: '/run/systemd/resolve/stub-resolv.conf' + dest: '/etc/resolve.conf' + state: link \ No newline at end of file diff --git a/Ansible/roles/common/files/main.yaml b/Ansible/roles/common/files/main.yaml new file mode 100644 index 0000000..e69de29 diff --git a/Ansible/roles/common/tasks/main.yaml b/Ansible/roles/common/tasks/main.yaml new file mode 100644 index 0000000..e69de29 diff --git a/Ansible/roles/common/template/main.yaml b/Ansible/roles/common/template/main.yaml new file mode 100644 index 0000000..e69de29 diff --git a/Ansible/roles/common/vars/main.yaml b/Ansible/roles/common/vars/main.yaml new file mode 100644 index 0000000..e69de29 diff --git a/Systemd/25-ethernet-default.network b/Systemd/25-ethernet-default.network new file mode 100644 index 0000000..0d4015c --- /dev/null +++ b/Systemd/25-ethernet-default.network @@ -0,0 +1,20 @@ +[Match] +Name=en* +Name=eth* + +[Network] +Description=Default config for ethernet + +[Network] +#DHCP=ipv4 +DHCP=yes +MulticastDNS=yes +#DNSSEC=no +DNSSEC=allow-downgrade +IPv6AcceptRA=yes + +[IPv6AcceptRA] +UseDNS=yes + +[Network] +RouteMetric=100 \ No newline at end of file diff --git a/Systemd/25-wlan-default.nework b/Systemd/25-wlan-default.nework new file mode 100644 index 0000000..3a01207 --- /dev/null +++ b/Systemd/25-wlan-default.nework @@ -0,0 +1,19 @@ +[Match] +Name=wl* + +[Network] +Description=Default config for wlan + +[Network] +#DHCP=ipv4 +DHCP=yes +MulticastDNS=yes +#DNSSEC=no +DNSSEC=allow-downgrade +IPv6AcceptRA=yes + +[IPv6AcceptRA] +UseDNS=yes + +[Network] +RouteMetric=200 \ No newline at end of file diff --git a/Systemd/25-wwan-default.network b/Systemd/25-wwan-default.network new file mode 100644 index 0000000..75bb3fa --- /dev/null +++ b/Systemd/25-wwan-default.network @@ -0,0 +1,19 @@ +[Match] +Name=ww* + +[Network] +Description=Default config for interfaces + +[Network] +#DHCP=ipv4 +DHCP=yes +MulticastDNS=yes +#DNSSEC=no +DNSSEC=allow-downgrade +IPv6AcceptRA=yes + +[IPv6AcceptRA] +UseDNS=yes + +[Network] +RouteMetric=300 \ No newline at end of file diff --git a/Systemd/DHCPv4.network b/Systemd/DHCPv4.network new file mode 100644 index 0000000..32462eb --- /dev/null +++ b/Systemd/DHCPv4.network @@ -0,0 +1,14 @@ +[Match] + +[Link] +#Multicast=yes +[Network] +Description=An example Description +DHCP=yes +#DHCP=ipv6 +#DHCPServer=yes #DHCPv4 +#IPv6LinkLocalAddressGenerationMode=stable-privacy +MulticastDNS=yes +IPv6PrivacyExtensions=yes +IgnoreCarrierLoss=5s +IPv6AcceptRA=yes \ No newline at end of file diff --git a/Systemd/resolv.conf b/Systemd/resolv.conf new file mode 100644 index 0000000..f3f1313 --- /dev/null +++ b/Systemd/resolv.conf @@ -0,0 +1,8 @@ +[Resolve] +#DNSSEC=yes +DNSSEC=allow-downgrade +DNS=9.9.9.9#dns.quad9.net +DNSOverTLS=yes +Domains=~. +Cache=no-negative +#ReadEtcHosts=yes \ No newline at end of file diff --git a/Systemd/wg0-client.netdev b/Systemd/wg0-client.netdev new file mode 100644 index 0000000..abaaff8 --- /dev/null +++ b/Systemd/wg0-client.netdev @@ -0,0 +1,14 @@ +Name=wg0 +Kind=wireguard +Description=WireGuard-Client 10.0.0.2 + +[WireGuard] +PrivateKey= + +# Server +[WireGuardPeer] +PublicKey= +#AllowedIPs=10.0.0.0/0,::/0 +PresharedKey= +Endpoint=vpn.eichehome.dedyn.io:51820 +PersistentKeepalive=25 \ No newline at end of file diff --git a/Systemd/wg0-client.network b/Systemd/wg0-client.network new file mode 100644 index 0000000..7e90026 --- /dev/null +++ b/Systemd/wg0-client.network @@ -0,0 +1,11 @@ +[Match] +Name=wg0 + +[Network] +Address=10.0.0.2/24 + +[Route] +Gateway=10.0.0.1 +Destination=10.0.0.0/8 +GatewayOnLink=yes +#Scope=link \ No newline at end of file diff --git a/Systemd/wg0-server.netdev b/Systemd/wg0-server.netdev new file mode 100644 index 0000000..450b2a4 --- /dev/null +++ b/Systemd/wg0-server.netdev @@ -0,0 +1,13 @@ +Name=wg0 +Kind=wireguard +Description=WireGuard-Server 10.0.0.0/8 + +[WireGuard] +PrivateKey= +ListenPort=51820 + +# Client 1 +[WireGuardPeer] +PublicKey= +#AllowedIPs=10.0.0.2/24 +PresharedKey= \ No newline at end of file diff --git a/Systemd/wg0-server.network b/Systemd/wg0-server.network new file mode 100644 index 0000000..88a9708 --- /dev/null +++ b/Systemd/wg0-server.network @@ -0,0 +1,10 @@ +[Match] +Name=wg0 + +[Network] +Address=10.0.0.1/24 + +[Route] +Gateway=10.0.0.1 +Destination=10.0.0.0/24 +#Scope=link \ No newline at end of file