Created
September 9, 2019 17:18
-
-
Save vladionescu/6716672d2835595f1eb1aa65932ba31a to your computer and use it in GitHub Desktop.
Wrapper around dnsmasq to run a local DHCP server, easier to use than reading through all of dnsmasq's arguments.
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
#!/usr/bin/env python3 | |
import argparse, subprocess | |
parser = argparse.ArgumentParser(description='Run a local DHCP server.') | |
parser.add_argument('--interface', '-i', default='en8', help='Listen on interface [default en8]') | |
parser.add_argument('--bind-ip', '-b', default='192.168.0.2', help='Listen on this IP address (local address for interface) [default 912.168.0.2]') | |
parser.add_argument('--range', '-r', default='192.168.0.10,192.168.0.50', help='DHCP range for issued client addresses, comma separated [default 192.168.0.10,192.168.0.50]') | |
args = parser.parse_args() | |
subprocess.check_output(['dnsmasq', '-i', args.interface, '-a', args.bind_ip, '-d', '-F', args.range], shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment