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 11-26-2009, 08:34 PM   #16
alesserfate
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Original Poster
Rep: Reputation: 0

I've been trying to get these two lines to work, but it doesn't work still, I have to get this working by tomorrow =(


Code:
iptables -A FORWARD -s 0/0 -i eth1 -d 172.16.19.2 -o eth0 -p TCP --sport 1024:65535 -m multiport --dports 9090,2020 -j ACCEPT
 
iptables -A FORWARD -d 0/0 -o eth1 -s 172.16.19.2 -i eth0 -p TCP -m state --state ESTABLISHED -j ACCEPT
 
Old 11-26-2009, 08:49 PM   #17
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
You (I think) should try rules like this:

iptables -t nat -A PREROUTING -i eth1 -d 192.168.43.153 -j DNAT --to 172.16.19.1
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
 
Old 11-26-2009, 09:38 PM   #18
alesserfate
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by nimnull22 View Post
You (I think) should try rules like this:

iptables -t nat -A PREROUTING -i eth1 -d 192.168.43.153 -j DNAT --to 172.16.19.1
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
thanks, im trying that now! i'll let you know in a couple of minutes
 
Old 11-26-2009, 09:47 PM   #19
alesserfate
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by alesserfate View Post
thanks, im trying that now! i'll let you know in a couple of minutes
its not working, i don't understand why, everything is pinging good

maybe the other statements in my script aren't permitting it or the order is wrong.

dammit.
 
Old 11-26-2009, 10:39 PM   #20
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Quote:
Originally Posted by alesserfate View Post
its not working, i don't understand why, everything is pinging good

maybe the other statements in my script aren't permitting it or the order is wrong.

dammit.
Because it is only for ONE WAY.
 
Old 11-26-2009, 10:42 PM   #21
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
I gave you an example, you know how it should be.
Try to add
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
 
Old 11-27-2009, 02:53 AM   #22
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by alesserfate View Post
I don't want to use MASQUERADING, I just want to allow/forward specific services through.

Still can't figure it out. Anyone ?
do me a favour please.
add some logging, then lets start testing the rules a bit. im a bit muddled as to where you are up to on this.
so please do this.

Code:
iptables -N LOG_DROP
iptables -A LOG_DROP -j LOG --log-prefix "dropped packet" --log-level 7
iptables -A LOG_DROP -j DROP

then, at the end of INPUT, OUTPUT, FORWARD and any other chain, add the LOG_DROP rule.
that is anything that isnt allowed through the firewall is logged and dropped.

Now, tail -f /var/log/yourfirewalllog whilst testing the rules.
You should see which packets are being blocked and can then allow them in the appropriate rule. If you have trouble with this, please post relevant logs
 
Old 11-29-2009, 11:22 AM   #23
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by centosboy View Post
do me a favour please.
add some logging, then lets start testing the rules a bit. im a bit muddled as to where you are up to on this.
so please do this.

Code:
iptables -N LOG_DROP
iptables -A LOG_DROP -j LOG --log-prefix "dropped packet" --log-level 7
iptables -A LOG_DROP -j DROP

then, at the end of INPUT, OUTPUT, FORWARD and any other chain, add the LOG_DROP rule.
that is anything that isnt allowed through the firewall is logged and dropped.

Now, tail -f /var/log/yourfirewalllog whilst testing the rules.
You should see which packets are being blocked and can then allow them in the appropriate rule. If you have trouble with this, please post relevant logs
have you got this working yet??
there is another way
bit simpler too...
there is a tool called rinetd. it might be a bit old but it still works.
It is downloadable as a daemon or a perl script.

http://www.google.co.uk/search?q=rin...ient=firefox-a
 
Old 11-30-2009, 04:44 AM   #24
alesserfate
LQ Newbie
 
Registered: Nov 2009
Posts: 12

Original Poster
Rep: Reputation: 0
hey guys

thanks so much for everyone's help

i wasn't able to get it working and i failed my project

thanks anyway, hopefully I can still pass the course
 
Old 11-30-2009, 03:16 PM   #25
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by alesserfate View Post
hey guys

thanks so much for everyone's help

i wasn't able to get it working and i failed my project

thanks anyway, hopefully I can still pass the course
sorry to hear that..
 
  


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
LXer: Wikimedia to Sloan: Thanks a million, thanks a million, thanks a million LXer Syndicated Linux News 0 03-26-2008 02:50 PM
Threads inside shared library arunka Programming 1 02-25-2006 12:54 AM
Search for "0 replies" threads only inside of the forum zahadumy LQ Suggestions & Feedback 12 12-18-2005 11:36 AM
iptables inside client to inside host with outside DNS or IP - Help! linuxhelp2 Linux - Networking 1 10-15-2005 06:19 AM
IPTABLES NAT Gateway, No Access from the inside? nweaver916 Linux - Networking 2 08-27-2004 03:46 PM

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

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