Bootstrap

与大多数台式机和移动广告软件说再见

Some time ago I wrote an article where I described — read it here — an easy way to get rid of advertisements on your smart TVs. Since I was recently struggling with Android apps containing pervasive adwares, I suddenly remembered this simple way to solve, in part at least, the problem: DNS change. Although, I’ve already briefly outlined what a DNS is in the above mentioned article, so I won’t repeat myself. Thus, this time I want to show you a couple of easy ways aimed to change your mobile devices’ DNS, without root permissions, in order to restrict those annoying ads which are showed in the wild in (almost) every free applications and in a lot of websites. In addiction, I will explain how to turn the matter around also in desktop and laptop devices as well, gathering these cases together with the rooted devices scenario. But, before going ahead, let me point out that by altering the DNS addresses, despite the ads put down, you could be exposed to some security and privacy related risks, as the Domain Name Server might address you to a malicious (but apparently safe) website and anyway it is also able to know which websites you browse - the latter should not surprise you because that’s just the DNS work.

前段时间,我写了一篇文章,描述并在这里阅读, 是一种在智能电视上消除广告的简单方法。 自从我最近在尝试使用包含大量广告软件的Android应用程序时,我突然想起了这种简单的方法,至少可以部分解决以下问题: DNS更改 。 虽然,我已经在上述文章中简要概述了什么是DNS,所以我不再重复。 因此,这一次,我想向您展示一些简单的方法,旨在在没有root权限的情况下更改移动设备的DNS,以限制(几乎)每个免费应用程序和很多网站。 令人上瘾的是,我将说明如何在台式机和笔记本电脑设备中也解决此问题,并将这些案例与存在设备的情况一起收集。 但是,在继续之前,让我指出,尽管放下了广告,但通过更改DNS地址,您可能会面临一些与安全性隐私相关的风险 ,因为域名服务器可能会向您发送恶意代码(但显然很安全)。 )网站,无论如何,它也能够知道您浏览了哪些网站-后者应该不会让您感到惊讶,因为那只是DNS的工作。

Basically, there are two — keep in mind that this first part is intended for non rooted phones — main methods to change the DNS values on an Android device. The first way consists of manually setting the WiFi configurations and unfortunately, as the “WiFi” term suggests, it can’t be applied on mobile data. For this purpose, the second method covers both WiFi and mobile data scenarios since it’s based on the use of a third-part application. Also, this second way is simpler than the former. Let’s proceed with order by describing these procedures.

基本上,有两种方法(请记住,第一部分适用于无根电话)是更改Android设备上DNS值的主要方法。 第一种方法包括手动设置WiFi配置 ,但不幸的是,正如“ WiFi”一词所暗示的,它不能应用于移动数据。 为此, 第二种方法涵盖了WiFi和移动数据场景,因为它基于第三方应用程序的使用。 同样,第二种方法比前一种更简单。 让我们通过描述这些过程来进行排序。

Android WiFi DNS设置 (Android WiFi DNS setting up)

WiFI
Photo by Jadon Kelly on Unsplash
Jadon KellyUnsplash拍摄的照片

When you connect to a WiFi network on an Android device, you can edit some interesting settings such as adding a proxy, setting a static IP address, et cetera. This little freedom of customization suits our aim, as we have to simply set up a static IP address in order to change the DNS values. For instance, let “MyPrettyWiFi” be your WiFi network. Thus, once you connected your device to the latter—note that you have to do this process on each WiFi network which you want to change the DNS values of — , just go in the WiFI settings and long press on “MyPrettyWiFi”. Then, just choose the Modify Network entry. At this point, check the Show advanced options box and you should have such a similar situation:

当您在Android设备上连接到WiFi网络时,您可以编辑一些有趣的设置,例如添加代理 ,设置静态IP地址等。 这种小的自定义自由符合我们的目标,因为我们必须简单地设置一个静态IP地址才能更改DNS值 。 例如,让“ MyPrettyWiFi ”成为您的WiFi网络。 因此,一旦将设备连接到后者(请注意,您必须在要更改DNS值的每个 WiFi网络上执行此过程),只需进入WiFI设置并长按“ MyPrettyWiFi ”。 然后,只需选择“ 修改网络”条目。 此时,选中显示高级选项框,您应该会遇到类似的情况:

WIFi advanced settings
WiFi advanced settings
WiFi高级设置

Now by just changing the value DHCP to Static in the IP settings option, suddenly the following options should be displayed:

现在,只需在IP设置选项中将DHCP值更改为“ 静态” ,就应该突然显示以下选项:

WiFi advanced settings
WiFi advanced settings
WiFi高级设置

