LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-26-2005, 07:59 PM   #1
midiguy732
LQ Newbie
 
Registered: Oct 2004
Posts: 8

Rep: Reputation: 0
Complicated IP Tables Configuration


Greetings,

I have a RH9 server, with two interfaces, Apache, sendmail, etc, and I'm struggling with something fairly complicated, maybe someone could point me in the correct direction.

On the server, eth0 faces the internal network private IP space.

eth1: has a public IP address I'll call pub194
eth1:1 is pub195
eth1:2 is pub197
eth1:3 is pub198

the public ip, pub194 (eth1), I have working properly with iptables, whereas port 80 goes to apache, port 25 goes to sendmail, etc, and all other ports are completely closed. Nmap indicates this is operating correctly.

Pub195 (eth1:1) also feed apache (only), however hitting that IP address results in different web pages, using the "virtual hosts" part of apache, and that too works fine, and all other ports other than port 80 on pub195 is closed.

Now comes the part that has stumped me for several weeks.

On the public ip addresses, Pub197 (eth1:2) and Pub198 (eth1:3), I need to "nat" them across the eth0 port, in order to send ports 80 and 8481 to two different devices. Dlink webcams actually, and close all the other ports as I have above.

So, to play with one camera, I added the following lines:

#studiocam.midimonkey.com
#-A RH-Lokkit-0-50-INPUT -i eth1:2 -p tcp -m tcp --dport 81 -j ACCEPT
#-A RH-Lokkit-0-50-INPUT -i eth1:2 -p tcp -m tcp --dport 8481 -j ACCEPT

Then at the end of the /var/sysconfig/iptables, I added these lines:

*nat
:OUTPUT ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]

# webcam port forwarding
#-A PREROUTING -o eth1:2 -p tcp -dport 80 -j DNAT --to 192.168.1.21:80
#-A PREROUTING -o eth1:2 -p tcp -dport 8481 -j DNAT --to 192.168.1.21:8481

When I restarted iptables, of course it bombed, at first indicating the "eth1:2" alias was not acceptable, so I thought I'd be clever and rename in "network config" eth1L2 to eth2. Yeah, that didn't work at all even though I changed it in iptables to match.

Basically, I want to forward an additional public IP to a webcam that's hiding behind the server. Then duplicate that, for a second public IP, to a second webcam.

I realize I could open ports on pub194 ip, say, 81 to the first camera, and 82 to the second camera, but then I can't resolve those ports via DNS with something along the line:

studiocam.mydomain.com --> pub197
babycam.mydomain.com --> pub198

pub197 & pub198 being public ips that do nothing else.

I read various iptable-howto type documents, and while its pointed me in somewhat of the right direction (I'm understanding the nat concept much more than before), I am not quite sure how to make this work.

Any ideas? Would be most appreciated!
 
Old 01-28-2005, 01:00 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Re: Complicated IP Tables Configuration

NAT-ed packets won't hit the INPUT chain, they will hit the FORWARD chain...

Last edited by win32sux; 01-28-2005 at 03:34 PM.
 
  


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
ipw2200 ...this looks complicated jnsg Slackware 7 12-22-2005 11:03 AM
iptables and routing tables configuration intranet_man Linux - Networking 6 12-17-2004 04:59 AM
Complicated Network XTJ7 Linux - Networking 9 05-18-2004 12:48 PM
kinda complicated fragger Linux - Networking 10 01-27-2004 08:39 AM
HELP!!!! not too complicated stuff Gnute Slackware 13 05-16-2003 11:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

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