From 0a4fccef3c0d934cc820e2720c46297414f057f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 20 Sep 2017 22:05:39 +0200 Subject: Initial commit --- bridge/dhcpd.conf | 13 +++++++++++++ bridge/init/bridge | 22 ++++++++++++++++++++++ bridge/init/bridge-dhcp | 13 +++++++++++++ bridge/sysctl.conf | 3 +++ 4 files changed, 51 insertions(+) create mode 100644 bridge/dhcpd.conf create mode 100644 bridge/init/bridge create mode 100644 bridge/init/bridge-dhcp create mode 100644 bridge/sysctl.conf (limited to 'bridge') diff --git a/bridge/dhcpd.conf b/bridge/dhcpd.conf new file mode 100644 index 0000000..7aa8ab2 --- /dev/null +++ b/bridge/dhcpd.conf @@ -0,0 +1,13 @@ +authoritative; + +default-lease-time 600; +max-lease-time 7200; + +subnet 192.168.30.0 netmask 255.255.255.0 { + range 192.168.30.10 192.168.30.250; + option routers 192.168.30.1; + option subnet-mask 255.255.255.0; + option broadcast-address 192.168.30.255; +} + +option domain-name-servers 217.31.204.130, 193.29.206.206; diff --git a/bridge/init/bridge b/bridge/init/bridge new file mode 100644 index 0000000..9cae7e4 --- /dev/null +++ b/bridge/init/bridge @@ -0,0 +1,22 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +start() { + # Add bridge interface + if ! ip link list bridge 2>/dev/null >&2; then + ip link add name bridge type bridge + fi + # Set bridge up + ip link set bridge up + # Set ip address + if [ -z "$(ip addr show dev bridge to 192.168.30.1)" ]; then + ip addr add 192.168.30.1/24 dev vbr0 + fi +} + +stop() { + if ip link list bridge 2>/dev/null >&2; then + ip link del dev bridge + fi +} diff --git a/bridge/init/bridge-dhcp b/bridge/init/bridge-dhcp new file mode 100644 index 0000000..6bbb43f --- /dev/null +++ b/bridge/init/bridge-dhcp @@ -0,0 +1,13 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +description="Bridge dhcp daemon" +command="/usr/sbin/dhcpd" +pidfile="/run/syncthing.pid" +command_args="-4 -pf $pidfile -cf /etc/dhcp/bridge_dhcpd.conf bridge" + +depend() { + need bridge + use logger +} diff --git a/bridge/sysctl.conf b/bridge/sysctl.conf new file mode 100644 index 0000000..9ad9779 --- /dev/null +++ b/bridge/sysctl.conf @@ -0,0 +1,3 @@ +# vim: ft=sysctl +# Enable ipv4 forwarding +net.ipv4.ip_forward=1 -- cgit v1.2.3