Finally that’s where magic will happen. So, you have to set a static IP address for your mobile device. But before doing that, you have to search for some network settings in your router — this kind of default info changes from model to model, but you could follow this guide whether you aren’t a networks expert — , such as your router’s IP (gateway) and your subnet mask (network prefix length). Once you got these values, just put them into their corresponding entries. In my case, Gateway = 192.168.1.1 and Network prefix length = 24. At this point, you can finally choose a static IP for your mobile device. Anyway, in order to avoid any kind of addresses collision, I’d suggest to opt for the same IP address which your router assigned to your device — this info is displayed at the top of the Modify network page — or, as an alternative, you could choose (considering the subnet configuration) the fourth value of the IP address in a range [15, 30], for example. Thus, your new static IP address should look like 192.168.1.4, which is the address I opted to keep. Therefore, since the final step consists of changing the DNS values to the AdGuard’s addresses, you have to set DNS 1 = 176.103.130.130 and DNS 2 = 176.103.130.131 and just press the “Save” button. And we’re done! These should be the conclusive configurations:

最终,这就是魔术发生的地方。 因此,您必须为移动设备设置一个静态IP地址。 但在此之前,您必须在路由器中搜索一些网络设置 -这种默认信息因型号而异,但是无论您不是网络专家,都可以按照本指南进行操作,例如路由器的IP( 网关 )和您的子网掩码( 网络前缀长度 )。 获得这些值后,只需将它们放入相应的条目中即可。 在我的情况下, Gateway = 192.168.1.1 Network prefix length = 24 。 至此,您最终可以为移动设备选择一个静态IP 。 无论如何,为了避免发生任何类型的地址冲突,我建议选择与路由器分配给设备的IP地址相同的地址(此信息显示在“ 修改网络”页面的顶部),或者,例如,您可以选择(考虑子网配置 )IP地址的第四个值,范围为[15,30]。 因此,您的新静态IP地址应类似于192.168.1.4 ,这是我选择保留的地址。 因此,由于最后一步是将DNS值更改为AdGuard的地址 ,因此您必须设置DNS 1 = 176.103.130.130DNS 2 = 176.103.130.131 ,然后按“ 保存 ”按钮。 我们完成了! 这些应该是最终配置:

WiFi advanced settings
WiFi advanced settings
WiFi高级设置

Alternatively, to add the “Family protection” provided from AdGuard you could opt for DNS 1 = 176.103.130.132 and DNS 2 = 176.103.130.134.

另外,要添加AdGuard提供的“ 家庭保护 ”,您可以选择DNS 1 = 176.103.130.132DNS 2 = 176.103.130.134

移动数据DNS解决 (Mobile data DNS work around)

Phone speedtest
Photo by Mika Baumeister on Unsplash
Mika BaumeisterUnsplash拍摄的照片

Unfortunately, as we forewarned in the introduction of this article, unrooted Android devices don’t allow us to change the DNS addresses for mobile data connections. Although, to turn this annoying problem around we can rely on some third-part applications which bypass the problem by creating a Virtual Private Network (VPN) — this way, unlike the former method we’ve just seen, you don’t have to repeat any procedure for each WiFi network or mobile data connection. Indeed, despite unrooted devices prevent the DNS changing, they allow the use of VPNs. DNS Changer is one of the best free apps I’ve tried till now. It provides lots of famous DNS addresses, such as Cloudfare DNS, Open DNS, Google DNS, and it also allows you to add your custom ones. Thus, you have to simply add manually the AdGuard’s DNS addresses and that’s it, problem solved!

不幸的是,正如我们在本文引言中所警告的那样, 无根的Android设备不允许我们更改移动数据连接的DNS地址 。 虽然,为了解决这个令人讨厌的问题,我们可以依靠一些第三方应用程序 ,这些应用程序通过创建虚拟专用网(VPN)来绕过该问题–与我们之前看到的前一种方法不同,这种方法不必对每个WiFi网络或移动数据连接重复任何过程。 确实,尽管无根设备阻止DNS更改,但它们仍允许使用VPN。 DNS Changer是我迄今为止尝试过的最好的免费应用程序之一。 它提供了许多著名的DNS地址,例如Cloudfare DNSOpen DNSGoogle DNS ,并且还允许您添加自定义地址。 因此,您只需简单地手动添加AdGuard的DNS地址 ,就可以解决问题!

DNS Changer screen
DNS Changer screen
DNS更改器屏幕

Once again, set DNS 1 = 176.103.130.130 and DNS 2 = 176.103.130.131 and press on the “Start” button. Also in this case, remember that alternatively you could opt for DNS 1 = 176.103.130.132 and DNS 2 = 176.103.130.134 to add the “Family protection” provided from AdGuard.

