Make wget Use IPv4 or IPv6

Today’s article is a fun one, an article where you learn how to make wget use IPv4 or IPv6. Not only is this useful, it’s easy! In fact, it’s easy enough for most anyone to figure out. Plus, this will be a fairly short article – I think. I mean, I haven’t written it yet, but it seems like a short one.

I’ve done a couple wget articles, with the most recent showing you how to make wget ignore certificate errors. In fact, in that article I showed you how to enable that permanently. I’ll have to add that to this article. That’ll come in handy for like 0.01% of you.

If you don’t know, wget is a tool for downloading content from servers. These days, we use it to grab stuff from web servers without having to go through a browser – more often than not. Sometimes we use it to scrape entire sites without actually visiting them in a browser! (Sometimes, doing that makes you a dick.) It’s a handy tool for that sort of stuff.

Once in a while, while using wget, you’ll come across a finicky download that will throw an error about wanting IPv6 (or IPv4 if you’re using IPv6). That’s when this article is going to come in handy. Sometimes, a server isn’t configured for, or will refuse connections from, one or the other. That’s when you’ll see errors and that’s what we’ll resolve in this article.

Hmm… Do I need to explain wget more? Nah, y’all know what it is. IPv4 vs IPv6? Well, how about you check out this link to learn the difference and why it matters. That’s a good link. Alright, moving on…

Make wget use IPv4 or IPv6:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open. The wget command will throw an error, letting you know if you must use one or the other.

If you need to force IPv4, it’s nice and easy:

If you need to force IPv6, it’s also nice and easy:

If you find yourself doing this often, one way or the other, you can actually tell wget to do this on a permanent basis. Like in the previous wget article you can edit your .wgetrc file (create it if it doesn’t exist) to include either --prefer-family=IPv4 or --prefer-family=IPv6 and it’ll try one before trying the other if it’s available.

Closure:

See? Nice, neat, and simple. You’ve learned how to make wget use IPv4 or IPv6 – should you find yourself needing to do so. It’s a handy trick to have up your sleeve, ’cause you will eventually find a server that requires one or the other. Given enough use, it’s gonna happen.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Make ‘wget’ Ignore Certificate Errors

In today’s article, we’ll learn how to make ‘wget’ ignore certificate errors. It’s an easy thing to do and can be pretty useful if you want to download stuff from a server with a broken or missing security certificate. It’s a simple process, one which even a new Linux user can follow – but it’s not one that comes up all that often and so it’s worth including here.

I’d like to save some time and not duplicate work, so I’d appreciate it greatly if you at least read the intro section from when I wrote how to make ‘curl’ ignore certificate errors.

That’s right, I’ve already written this article – except it was for ‘curl‘ and not for ‘wget’.  Well, this article is pretty much the same thing, except we’re talking about doing it with ‘wget’. So, read the intro to the curl article and you’ll be up to speed with regards to what a certificate is, why they’re important, and why you might want to ignore certificate errors.

That’ll save some time! Those of you who do not read the ‘curl’ article are on your own. Also, many of my readers will already know about security certificates and won’t need a tutorial or refresher course. 

By the way, we use SSL here on Linux Tips. In fact, we use HSTS Preload, which means it’s hard coded in Chromium browsers (or at least Chrome) and the site will simply refuse to load without a proper certificate. So, there’s that… I take security pretty seriously, something important when you’re using WordPress.

Make ‘wget’ Ignore Certificate Errors:

This article requires ‘wget’ which requires an open terminal. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open. If ‘wget’ isn’t installed, install it. I am pretty darned confident that it’s in your default repositories.

If you don’t know, ‘wget’ is used to download stuff from servers – while  you’re using your terminal. It’s a basic concept, but the command can be pretty complicated. After all, there are some pretty complicated site structures out there, and of course your downloading needs will vary.

So, with that said, it’s really easy to do this. You’ll just use the “--no-check-certificate” flag, like so:

But wait, there’s more! You can actually make the ‘wget’ command ignore certificate errors all the time. If this is something you find yourself needing to add this to your ‘wget’ commands often, you can make it permanent. To do that, you just need to edit your ~/.wgetrc file (create it, if it doesn’t exist) with the following:

You won’t have to reload anything, that command should take effect the very next time you use the ‘wget’ command and you should now permanently be ignoring security certificate errors. 

Doing this might actually be a horrible idea. After all, you’re ignoring security warnings. That’s a bit like ignoring a ‘Bridge Closed’ sign and hoping for the best as you gun it to the tune of “Highway To The Danger Zone”. Or, it could be just fine ’cause not everything even needs a security certificate! It’s Linux. You get to decide.

Closure:

Whelp… You have a new article. In this one, I give you what could be horrible advice. You might not want to make ‘wget’ ignore certificate errors. I mean, they are security related. On the other hand, it’s likely just fine – assuming you do some basic verification. Ah well… I ain’t scared and it’s not my computer. I’ll happily teach you how to completely break your system. I ain’t scared.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.