lightster / dnsmasq-mgmt
Tool for managing `address` entries in dnsmasq
Requires
- php: >=5.4
- lightster/lstr-silex: ~0.2.1
- psr/log: ~1.0
- silex/silex: ~1.1
- symfony/console: ~2.4
- symfony/process: ~2.5
README
Tool for pointing wildcarded domains to your local development machine
Dnsmasq provides network infrastructure for small networks. dnsmasq-mgmt
is a tool that installs Dnsmasq and eases the configuration to locally point domains to IP addresses of your choosing.
dnsmasq-mgmt was built to avoid manually updating Dnsmasq or /etc/hosts configuration files.
Currently dnsmasq-mgmt is only supported on macOS.
Installation
Use composer to install dnsmasq-mgmt via:
composer global require "lightster/dnsmasq-mgmt=~0.0.9"
Then allow dnsmasq-mgmt to restart Dnsmasq and clear the operating system's DNS cache without requesting the sudo password each time:
sudo ~/.composer/vendor/bin/dnsmasq-mgmt sudoers:install
The last step in installation is to actually install Dnsmasq and setup directories utilized by Dnsmasq:
~/.composer/vendor/bin/dnsmasq-mgmt dnsmasq:install
Configuring domains
Adding a domain
To have b.com
point and subdomains of b.com
point to localhost, run:
~/.composer/vendor/bin/dnsmasq-mgmt address:add b.com 127.0.0.1
Removing a domain
To remove b.com
, run:
~/.composer/vendor/bin/dnsmasq-mgmt address:add b.com 127.0.0.1
Advanced usage
Make dnsmasq-mgmt readily available
Rather than needing to call dnsmasq-mgmt
with a path of ~/.composer/vendor/bin/dnsmasq-mgmt
every time, add ~/.composer/vendor/bin/
to the PATH environment variable in your ~/.bash_profile
configuration:
PATH="$PATH:${HOME}/.composer/vendor/bin"
Other commands
dnsmasq-mgmt offers a few other commands. You can get a full list of commands by running the list
subcommand:
dnsmasq-mgmt list
Install shell completion
If you are using bash or zsh, you can install shell completion for dnsmasq-mgmt.
For Bash, add the following to your ~/.bashrc
(or ~/.bash_profile
):
source ~/.composer/vendor/lightster/dnsmasq-mgmt/bin/dnsmasq-mgmt-completion.bash
For zsh, add the following to your ~/.zshrc
:
source ~/.composer/vendor/lightster/dnsmasq-mgmt/bin/dnsmasq-mgmt-completion.zsh