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

Linux - Setting up iptables firewall rules (Video 2 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.
16,409
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 iptables/firewall/NAT on your DHCP server. This is the second video of having a linux box running as a DHCP server, gateway, and router of any given network. We touch on iptables and how to set it up with various commands.

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:
-You followed the first video
-DHCP is running correctly (make sure you have tested this)

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

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
iptables -t (table) -A --The command to create iptables rules. (table) being nat or filter.

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

Files/Folders to note:
/etc/sysconfig/iptables -- The file where iptables information is stored.
Example: http://dpaste.com/hold/604959/

Useful link: http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch14_:_Linux_...

FAQ:

1. Can I forward more than one port to any IP's through iptables?
A. Yes you can, just make sure you use PREROUTING and FORWARD rules respectively.

2. Can I forward the same port to more than one IP address in iptables?
A. No, you cannot. However, if you're playing StarCraft with two people on a LAN and playing online and want both computers to be able to host, open up 6113 for their IP address. And then it's up to you to use chaoslauncher and change the port number on their computer to 6113 for starcraft. In regedit, you can add a DWORD value to "HKEY_CURRENT_USER\Software\Battle.net\Configuration" and "HKEY_LOCAL_MACHINE\SOFTWARE\Battle.net\Configuration" called "Game Data Port", and put in 6113 using decimal. That should do it too. There is a small chance this will even work in the first place.
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, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (StarCraftSportsNet)

  • i 've done all you said,,, now what the fuck i m suppoused to do with that server ?

  • @danielcubillosk If you follow videos 1-4, you basically setup a Linux server that acts as a Gateway and Firewall for your network. It's kind of like your Linksys router, just without the wireless capabilities and actual 'routing' that a store-bought router possesses. However, that doesn't stop you from making actual routing rules.

see all

All Comments (6)

Sign In or Sign Up now to post a comment!
  • @11:05

    I SEE YOU PEE!

    =D

  • nice good cbt ..

  • dear thanks this video

    Where is (Video 3 of 4 & 4 of 4 for setting up Linux Router/Gateway) tutorial ??

    copibar

  • Hi there,

    Wow amazing... very nice tutorial... good for novice like me...

    Can I request also a tutorial in REDIRECTION for squid transparent proxy server. I already have the squid 3.0 proxy server set up. But I'm having trouble setting the redirection to make it transparent so I don't have to configure the browsers of my client. Please help me.

    Thanks in advance.

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