前提条件:

手机和虚拟机环境在同一个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

转载于:https://www.cnblogs.com/fairyin/p/4178290.html

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