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 02-25-2002, 05:21 PM   #1
jimval7
Member
 
Registered: Jan 2002
Location: Dallas, TX
Distribution: RedHat 7.0 - Kernel 2.4.17
Posts: 95

Rep: Reputation: 16
Unhappy iptables, what am i doing wrong?!


OK, I have 2 PHYSICAL NICS, one NIC has 2 IP address and the other one has 1 ip connected to my LAN so I have:

eth0 and eth0:1 (both IP's ARE a public (REAL) IP Addresses (And they both work because i can ping both from the outside)

eth1 for my LAN has 10.1.1.1

I want to forward port 8080 on eth0:1 to one of my Private servers on my LAN. My server is listening on port 8080. So that is already set, I can get to my server on port 8080 from one of my other computers on my LAN.

SOOOOOO, I can't get through my Firwall from the outside, below is part of my rc.firewall script:

$IPTABLES -t nat -A POSTROUTING -o eth0 -j SNAT --to x.x.x.x #my public IP
$IPTABLES -t nat -A PREROUTING -i eth0:1 -p tcp --dport 8080 -j DNAT --to 10.1.1.20:8080
$IPTABLES -A FORWARD -i eth0:1 -o eth1 -p tcp -d 10.1.1.20 --dport 8080 -j ACCEPT

Am i missing something? Where can i look where it rejects the request? I've looked in /var/log/messages file and can't see anything in there.
Please help!?

 
Old 02-25-2002, 05:30 PM   #2
manthram
Member
 
Registered: Feb 2002
Location: Fairfax, VA
Distribution: RedHat 8, Mandrake9.1, Slack9
Posts: 456

Rep: Reputation: 31
what is your default policy for forwarding? if that is set to drop then you need to add a line which says it should accept the exsisting and related ones.

something like this

$IPTABLES -A FORWARD -i eth0:1 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
 
Old 02-25-2002, 05:39 PM   #3
jimval7
Member
 
Registered: Jan 2002
Location: Dallas, TX
Distribution: RedHat 7.0 - Kernel 2.4.17
Posts: 95

Original Poster
Rep: Reputation: 16
Angry Still not working!?

I entered the following line:

$IPTABLES -A FORWARD -i eth0:1 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT

but I still get the this message:

Network Connection was refused by server x.x.x.x:8080.
The server may not be accepting connections or may be busy.

Try connecting again later.


Is there a log I can look at besided /var/log/messages?

 
Old 02-26-2002, 07:34 AM   #4
manthram
Member
 
Registered: Feb 2002
Location: Fairfax, VA
Distribution: RedHat 8, Mandrake9.1, Slack9
Posts: 456

Rep: Reputation: 31
please post your firewall script or provide a link to it.
 
Old 02-26-2002, 11:18 AM   #5
jimval7
Member
 
Registered: Jan 2002
Location: Dallas, TX
Distribution: RedHat 7.0 - Kernel 2.4.17
Posts: 95

Original Poster
Rep: Reputation: 16
Here it is.

Here is my script (ALL OF IT), remember eth0 and eth0:1 have pulic IP addresses, eth1 is to my private address:

#!/bin/sh
#
# rc.firewall - Initial SIMPLE IP Masquerade test for 2.4.x kernels using IPTABLES.
echo -e "\n\nLoading simple rc.firewall \n"
# The location of the 'iptables' program
IPTABLES=/usr/local/sbin/iptables
echo -en " loading modules: "
echo " - Verifying that all kernel modules are ok"
/sbin/depmod -a
# Supports the proper masquerading of FTP file transfers using the PORT method
#
/sbin/modprobe ip_masq_ftp
#
# CRITICAL: Enable IP forwarding since it is disabled by default since
# Redhat Users: you may try changing the options in
# /etc/sysconfig/network from
# FORWARD_IPV4=false
# to
# FORWARD_IPV4=TRUE
echo " enabling forwarding.."
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/ip_always_defrag
#
echo " Enabling SNAT (MASQUERADE) functionality on eth0"
$IPTABLES -t nat -A POSTROUTING -o eth0 -j SNAT --to X.X.X.X # The X's is where i put my public IP Address #
$IPTABLES -t nat -A PREROUTING -p tcp --dport 8080 -i eth0:1 -j DNAT --to 10.1.1.20:8080
$IPTABLES -A FORWARD -i eth0:1 -o eth1 -p tcp -d 10.1.1.20 --dport 8080 -j ACCEPT
$IPTABLES -A FORWARD -i eth0:1 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
echo -e "\nrc.firewall-2.4 done.\n"

Last edited by jimval7; 02-26-2002 at 08:33 PM.
 
Old 02-27-2002, 11:29 AM   #6
jimval7
Member
 
Registered: Jan 2002
Location: Dallas, TX
Distribution: RedHat 7.0 - Kernel 2.4.17
Posts: 95

Original Poster
Rep: Reputation: 16
Question Problem with eth0:1

I found out why my iptables is not working, iptables does not like my second interface eth0:1, it does not like the colon":" is there a way for me to use eth0:1 in iptable with the ":" ?
 
  


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
Blocking certain IPs with iptables - what am I doing wrong? thinksincode Linux - Security 2 12-21-2004 10:27 AM
What's wrong with this iptables syntax?? registering Linux - Security 3 06-16-2004 03:54 PM
What's wrong with my iptables script? veritas Linux - Security 3 06-06-2004 11:39 AM
IPTables: what in bloody blazes am I doing wrong??? garison08 Linux - Security 2 04-22-2004 10:56 AM
iptables - somthing gone wrong ? qwijibow Linux - Security 7 09-01-2003 11:56 AM

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

All times are GMT -5. The time now is 08:06 AM.

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