LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-17-2014, 08:46 PM   #1
GrimmDebian
LQ Newbie
 
Registered: Dec 2014
Posts: 7

Rep: Reputation: Disabled
Installed Debian 7.7, Need help with firewalls


Hi,

Need help figuring out how to design my own firewall and configuring it.

Thanks.
 
Old 12-17-2014, 09:13 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,323
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
I would suggest you install gufw; it's a GUI frontend for iptables (which is part of the Linux kernel) you can use to configure your firewall. It's in the Debian repos.

Edit:

I saw your intro post. You can configure iptables directly. See

Code:
man iptables
or search the web for "configuring iptables."

Last edited by frankbell; 12-17-2014 at 10:01 PM. Reason: More info
 
Old 12-17-2014, 09:52 PM   #3
GrimmDebian
LQ Newbie
 
Registered: Dec 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
[QUOTE=frankbell;5286695]I would suggest you install gufw; it's a GUI frontend

I want to do it without the GUI.
thanks
 
Old 12-17-2014, 10:01 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,323
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
See that edit to my previous post.
 
Old 12-17-2014, 10:02 PM   #5
GrimmDebian
LQ Newbie
 
Registered: Dec 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by frankbell View Post
See that edit to my previous post.


Thanks a lot i will try it and get back here. Cheers
 
Old 12-17-2014, 10:58 PM   #6
GrimmDebian
LQ Newbie
 
Registered: Dec 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by frankbell View Post
See that edit to my previous post.

Hey i tried the iptables. Got a few lines up and saved and used restore. Now i am using VirtualBox so i dont know how to check if my commands in the iptables.up.rules is working or not.


my commands were

*filter

# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT

# Accepts all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# Allows all outbound traffic
# You could modify this to only allow certain traffic
-A OUTPUT -j ACCEPT

# Allows HTTP and HTTPS connections from anywhere (the normal ports for websites)
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT

# Allows SSH connections
# The --dport number is the same as in /etc/ssh/sshd_config
-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT

# Now you should read up on iptables rules and consider whether ssh access
# for everyone is really desired. Most likely you will only allow access from certain IPs.

# Allow ping
-A INPUT -p icmp -j ACCEPT

# log iptables denied calls (access via 'dmesg' command)
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7

# Reject all other inbound - default deny unless explicitly allowed policy:
-A INPUT -j REJECT
-A FORWARD -j REJECT

COMMIT
 
Old 12-18-2014, 02:02 AM   #7
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
If you want to do it manually, the ArchWiki has a great guide to setting up a simple stateful firewall that should work with any distro using iptables:
https://wiki.archlinux.org/index.php...teful_firewall

Otherwise there is FireHOL, an excellent setup utility which abstracts the process using human-readable config files:
http://firehol.org/
 
Old 12-18-2014, 02:05 AM   #8
GrimmDebian
LQ Newbie
 
Registered: Dec 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Head_on_a_Stick View Post
If you want to do it manually, the ArchWiki has a great guide to setting up a simple stateful firewall that should work with any distro using iptables:
https://wiki.archlinux.org/index.php...teful_firewall

Otherwise there is FireHOL, an excellent setup utility which abstracts the process using human-readable config files:
http://firehol.org/



Thanks a lot will give it a try, and report back thanks again.

I need to enable https, http and ICMP alone and need to check it. please help

Last edited by GrimmDebian; 12-18-2014 at 02:14 AM.
 
Old 12-18-2014, 07:52 PM   #9
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,323
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
One of my LUG members made his iptables script at meeting a couple of years ago. You might find it a useful resource.

http://twuug.org/mediawiki/index.php...irewall_Script
 
1 members found this post helpful.
Old 12-21-2014, 03:24 AM   #10
GrimmDebian
LQ Newbie
 
Registered: Dec 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
I actually want a VM to act like a router. How do i do that ? And then i need to add a firewall to selectively send/receive packets. Please Help
 
Old 12-21-2014, 08:44 PM   #11
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,323
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
I have no experience using computers as routers, though I've read about it and know it's not all that difficutl, but I would hesitate to use a VM for that purpose. Doing so adds an extra layer of complexity.

You might want to read this: http://superuser.com/questions/72748...irtual-machine
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I installed Wine and configure this at Debian 4.0 r1.I installed windows software hassancemk Linux - Software 2 04-01-2008 11:28 PM
Dual boot Debian Etch and XP with GRUB - Debian installed First - one HDD bence8810 Debian 11 01-07-2007 10:45 AM
Software Firewalls VS Hardware Firewalls metallica1973 Linux - Security 7 03-17-2006 02:21 PM
Debian firewalls similiar to APF Anon123 Debian 4 08-11-2004 01:40 PM
Linux Firewalls [iso firewalls] yoogie Linux - Networking 3 01-28-2002 06:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration