Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Linux - Setting up a DHCP Server (Video 1 of 4 for setting up Linux Router/Gateway)

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
22,447
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Oct 28, 2010

Read:

In this video, I show you how to setup a DHCP server on a linux machine. This is the start of having a computer, running linux, to be your router and gateway to the internet. This is the first video, and we just touch on getting the DHCP rolling.

Thank you, Shane.

(The written version is being revised to reflect /etc/sysctl.conf changes)

Notes:

If you use debian or anything debian based, I cannot and will not help you. Do not ask for help on those distributions. Especially ubuntu.

Prerequisits:
-A PC
-Two Network cards (One can be built in, and the other can be PCI or PCIe)
-A linux operating system

You can follow along completely if you use these distributions:
--Fedora
--CentOS

NOTE: Edit the /etc/sysctl.conf file and find the line that says net.ipv4.ip_forward. Set it to 1. This will make it work!

http://www.youtube.com/watch?v=ES53ZpVnEpQ

Commands to note:
vi -- It's an editor in linux. i for insert, o for a new line, shift+g to go to the end of the file, ESC for command mode. :wq saves your file (zz does too).
nano -- Another editor in linux, much easier to use.
pico --Alternative to nano if not available.
services name restart --name being the name of the service
yum install name ---name being the name of the package
chkconfig -- Changes runlevels of services
(Example of chkconfig: chkconfig --list dhcpd)

Files/Folders to note:
/etc/dhcpd.conf :: The DHCP configuration file
Example file: http://dpaste.org/SrDO/
/etc/sysconfig/network-scripts/ifcfg-ethx :: x = number of interface. Network card options.
Example file: http://dpaste.org/0c3h/

IP Scheme format:
10, 172, 192 are private IP's. Use them. Trust me.

Other notes:

To make sure it works, you may want to isolate your linux box from the network, hook up a cross-over cable between a laptop and your linux box and see if you can get an IP. This is the best way, in my opinion, to make sure DHCP is working properly.

FAQ:

1. I know my syntax is correct, I have no mistakes, but I cannot get DHCPD to start. It always fails!
A. You may have to start all the way over. Sometimes that's the best way. Make sure to check for colons.

2. My computers are not getting IP's set up from my box, what do I do?
A. Make sure your stock router is not issuing its own DHCP. The best way to do this, is to log into your router (usually 192.168.0.1). Admin being the username and password being the password by default. Some are admin/admin. Read your documentation for more details. You may ALSO want to give the router an IP address so you can still access it later... it needs to match the scheme you setup. Example of my scheme: 10.240.100.20 :: It's outside my 100-254 range, so it's easy for me to remember.

3. I can ping my own IP given to me from my provider, so this means I'm not secured?
A. No, just because you can ping yourself, doesn't mean you're not secured. You -are- that IP. Pinging that IP is just like pinging 127.0.0.1.

4. Will you ever make a written tutorial for this? I enjoy the visual and explanations, but a written tutorial would be nice too.
A. In the future I will. I have plans, but when I will type it all up is a decision I do not have yet. However, anyone can take what I have done in these tutorials and write it all out and make a tutorial easy off of it. If you do, make sure you leave a comment and I'll be sure to put it in this description!

5. For some reason, no one on the network can connect to the internet. What happened?
A. In the video, I forgot to explain that you need to edit /etc/sysctl.conf and change the ip forwarding to 1. You can watch here to get the idea: http://www.youtube.com/watch?v=ES53ZpVnEpQ

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (StarCraftSportsNet)

  • can i use a built in ethernet and a usb wireless adapter for this?

  • @Salamander014 It is not a good idea to use wireless in this concept. And using wireless for this concept in general would be near impossible unless you're doing pure ad-hoc. Wired networks are more secure.

  • how do we setup VPN after doing all the firewall?

  • @thebigbigdaddy Look up OpenVPN

  • with a DHCP server running in my home, will I be able to configure it so that windows, linux and mac OS machines can all store and access files on it?

  • @lgreengo525 Of course, you'd be setting up a Samba server. 

see all

All Comments (22)

Sign In or Sign Up now to post a comment!
  • NICE VIDEO CHECK DHCP 2008 R2!

  • @brother776 The shell lets you use tab for auto completion, but you have to type the first letter or so and then it will try to guess what your typing based on what is in that folder. You'll probably have to do ls /etc/ and then if there is a foo.bar file you can type vi /etc/f "tab" and it will put in /etc/foo.bar for you. Hope this answers the question! Actually I believe that Bash may let you do what your wanting but you will have to edit the config file. You may want to look into that.

  • hi there fantastic video , i'm pritty new to this linux stuff and its quite fun to learn i was wondering when you type VI for the editing of the config files is it possible to tab the roots ? i.e vi /etc/ "tab" and then it gives the user whats within ? does that make sense? ahh like on a cisco switch ?

  • Could we have openvpn on this same box?  Maybe a noob question.

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more