Situee's BLOG. This a blog about iphone / mobile development, programming and other information technology. Welcome!
Wednesday, January 22, 2014
Setup DNSmasq MAC DNS server
$ brew install dnsmasq
$ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
$ sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
Go to System Network preference,
Set the only one DNS as 127.0.0.1
/usr/local/etc/dnsmasq.conf
#upstream dns servers
resolv-file=/etc/resolv.dnsmasq.conf
#for the host domain to the ip, like the "hosts" file
address=/dev/127.0.0.1
address=/double-click.net/127.0.0.1
# set listen address as your IP
listen-address=127.0.0.1, 192.168.11.12
/etc/resolv.dnsmasq.conf
Put upstream server in /etc/resolv.dnsmasq.conf , such as 8.8.8.8
nameserver upstream_dns_server
nameserver 8.8.8.8
Kill the process, it will restart and reload new config.
$ sudo kill $(ps aux | grep '[d]nsmasq' | awk '{print $2}')
Reference:
Install DNSmasq locally on Mac OS X via Homebrew
http://blog.philippklaus.de/2012/02/install-dnsmasq-locally-on-mac-os-x-via-homebrew/
Setup a wildcard TLD using Dnsmasq on OS X
http://bhamrick.com/2013/04/18/setup-a-wildcard-tld-using-dnsmasq-on-os-x/
https://gist.github.com/g3d/2709563
http://unixhelp.ed.ac.uk/CGI/man-cgi?ps
Appendix:
ps aux : to see every process on the system using bSD syntax;
$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
timothy 29217 0.0 0.0 11916 4560 pts/21 S+ 08:15 0:00 pine
root 29505 0.0 0.0 38196 2728 ? Ss Mar07 0:00 sshd: can [priv]
can 29529 0.0 0.0 38332 1904 ? S Mar07 0:00 sshd: can@notty
USER = user owning the process
PID = process ID of the process
%CPU = It is the CPU time used divided by the time the process has been running.
%MEM = ratio of the process’s resident set size to the physical memory on the machine
VSZ = virtual memory usage of entire process
RSS = resident set size, the non-swapped physical memory that a task has used
TTY = controlling tty (terminal)
STAT = multi-character process state
START = starting time or date of the process
TIME = cumulative CPU time
COMMAND = command with all its arguments
ps -aux VS ps aux
Note that "ps -aux" is distinct from "ps aux". The POSIX and UNIX standards require that "ps -aux" print all processes owned by a user named "x", as well as printing all processes that would be selected by the -a option. If the user named "x" does not exist, this ps may interpret the command as "ps aux" instead and print a warning. This behavior is intended to aid in transitioning old scripts and habits. It is fragile, subject to change, and thus should not be relied upon.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment