mirror of
https://github.com/GNS3/gns3-registry.git
synced 2024-12-19 04:47:54 +00:00
A basic DHCP container.
This container provide a basic DHCP server that you can drop in your topology and configure.
This commit is contained in:
parent
e3d94f2cbb
commit
0e3e2f8392
9
docker/dhcp/Dockerfile
Normal file
9
docker/dhcp/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM alpine:3.3
|
||||
MAINTAINER developers@gns3.net
|
||||
|
||||
RUN apk add --update dnsmasq && rm -rf /var/cache/apk/*
|
||||
|
||||
VOLUME /etc/dnsmasq
|
||||
COPY boot.sh .
|
||||
|
||||
CMD /bin/sh boot.sh
|
19
docker/dhcp/README.rst
Normal file
19
docker/dhcp/README.rst
Normal file
@ -0,0 +1,19 @@
|
||||
Basic DHCP server
|
||||
-----------------
|
||||
|
||||
This container provide a basic DHCP server fro GNS3 topologies
|
||||
build on top of dnsmasq.
|
||||
|
||||
At first startup a sample config will be write in
|
||||
/etc/dnsmasq/dnsmaq.conf
|
||||
|
||||
You can customize the server by editing this file and restarting the container.
|
||||
|
||||
Build, run and publish
|
||||
=======================
|
||||
|
||||
.. code:: bash
|
||||
|
||||
docker build -t gns3/dhcp .
|
||||
docker run -i -t gns3/dhcp
|
||||
docker push gns3/dhcp
|
50
docker/dhcp/boot.sh
Normal file
50
docker/dhcp/boot.sh
Normal file
@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2016 GNS3 Technologies Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
mkdir -p /etc/dnsmasq
|
||||
|
||||
if [ ! -f /etc/dnsmasq/dnsmaq.conf ]
|
||||
then
|
||||
cat > /etc/dnsmasq/dnsmaq.conf <<EOF
|
||||
# dnsmasq will open tcp/udp port 53 and udp port 67 to world to help with
|
||||
# dynamic interfaces (assigning dynamic ips). Dnsmasq will discard world
|
||||
# requests to them, but the paranoid might like to close them and let the
|
||||
# kernel handle them:
|
||||
bind-interfaces
|
||||
|
||||
# Dynamic range of IPs to make available to LAN pc
|
||||
dhcp-range=192.168.0.50,192.168.0.240,12h
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo '
|
||||
_______ __ __ ______ _______
|
||||
/ \ / | / | / \ / \
|
||||
$$$$$$$ |$$ | $$ |/$$$$$$ |$$$$$$$ |
|
||||
$$ | $$ |$$ |__$$ |$$ | $$/ $$ |__$$ |
|
||||
$$ | $$ |$$ $$ |$$ | $$ $$/
|
||||
$$ | $$ |$$$$$$$$ |$$ | __ $$$$$$$/
|
||||
$$ |__$$ |$$ | $$ |$$ \__/ |$$ |
|
||||
$$ $$/ $$ | $$ |$$ $$/ $$ |
|
||||
$$$$$$$/ $$/ $$/ $$$$$$/ $$/
|
||||
|
||||
'
|
||||
|
||||
echo "Edit /etc/dnsmasq/dnsmaq.conf to change the configuration"
|
||||
dnsmasq --log-dhcp --no-daemon --conf-file=/etc/dnsmasq/dnsmaq.conf
|
Loading…
Reference in New Issue
Block a user