Cách dùng Raspberry Pi + Pi-hole để chặn quảng cáo cho tất cả thiết bị trong nhà
Pi-hole là một công cụ biến con Raspberry Pi của bạn thành một bộ chặn quảng cáo có tác dụng trên toàn bộ mạng trong nhà. Bạn không cần phải cài adblock, bạn không cần phải chỉnh DNS trên từng thiết bị, tất cả đã có Pi-hole lo. Cái này rất hữu ích với cả những thiết bị mà bạn không thể can thiệp để chặn quảng cáo, như Smart TV chẳng hạn. Bạn có thể tưởng tượng lúc đó chiếc Raspberry Pi sẽ đóng vai trò lọc hết mọi mẩu quảng cáo trước khi chúng kịp đến với điện thoại, máy tính của bạn. Cách làm cũng cực kì dễ, và bạn có thể dùng gần như mọi chiếc Raspberry Pi từ đó đến nay để chạy Pi-hole do nó không đòi hỏi cấu hình cao.
Lợi ích của việc dùng Pi-hole
- Dễ cài đặt
- Chặn được quảng cáo trên mọi thiết bị, mọi ứng dụng (kể cả các thiết bị không cho phép cài adblock)
- Tốc độ cao, nhẹ nhàng
- Dễ dàng kiểm soát nhờ giao diện đồ họa
- Có thể chặn cả IPv4 và IPv6 của các trang quảng cáo
- Miễn phí
Nguyên tắc hoạt động của nó như sau:
Để thực hiện, bạn cần có
- Một chiếc Raspberry Pi, thẻ microSD, đã cài đặt hệ điều Raspbian Lite
- Không bắt buộc, nhưng nên có: dây mạng LAN, để nối Pi với router bằng mạng có dây thì sẽ ổn định hơn
- Bạn cũng phải làm quen với việc gõ lệnh trên Raspberry Pi, có thể làm trực tiếp trên Pi khi đã nối ra màn hình, bàn phím… hoặc dùng SSH cũng được (SSH thì tiện hơn, nhưng nếu chưa quen thì có thể hơi phức tạp.
Các bước cài Pi hole lên Raspberry Pi
Bạn truy cập vào Raspberry Pi của nhà bạn, có thể mở Pi ra, kết nối với màn hình, bàn phím, sau đó tìm ứng dụng tên là Terminal.
Chạy nó lên, gõ lệnh sau:
curl -sSL https://install.pi-hole.net | bash
Từ đây về sau thì bạn chỉ cần nhấn Enter để đồng ý mà thôi, không cần tùy chỉnh gì thêm vì những cái mà đã được chọn sẵn đều tốt cả. Sơ lược quá trình cài đặt thì câu lệnh trên sẽ làm những thứ như thế này:
- Cài đặt Pi hole
- Thiết lập IP tĩnh cho Raspberry Pi (vì phải có IP tĩnh trong mạng nội bộ thì router mới biết 1 chỗ cố định nhằm lọc link của các nhà quảng cáo)
- Cài đặt giao diện web quản lý lưu lượng và theo dõi các chỉ số
Ở bước gần cuối, bạn sẽ thấy một màn hình tóm tắt của Raspberry Pi hiển thị địa chỉ IP của máy (mục IPv4). Nhớ ghi số này lại vì bạn sẽ cần cập nhật nó lên router của nhà mình. Như trong hình bên dưới, con Pi của mình có địa chỉ là 192.168.3.109.
Khi đã cài xong, bạn cần vào router của nhà mình để chỉnh lại DNS, còn gọi là máy chủ phân giải tên miền (ví dụ, gõ tinhte.vn -> trình duyệt biết địa chỉ thực sự là 123.223.14.15). Vì Pi hole sẽ can thiệp vào giai đoạn phân giải này nên nó có thể phát hiện được tên miền của các hãng quảng cáo, lấy đại 1 ví dụ như ads.google.com, vậy là nó sẽ block cái địa chỉ này lại và mẫu quảng cáo không thể hiển thị lên máy tính, di động, iPad hay Smart TV của bạn.
Mỗi router sẽ có cách chỉnh DNS khác nhau, nhưng về cơ bản thì bạn cứ tìm chỗ nào có chữ DNS hoặc chữ DHCP và DNS thì chỉnh ở đó, chuyển sang Set DNS Manually. Như hình minh họa bên dưới là mình chỉ trên con router nhà mình. Sau khi chỉnh xong thì lưu lại và khởi động lại router để nó bắt đầu có hiệu lực.
Sau khi đã cài đặt DNS cho router và khởi động lại, kể từ lần truy cập sau đó bạn sẽ thấy các mẫu quảng cáo không thể hiện thị được, một số trang sẽ bị trống vài chỗ, đó thực chất là chỗ quảng cáo nhưng banner, link và các thông tin đã bị Pi hole chặn rồi.
Pi hole có một trang điều khiển, quản lý, theo dõi thông số về việc truy cập và chặn quảng cáo, bạn có thể truy cập vào nó bằng link http://<địa chỉ IP của Raspberry Pi>/admin/index.php. Phần này thì mấy bạn tự mò nhé, cũng không có gì phức tạp và cần giới thiệu.
Một số lưu ý
Nếu ở lần đầu tiên cài đặt Pi-hole qua SSH (cài trực tiếp trên Pi không qua SSH thì sẽ không bị) mà bạn thấy Pi bị đứng, không thể SSH, không thể làm gì, thì khả năng cao là bạn chỉ bị mất lệnh SSH thôi chứ chặn quảng cáo thì vẫn chạy.
Trong trường hợp này, bạn làm như sau:
- Chờ khoảng 10p
- Nếu vẫn còn đơ, hãy rút điện, bật lại Pi
- Chạy lại dòng lệnh ở trên thêm 1 lần nữa, lần này bạn sẽ thành công
Lưu ý từ việc chặn quảng cáo
Một số trang hoạt động không thu phí, do đó họ cần nguồn thu từ các đơn vị quảng cáo như Google, Facebook, các hệ thống quảng cáo trong nước… để có kinh phí hoạt động. Trước khi chặn quảng cáo, hãy nghĩ về điều đó nhé. Hiện tại doanh thu từ các quảng cáo kiểu banner này không phải là phần quan trọng của Tinh tế, nhưng nhiều web khác thì có, nên bạn hãy chịu khó xem ads một chút để có động lực cho họ tạo nội dung cho bạn xem.







I blog frequently and I really appreciate your content. Your article has truly peaked my interest. I’m going to take a note of your site and keep checking for new information about once a week. I opted in for your Feed as well.
This site certainly has all of the information I wanted concerning this subject and didn’t know who to ask.
Everything is very open with a really clear clarification of the challenges. It was truly informative. Your website is very helpful. Many thanks for sharing!
Howdy, There’s no doubt that your web site could be having web browser compatibility issues. When I take a look at your blog in Safari, it looks fine however, when opening in I.E., it has some overlapping issues. I simply wanted to give you a quick heads up! Besides that, fantastic website!
It’s hard to come by experienced people in this particular subject, but you sound like you know what you’re talking about! Thanks
After looking into a few of the blog posts on your blog, I honestly appreciate your technique of writing a blog. I book marked it to my bookmark site list and will be checking back in the near future. Please visit my web site too and let me know your opinion.
Hey this is kinda of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding skills so I wanted to get advice from someone with experience. Any help would be greatly appreciated!
I’m very happy to discover this web site. I need to to thank you for your time just for this wonderful read!! I definitely savored every little bit of it and i also have you bookmarked to see new stuff in your website.
Thanks for your publication. One other thing is that often individual American states have their own laws that will affect home owners, which makes it quite difficult for the our elected representatives to come up with a brand new set of guidelines concerning property foreclosure on people. The problem is that each state has got own laws and regulations which may have impact in an adverse manner in regards to foreclosure insurance policies.
Youre so cool! I dont suppose Ive learn anything like this before. So good to seek out any individual with some original ideas on this subject. realy thanks for starting this up. this website is something that is wanted on the net, somebody with somewhat originality. useful job for bringing something new to the internet!
Right here is the perfect site for anybody who really wants to find out about this topic. You know so much its almost hard to argue with you (not that I really would want to…HaHa). You certainly put a new spin on a subject that has been written about for a long time. Wonderful stuff, just excellent.
http://www.factorytinsigns.com is 100 Trusted Global Metal Vintage Tin Signs Online Shop. We have been selling art and décor online worldwide since 2008. Started in Sydney, Australia. 2000+ Tin Beer Signs, Outdoor Metal Wall Art, Business Tin Signs, Vintage Metal Signs to choose from. 100 Premium Quality Artwork. Up-to 40 OFF Sale Store-wide. Fast Shipping USA, Canada, UK, Australia, New Zealand, Europe.
I blog frequently and I really thank you for your content. This article has truly peaked my interest. I’m going to take a note of your blog and keep checking for new information about once a week. I subscribed to your Feed as well.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
You need to be a part of a contest for one of the highest quality sites on the internet. I most certainly will recommend this blog!
Thanks for these guidelines. One thing I additionally believe is the fact credit cards supplying a 0 apr often lure consumers with zero interest, instant endorsement and easy on the web balance transfers, but beware of the top factor that can void that 0 easy streets annual percentage rate and also throw you out into the terrible house rapidly.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You definitely know what youre talking about, why waste your intelligence on just posting videos to your weblog when you could be giving us something enlightening to read?
I wanted to thank you for this wonderful read!! I definitely enjoyed every bit of it. I have got you saved as a favorite to check out new stuff you post…
One other issue is that if you are in a scenario where you would not have a cosigner then you may genuinely wish to try to exhaust all of your money for college options. You’ll find many funds and other grants that will supply you with funds to help with classes expenses. Thanks for the post.
http://www.factorytapestry.com is a Trusted Online Wall Hanging Tapestry Store. We are selling online art and decor since 2008, our digital business journey started in Australia. We sell 100 made-to-order quality printed soft fabric tapestry which are just too perfect for decor and gifting. We offer Up-to 50 percent OFF Storewide Sale across all the Wall Hanging Tapestries. We provide Fast Shipping USA, CAN, UK, EUR, AUS, NZ, ASIA and Worldwide Delivery across 100+ countries.
There’s definately a lot to find out about this issue. I really like all of the points you’ve made.
Whoa! This blog looks just like my old one! It’s on a totally different topic but it has pretty much the same page layout and design. Wonderful choice of colors!
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me. Binance推荐码
I blog often and I truly appreciate your content. The article has really peaked my interest. I’m going to take a note of your site and keep checking for new information about once a week. I opted in for your Feed as well.
Helpful info. Fortunate me I found your site accidentally, and I am shocked why this accident didn’t took place earlier! I bookmarked it.
I really like reading through a post that can make people think. Also, thank you for allowing me to comment.
Thank you for the auspicious writeup. It in reality was a leisure account it. Glance advanced to far added agreeable from you! By the way, how could we keep in touch?
https://fabble.cc/marta
Quad bike Dubai experiences look fun, thrilling, and memorable. The desert setting makes the activity feel more special than riding anywhere else. I would love to try it with friends someday.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://www.binance.com/ur/register?ref=SZSSS70P
Hi, I do think this is a great site. I stumbledupon it 😉 I am going to return yet again since i have book-marked it. Money and freedom is the best way to change, may you be rich and continue to guide other people.
Good write-up, I?m normal visitor of one?s blog, maintain up the excellent operate, and It is going to be a regular visitor for a lengthy time.
Spot on with this write-up, I truly believe this web site needs a lot more attention. I’ll probably be returning to read more, thanks for the information.
Good post. I learn something new and challenging on websites I stumbleupon every day. It’s always interesting to read articles from other authors and practice a little something from other web sites.
Great info. Lucky me I came across your site by chance (stumbleupon). I have saved as a favorite for later!
Oh my goodness! Incredible article dude! Thank you so much, However I am having issues with your RSS. I don’t know the reason why I cannot subscribe to it. Is there anyone else getting identical RSS issues? Anybody who knows the answer will you kindly respond? Thanx.
I’m amazed, I have to admit. Rarely do I come across a blog that’s both equally educative and entertaining, and without a doubt, you’ve hit the nail on the head. The issue is something not enough people are speaking intelligently about. I’m very happy I found this during my search for something concerning this.
Very good information. Lucky me I found your blog by chance (stumbleupon). I’ve saved it for later.
bookmarked!!, I really like your website!
Right here is the right website for anybody who hopes to understand this topic. You understand a whole lot its almost hard to argue with you (not that I really will need to…HaHa). You definitely put a fresh spin on a topic which has been written about for many years. Excellent stuff, just excellent.
https://www.equinenow.com/farm/lost1587.htm
Saved as a favorite, I really like your website.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me. https://www.binance.bh/futures/ref?code=MBLCVVZG
Way cool! Some very valid points! I appreciate you writing this write-up plus the rest of the site is really good.
Everyone loves it when folks get together and share thoughts. Great site, keep it up.
Howdy! I could have sworn I’ve been to this blog before but after checking through some of the post I realized it’s new to me. Nonetheless, I’m definitely glad I found it and I’ll be bookmarking and checking back often!
Thank you for another informative site. Where else could I get that type of information written in such a perfect way? I’ve a project that I’m just now working on, and I have been on the look out for such information.
I believe one of your commercials caused my internet browser to resize, you may well want to put that on your blacklist.
You’re so cool! I do not believe I’ve truly read a single thing like that before. So great to find another person with genuine thoughts on this subject. Seriously.. thank you for starting this up. This web site is one thing that is needed on the internet, someone with a bit of originality.
I’m not that much of a internet reader to be honest but your blogs really nice, keep it up! I’ll go ahead and bookmark your website to come back later on. Cheers