aboutsummaryrefslogtreecommitdiff
path: root/local
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2017-12-04 07:22:23 +0100
committerKarel Kočí <karel.koci@nic.cz>2017-12-04 07:22:23 +0100
commita12db5d06ead397c3a4232e1bbac68748f02704b (patch)
tree3b5964951a5d2804eda12daf6670a2514c291590 /local
parent6cc31a2b88476fe42b7bca369d0b782bf9b0c7cc (diff)
downloadmyconfigs-a12db5d06ead397c3a4232e1bbac68748f02704b.tar.gz
myconfigs-a12db5d06ead397c3a4232e1bbac68748f02704b.tar.bz2
myconfigs-a12db5d06ead397c3a4232e1bbac68748f02704b.zip
Drop lxc-net script as it was replaced by bridge service
Diffstat (limited to 'local')
-rwxr-xr-xlocal/bin/lxc-net41
1 files changed, 0 insertions, 41 deletions
diff --git a/local/bin/lxc-net b/local/bin/lxc-net
deleted file mode 100755
index 53ccb50..0000000
--- a/local/bin/lxc-net
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-
-if [ "$(id -u)" -ne 0 ]; then
- echo "Root required for execution" >&2
- exit 1
-fi
-
-# What if we want to clean
-if [ "$1" = "clean" ]; then
- kill $(cat /tmp/lxc-dhcpd.pid)
- rm -f /tmp/lxc-dhcpd.pid /tmp/lxc-dhcpd.conf
- ip link del dev vbr0
- exit
-fi
-
-# Setup bridge
-ip link add name vbr0 type bridge
-ip link set vbr0 up
-ip addr add 192.168.30.1/24 dev vbr0
-
-# Start dhcp server
-
-# This just takes first dns nameserver configured. Maybe we might want to be
-# little bit more clever.
-DNS_SERVER=$(cat /etc/resolv.conf |grep -i nameserver|head -n1|cut -d ' ' -f2)
-echo "# DHCPD configuration generated by lxc-net script
-authoritative;
-default-lease-time 600;
-max-lease-time 7200;
-option subnet-mask 255.255.255.0;
-option broadcast-address 192.168.30.255;
-option routers 192.168.30.1;
-option domain-name-servers $DNS_SERVER;
-subnet 192.168.30.0 netmask 255.255.255.0 {
- range 192.168.30.10 192.168.30.100;
-}" > /tmp/lxc-dhcpd.conf
-dhcpd -4 -pf /tmp/lxc-dhcpd.pid -cf /tmp/lxc-dhcpd.conf vbr0
-
-# Setup network forwarding (TODO add -o ethX to iptable command)
-sysctl -w net.ipv4.ip_forward=1
-iptables -t nat -A POSTROUTING -j MASQUERADE