Created
February 1, 2022 11:28
-
-
Save tomty89/8604e6c4755c4db67d49cd4a3208b2fa to your computer and use it in GitHub Desktop.
dhcp0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
port=0 | |
dhcp-range=192.168.150.2,192.168.150.252 | |
dhcp-option=option:router,192.168.150.1 | |
dhcp-option=option:dns-server,192.168.150.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=dnsmasq - A lightweight DHCP and caching DNS server | |
Documentation=man:dnsmasq(8) | |
BindsTo=netns-dhcp0.service | |
After=network.target netns-dhcp0.service | |
Before=network-online.target nss-lookup.target | |
Wants=nss-lookup.target | |
[Service] | |
NetworkNamespacePath=/run/netns/dhcp0 | |
ExecStartPre=/usr/bin/ip addr add 192.168.150.254/24 dev dhcp0 | |
ExecStartPre=/usr/bin/ip link set dhcp0 up | |
ExecStartPre=/usr/bin/dnsmasq --test | |
ExecStart=/usr/bin/dnsmasq -k --user=dnsmasq --pid-file -C /etc/dnsmasq/dhcp0.conf | |
ExecReload=/bin/kill -HUP $MAINPID | |
Restart=on-failure | |
PrivateDevices=true | |
ProtectSystem=full | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=netns for dhcp0 | |
Requisite=systemd-networkd.service | |
After=systemd-networkd.service | |
PartOf=dnsmasq-dhcp0.service | |
[Service] | |
Type=oneshot | |
RemainAfterExit=yes | |
ExecStartPre=/usr/bin/ip netns add dhcp0 | |
ExecStart=/usr/bin/ip link set dhcp0 netns dhcp0 | |
ExecStop=/usr/bin/ip -n dhcp0 link set dhcp0 netns 1 | |
ExecStopPost=/usr/bin/ip netns delete dhcp0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment