LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 08-21-2005, 02:06 PM   #1
movitto
Member
 
Registered: May 2004
Distribution: Fedora 4 and Slackware
Posts: 179

Rep: Reputation: 30
Gateway not forwarding


Hi, Im attempting to setup a simple network gateway with a with firewall functionality. For some reason this task is providing to be more of a challange than I thought.
My situation: 2 ethernet cards, eth0 is dynamically configured by isp, eth1 is statically assigned ip address 111.222.333.1 and is associated with a dhcpd server which assigns ip's to servers and such on subnets (this works fine). My private subnet is 111.222.333.32/27 with a broadcast address of 111.222.333.63 and is what I am experimenting with when trying to get this to work.

For now I have set iptables to allow everything, so that I can get the router working before I close off ports. Basically these are the commands I used to setup iptables:
iptables -A INPUT -j LOG --log-level notice --log-prefix IPTABLES:
iptables -A INPUT -j ACCEPT
iptables -A OUTPUT -j LOG --log-level notice --log-prefix IPTABLES:
iptables -A OUTPUT -j ACCEPT
iptables -A FORWARD -j LOG --log-level notice --log-prefix IPTABLES:
iptables -A FORWARD -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE

I also have tried doing the following, but with no avail yet (leaving these out does not solve the problem either):
iptables -t nat -A PREROUTING -i eth0 -j DNAT --to 111.222.333.63 (private subnet broadcast)
iptables it nat -A PREROUTING -i eth1 -j DNAT --to 0.0.0.0

As for 'route':
111.222.333.32 * 255.255.255.224 eth1
111.222.333.0 * 255.255.255.224 eth1
111.222.333.0 * 255.255.255.0 eth1
aaa.bbb.ccc.ddd * 255.255.255.252 eth0
default aaa.bbb.ccc.1 0.0.0 eth0
(where add.bbb.ccc.ddd is my isp's network)

I have also added a static route to 111.222.333.1 (eth1) which did not work. As well as removing one or both of the 111.222.333.0 entries which also did not work.

Finally, checking the iptables logs I discover that hosts on my private subnet are sucessfully attempting to reach their destination via eth1 (logs show connections for port 53 - dns, as i am attempting to connect to the web via a browser on my end host) but after several of these attempts, the iptables responds by sending an ICMP signal back to the client of type 3 or 'Destination Unreachable'.

Thats about it. I am completely stumped with this one. I'm not sure why something that is so simple is proving to be so hard. If anyone has any ideas or sees any flaws in my thinking, please relay you ideas on. Thanks alot.
 
Old 08-21-2005, 02:14 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
What do you have in /proc/sys/net/ipv4/ip_forward ? When forwarding is on, you should have 1.
 
Old 08-21-2005, 03:02 PM   #3
movitto
Member
 
Registered: May 2004
Distribution: Fedora 4 and Slackware
Posts: 179

Original Poster
Rep: Reputation: 30
Thx for the reply mara. I checked and I do have 1 in /proc/sys/net/ipv4/ip_forward.
More suggestions are appreciated.
 
Old 08-22-2005, 02:24 AM   #4
movitto
Member
 
Registered: May 2004
Distribution: Fedora 4 and Slackware
Posts: 179

Original Poster
Rep: Reputation: 30
Still no luck :-(
I have seemed to try everything, I've played around with both route and iptables; defining routes and rules in hope of getting something to work, but it still wont.

If noone has any ideas concerning my problem, then maybe you could recommend a utility or such to help me find the problem easier. I could especially use something to read the iptables log output out of /var/log/messages, as it is very cryptic and hard to read. Since I dont have X installed on my gateway it would have to be something cmd line based.

Anyways, If anyone has any suggestions please post, and I will keep this post updated if I make any breakthroughs.
 
Old 08-22-2005, 07:49 AM   #5
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676
Blog Entries: 7

Rep: Reputation: 32
If you want my advice to be honest with you you can spare yourself this whole mess in a few simple clicks but you need to have X ........ there is this firewall called firestarter it is a GUI firewall it enables you to start internet connection with an easy to use firewall in a few seconds .......I used to have lot of probs everytime i used to install a linux gateway "not a great network guru here"... but since I started using firestarter Iam finishing the network configuration in 10 minutes max
 
Old 09-06-2005, 03:22 PM   #6
movitto
Member
 
Registered: May 2004
Distribution: Fedora 4 and Slackware
Posts: 179

Original Poster
Rep: Reputation: 30
Solved! After much much much (note the date between posts) debugging I found that the problem occured because my internel clients were sending DNS queries to my gateway for web sites I was trying to access, and my gateway was not forwarding this request to my isp's DNS server. After compiling and installing BIND, and creating the named.conf file as so;

options{
forward first;
forwarers {
isp.dns.server.ip;
};
};

my gateway successfully forwarded packets. (To be technically correct, it was forwarding packets all along, but I was trying to access external sites via url and not ip, because my "genious intellect" :-) )
Anyways, I hope this helps anyone in a similar rut, and I would like to once again thank all those that helped me solving my problem.
 
  


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
Simple Port Forwarding Firewall - not forwarding MadTurki Linux - Security 14 04-09-2006 12:08 PM
Internet gateway with ip packet forwarding GiX Linux - Networking 10 07-29-2005 10:33 AM
gateway not forwarding sonika_singhi Linux - Networking 3 04-05-2005 03:19 PM
Odd problem: Gateway unreachable after certain amount of time (Win XP Gateway) SocialEngineer Linux - Networking 2 08-13-2004 12:54 AM
Forwarding all TCP/IP connection to a windows gateway itaysz Linux - Networking 6 01-29-2004 01:22 PM

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

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