前提条件:
手机和虚拟机环境在同一个wifi网络下。
安装
sudo apt-get update
sudo apt-get install dnsmasq
将最后一行注释去掉
sudo vi /etc/dnsmasq.conf
497 # Include a another lot of configuration options.
498 #conf-file=/etc/dnsmasq.more.conf
499 conf-dir=/etc/dnsmasq.d
cd /etc/dnsmasq.d/
vi dns
1 address=/fairyin.pw/192.168.0.101
2 address=/www.fairyin.pw/192.168.0.101
3 address=/i.fairyin.pw/192.168.0.101
4 address=/s.fairyin.pw/192.168.0.101
5 address=/shop.fairyin.pw/192.168.0.101
6 address=/app.fairyin.pw/192.168.0.101
重启
sudo /etc/init.d/dnsmasq restart