 This is going to be a very quick tutorial on setting up a Wi-Fi hotspot. Again, as I mentioned in a previous video, a lot of network managers on Linux already have this option available. It's just a few clicks. This is the manual way of doing it. If you don't want to learn how to do the manual way of doing it, just check out your network manager and see if it has an option to create a Wi-Fi network or Wi-Fi hotspot. I'm not sure how they word it. And I'm going to show you a quick script that I created. So if you're using something that you don't have a network manager or you just have something like a Raspberry Pi that you're using as a host and you want to set it up as a router. And this is also just going to be a quick look over that. You also have to have a Wi-Fi card that has these capabilities. I'll try to put a link in the description to one. It will be a USB dongle is the one I'm using. It's under $10 and it works out of the box on a Raspberry Pi. Other systems you might have to install drivers. I shouldn't say it works out of the box with a Raspbian. I'm not sure about other distributions, although I think it worked on my XMBC Raspberry Pi, which I think is based on Raspbian anyway. Anyway, let's get into it. First, let's have a quick look right here is the URL to a code I created. A little script I created to kind of automate this for myself. I didn't really design it for everyone to use. I created it for myself and I'm sharing it with you. I should have used some variables where I didn't, like sending a network interface. But let's go ahead and have a quick look at that. This is what the code looks like. As you can see, it's a bash script. What it does, again, this is based on a Debian-based system. If you're running Ubuntu, you're going to have to install Attitude or use app changes to apt-get. What you want to install are host APD and this UDHCPD. This one is what sets up your Wi-Fi hotspot, and this allows your computer to issue out IP addresses. The dash Y here just says, you know, continue yes with any other dependencies, you know, and answer any questions, yes. Again, you'll want to run this script as either sudo or root. Next, it will be taking this config file and replacing the contents of it with this. As you can see, I tried to comment some of these. This is basically setting up the range that your computer is going to be issuing IP addresses to anyone who connects to it. I just set it up to issue IP addresses from 2 to 20 on this range. I started at 2 because our computer is going to be 1. Now also here, I'm going to be setting up an open Wi-Fi. There are other options you can do to, you know, set up a WPA encryption. I'm not going over that in this tutorial. It's saying what interface to use. It's one of the few places where it says WLAN 0. You're going to want to make sure that your wireless card is set to WLAN 0. And if you have two Wi-Fi cards, because you're going to need two network interfaces, one for people to connect to and one to connect to the internet to, here on my desktop, I'm using my ETHO port wired connection to get to the internet and the USB dongle, which is WLAN 0 on my computer. So you'll have to adjust those things accordingly. Here we're setting up, if we're going to issue DNS IP addresses, obviously users can set their own, but I'm just using the Google ones here. The subnet, we're saying, oh, which one's the router, which is our computer here, which as I said, we're going to set to .1 at the end there and then release time for the DHCP. So it puts all that into this config file. So all that goes into this file. And next we're going to replace the contents of this file with this option. And I didn't comment what that does, and I really don't remember. I apologize about that. It does have something to do with DHCP. If you were to install these packages and not run my script, you could look in there and it will give you some basic options that are commented out, and this is one of them. Basically, it's on commenting it. Next, we're going to be setting the IP address for our WLAN, our wireless network. As I said, we're going to be setting it to .1. Next, we're going to be setting up the config file for our Wi-Fi hotspot for the host APD config file. Again, I'm saying WLAN 0. Hopefully your Wi-Fi card is WLAN 0, if not. You can change the script. Or there's actually a file. Let's see, I have it written down here somewhere. Here we go. Let's scroll down here. This file, etcudev rules.d, 70 persistent net rules. If you were to go in there, you can see here what network cards are issued, what you can go in there and change it to match what you want. Either or. Change my script or change that depending on your setup, but I just thought I'd throw that little tip in there in case you wanted to know how to rename your wireless card. We're going to be editing the host ADP APD config file, saying to use WLAN 0. Here is our SSID, the name of our wireless network. This is what people will see when they're searching for wireless network. Give that a name. I'm going to say G mode, depending on what capabilities your network card has. I'm going to set it to channel 6, just picking one within the range. Then a few other options here, which I don't remember what they do when I didn't comment them, but one is set to a 0. Obviously, it has something to do with authentication, I guess. WMM enabled. Set to 0. Sorry, I can't give you more information on that. I created this script like a year ago and I should have commented on that because I don't remember what it does. Usually I just run this script and go. Next, we're going to replace this again. I wrote this for myself. You may not want to run this script until you look through it. As always, anytime you're running a script from the internet, whether it's for me or anybody else, always look over it first, see what it does. This isn't a very long script. It's going to be replacing your interfaces file. Again, depending on your network, backup stuff first. You want to save that file in case you want to revert back. My script does not do that for you. It's going to set up a loop back. That's normal. These first few lines are normal for a computer. Then we're going to say, oh, we'll land 0. Basically we're saying, this is the default. When the computer is starting up, what network interfaces are going to be set up to do what? We're saying, yes, there's going to be a loop back interface. Connect on your wired network using DHCP, which is what I'm doing. Then here we're saying with the will land network, we're not using DHCP, which means we're not grabbing IP addresses from some other source. We're setting our own static ones. Because we want this Wi-Fi card to always be set up to be within this range or whatever range you set up. This is going to be the default. We set it up here to that number. This is saying, on a reboot, reset it to that. Don't let it change. Then that submask. Next, we're going to say, on startup, restore our IP table settings and bring IP tables up based on this file here, which we're actually going to create in a moment. It doesn't matter that we set this config file first, because this is what happens on boot. This won't take effect until you reboot, or I guess you could restart services. Next, we're replacing this default config file to have just this single line, which is saying, hey, when you start host APD, what config file are we going to use? We're going to use this config file, which is what we created up here. Again, I'm going through this fast, but this script should be, there should be a link to it in the description of this video, so you can look through it. I'm just explaining everything to you. Next, we're going to be echoing one into this file here. That's how you enable IP forwarding. You want to have forwarding enabled. Here's another thing to help move that along. Now we're actually setting up our IP tables. We've got a few commands here. Basically, what these three lines are saying to keep it simple is we're going to be forwarding stuff from ETHO to WLAN0 and also going back the other way. So when someone connects to your WLAN, your wireless network, and they request something, a web page, it's going to go into your computer through the Wi-Fi card and out through the ETHO and through your wired connection, then coming back through your wired connection, going back out to your wireless connection. It just allows that pass-through connection from one network card to the other. Next, we're going to take what's currently set as your IP tables setup, which is these three lines here we just created, and we're going to take that setup and save it to this file. And if you remember correctly, we set it so when your computer restarts, it's going to load that file. Again, it doesn't matter that we're doing this down here and this up here because this isn't going to run until the computer restarts or you restart your network settings. Next, we're going to be starting our services. We're all done. We're going to be starting our services, both of those and keeping the updates enabled. Okay, so that's it. That's a walk-through of the script. A quick look at it. Again, here is the address of that. Again, this should be a link in the description. You can also search me on GitHub, MetalX1000. You should be able to find this script in there under my project called My Bin, which is just a bunch of scripts to do different things. That is not just one big project with one goal, but any smaller projects that have kind of go in there. And this command here will send out that command. We'll display it on the screen. If we want, again, as root here, we're going to say pipe it into Bash. Now, again, only do this if you're ready to run this script and you've looked it over and made sure that it's set up properly for your system and you've backed up anything you wanted to back up. But once you do that, basically it's going to take it and pipe it into it. You can download it. You can download it and run it, but you can run it without saving it to your hard drive. You're just going to pipe it into Bash. You might get this error that cannot write to log. That's because we're piping it, I believe. And you can see that everything started up okay. And if I break out my phone and I do a scan, I will see a wireless network that we just created. And if I connect to it, it will give me an IP address between 192.168.42.2 and 192.168.42.20 just because that's what we set up in the config file. So that's it. I know this is real quick, but it was just a lot of config files and I just wanted to explain it all to you. You can look at this code again. It's not the best script in the world. It's what I created for my own personal use. It's up on GitHub, so you can fork it and modify it and possibly make it better. Definitely one thing you can do is set the network cards to variables so if someone has a different network card set up than you, they can easily change that. But look it over and good luck. And as always, please visit filmsbychrist.com. That's Chris the K. There should be a link in the description. I just was trying to make this a short story. Also, this was a look at the script. I also go through all this in basically a walkthrough video, which I'll try to annotate to in this video, which basically just kind of is me talking about the same thing just without showing you the script. So I just kind of did two videos because I did that one and wasn't that happy with it, so I thought I'd do another one and I'm not that happy with this one. But maybe with the two together, I have come up with something halfway decent. So enjoy. I hope this helped put you in the right direction. Thank you and have a great day.