mirror of
https://github.com/devplayer0/docker-net-dhcp
synced 2024-11-01 03:20:21 +00:00
24 lines
471 B
Bash
Executable File
24 lines
471 B
Bash
Executable File
#!/bin/sh
|
|
BRIDGE=net-dhcp
|
|
BRIDGE_IP="10.123.0.1/24"
|
|
DHCP_RANGE="10.123.0.5,10.123.0.254"
|
|
DOMAIN=cool-dhcp
|
|
|
|
quit() {
|
|
ip link del "$BRIDGE"
|
|
exit
|
|
}
|
|
|
|
trap quit SIGINT SIGTERM
|
|
|
|
ip link add "$BRIDGE" type bridge
|
|
ip link set up dev "$BRIDGE"
|
|
ip addr add "$BRIDGE_IP" dev "$BRIDGE"
|
|
|
|
dnsmasq --no-daemon --conf-file=/dev/null \
|
|
--port=0 --interface="$BRIDGE" --bind-interfaces \
|
|
--domain="$DOMAIN" \
|
|
--dhcp-range="$DHCP_RANGE" --dhcp-leasefile=/dev/null
|
|
|
|
quit
|