再次设置DNS 1 = 176.103.130.130DNS 2 = 176.103.130.131 ,然后按“ 开始 ”按钮。 同样在这种情况下,请记住,您也可以选择DNS 1 = 176.103.130.132DNS 2 = 176.103.130.134 添加AdGuard提供的“ 家庭保护 ”。

Please note that since DNS Changer is a free app, it contains adwares itself. But you have to deal with ads only when you press the “Start” button, because when the VPN will be created, the DNS changes will affect all the applications, including DNS Changer.

请注意,由于DNS Changer是免费的应用程序,因此它本身包含广告软件 。 但是您只需要按“ 开始 ”按钮就可以处理广告,因为创建VPN时,DNS更改将影响所有应用程序,包括DNS Changer。

台式机和笔记本电脑的通用方法 (A general method for Desktops and Laptops)

Laptop and mobile phone
Photo by Unsplash on Unsplash
UnsplashUnsplash拍摄的照片

The most general way to change the DNS addresses on a device which hosts a Unix-like distro and MacOS consists of simply editing the /etc/resolv.conf file. Since this change is permanent, I’d suggest you to backup the file before adding the changes. Eventually, you can edit the file with a text editor and override its content with these two rows:

在装有Unix发行版MacOS的设备上更改DNS地址的最通用方法是简单地编辑/etc/resolv.conf文件。 由于此更改是永久性的,因此建议您在添加更改之前先备份文件。 最终,您可以使用文本编辑器编辑文件 ,并使用以下两行覆盖其内容

nameserver 176.103.130.130
nameserver 176.103.130.131

Now save the changes and that’s all! For rooted Android devices you could try to edit /system/etc/resolv.conf. If that won’t work, then check out some of these methods. Note that perhaps a network restart might be needed whether you were not able to connect to the Internet firstly, though.

现在保存更改,仅此而已 ! 对于植根的 Android设备,您可以尝试编辑/system/etc/resolv.conf 。 如果那行不通,请检查其中一些方法 。 请注意,尽管您首先无法连接到Internet,也许可能需要重新启动网络

Windows OS设备 (Windows OS devices)

For devices which host Windows OS, you can change the DNS values by following this procedure:

对于承载Windows操作系统的设备,您可以按照以下步骤更改DNS值

  1. Open Control Panel.

    打开控制面板

  2. Click on Network and Internet.

    单击网络和Internet

  3. Click on Network and Sharing Center.

    单击网络和共享中心

  4. Click the Change adapter settings option in the left pane.

    单击左窗格中的更改适配器设置选项。

  5. Right-click the network interface connected to the internet, and select the Properties option.

    右键单击连接到Internet的网络接口,然后选择“ 属性”选项。

  6. Select and check the Internet Protocol Version 4 (TCP/IPv4) option.

    选择并选中“ Internet协议版本4(TCP / IPv4)”选项。

  7. Click the Properties button.

    单击属性按钮。

  8. Click the Use the following DNS server addresses option.

    单击“ 使用以下DNS服务器地址”选项。

  9. Set the values:

    设置值:
Preferred DNS Server = 176.103.130.130
Alternate DNS Server = 176.103.130.131

Now you can click on the “Ok” button and then “Close”.

现在,您可以单击“ 确定 ”按钮,然后单击“ 关闭 ”。

That’s all folks!

那是所有人!

结论 (Conclusions)

Adwares are such an annoying problem, especially on mobile devices. But we’ve just seen how some easy tricks based on DNS changing could help us to get rid of them. We can end this article by pointing out that this method of modifying the DNS addresses on a device to avoid lots and lots of unwanted advertisements, it’s based on a blacklist technique. Indeed, AdGuard blacklists all the known IP addresses related to ads services. This can be locally done by making our host resolve those “malicious” IP addresses with another arbitrary address or, simpler, the loopback address (127.0.0.1). In conclusion, this trick, together with some ad hoc router configuration settings, can be used to achieve a more effective solution to block adwares on your whole LAN.

广告软件是一个令人烦恼的问题 ,尤其是在移动设备上。 但是,我们已经看到了一些基于DNS更改的 简单技巧如何帮助我们摆脱它们。 我们可以通过指出该修改设备上的DNS地址以避免大量不必要的广告的方法来结束本文,该方法基于黑名单技术 。 实际上,AdGuard 与广告服务相关的所有已知IP地址都列入了黑名单 。 这可以通过使我们的主机使用另一个任意地址或更简单的环回地址( 127.0.0.1 )解析那些“ 恶意 ” IP地址来本地完成。 总之,此技巧以及一些特殊的路由器配置设置可用于实现更有效的解决方案,以在整个LAN阻止广告软件

翻译自: https://medium.com/swlh/say-goodbye-to-most-desktop-and-mobile-adwares-5ab4414af3c0

;