LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-06-2005, 09:55 AM   #1
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
How can I setup a Linux firewall router for my public class C IP block?


How can I setup a Linux firewall router for my public class C IP block?

My ISP has given me a T1 line with the IP's
69.25.19.0/24
69.25.19.0 Network
69.25.19.1 Gateway
69.25.19.255 Broadcast

I have a server with 2 nic cards, 1 nic card has my t1 line, the other has a cat 5 going to my switch, and I want to set it up to handle all the traffic and filter it with IPtables. How can I route all traffic through that server?

I know I have to run:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to ?????

What do I make the IP's of my 2 nic cards? What do I use as the gateway of my server with the 2 nics? What do my servers on the switch use for the gateway?

Thanks in advance.
 
Old 09-06-2005, 10:31 AM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Do you want systems behind the firewall to have IPs from your class C, or from a private address block, like 10.0.0.0/8, or 192.168.0.0/16?
 
Old 09-06-2005, 10:53 AM   #3
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Original Poster
Rep: Reputation: 55
I am wanting them to have IP's from my class C block.
 
Old 09-06-2005, 11:53 AM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Ok, then you don't want to do any natting. In fact, you should just be able to activate ip_forward, set the FORWARD chain to ACCEPT and they'll be online. You can then tighten down your security.
 
Old 09-06-2005, 01:24 PM   #5
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Original Poster
Rep: Reputation: 55
So I just run these:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -P FORWARD ACCEPT

What would I set the IP for eth0 and eth1?

What default gateway does the router server need? What default gateway should the other servers have?
 
Old 09-06-2005, 01:35 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Assign eth0 and eth1 an IP from your class C. Set your clients to use the server as the gateway. Set your server to use your ISP's gateway.
 
Old 09-06-2005, 01:55 PM   #7
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Original Poster
Rep: Reputation: 55
Is there any way to keep my ISP's gateway for the "clients"? I already have a few "clients" active using the ISP's gateway
 
Old 09-06-2005, 01:58 PM   #8
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Realistically, with it not being NAT, that might work as well. Give it a try.
 
Old 09-06-2005, 02:24 PM   #9
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Original Poster
Rep: Reputation: 55
How can I get it to just forward all out bound traffic without filtering it at all?
 
Old 09-06-2005, 02:32 PM   #10
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Code:
# iptables -P FORWARD ACCEPT
# echo 1 > /proc/sys/net/ipv4/ip_forward
Should do it
 
  


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
router and firewall setup jibskg Linux - Networking 1 08-23-2004 09:01 AM
how to setup router on linux as a open firewall thirumala Linux - Networking 8 04-10-2004 05:38 PM
Howto setup two stage firewall? Linux and router-in-a-box? drdirt Linux - Security 5 01-10-2004 02:51 AM
router/firewall setup please help?! basatum Mandriva 1 09-20-2003 03:53 PM
setup linux firewall/router sub_netter Linux - Networking 4 08-15-2003 06:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:35 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