Skip to contentSkip to conversation

netfilter question

DISCUSSION John Black 3 participants 5 messages Feb 19, 2004

lore
Share & tools
lore

John Black

author
#0 lore raw

I'm trying to install a gateway/router with Red Hat 9 kernel 2.4.24 and the stock
iptables 1.2.7a, with full NAT compiled into the kernel. I have read the howto
at netfilter.org, even have the same line of code. But it sill will not change
the source address.

here is the line of code and the result of the command <iptables -L -nvx>

iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED, RELATED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -A FORWARD -j LOG

Chain INPUT (policy ACCEPT 127 packets, 9436 bytes)
pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 36 packets, 1709 bytes)
pkts bytes target prot opt in out source
destination
0 0 ACCEPT all -- eth0 eth1 0.0.0.0/0 0.0.0.0/0
state RELATED, ESTABLISHED

0 0 ACCEPT all -- eth1 eth0 0.0.0.0/0 0.0.0.0/0

0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0
LOG flags 0 level 4

Chain OUTPUT (policy ACCEPT 74 packets, 8568 bytes)
pkts bytes target prot opt in out source destination

I new to security of a network. Am I close?

thanks
john

#1 lore raw

For dynamic IP (ADSL)
$IPT -t nat -A POSTROUTING -o $IF_INET -j MASQUERADE

and for static IP (Cable)
$IPT -A POSTROUTING -t nat -s $IP_LAN_RNG -o $IF_NET -j SNAT --to-source $IP_NET

That is for routing. If you want to secure your network and the router itselfe it takes alot more .. like setting up a firewall :)

Klemen Kecman
Sting d.o.o.
Smartinska 106
1000 Ljubljana - SI
+386 1 5246033
+386 41 456421

----- Original Message -----
From: "John Black" <[email protected]>
To: <[email protected]>
Sent: Thursday, February 19, 2004 4:32 AM
Subject: netfilter question

Quoted 1 line

I'm trying to install a gateway/router with Red Hat 9 kernel 2.4.24 and

the

Quoted 10 lines

stock
iptables 1.2.7a, with full NAT compiled into the kernel. I have read the howto
at netfilter.org, even have the same line of code. But it sill will not change
the source address.

here is the line of code and the result of the command <iptables -L -nvx>

iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,

RELATED -j

Quoted 14 lines

ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -A FORWARD -j LOG

Chain INPUT (policy ACCEPT 127 packets, 9436 bytes)
pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 36 packets, 1709 bytes)
pkts bytes target prot opt in out source
destination
0 0 ACCEPT all -- eth0 eth1 0.0.0.0/0 0.0.0.0/0
state RELATED, ESTABLISHED

Quoted 3 lines

0 0 ACCEPT all -- eth1 eth0 0.0.0.0/0 0.0.0.0/0

0 0 ACCEPT all -- * * 0.0.0.0/0

0.0.0.0/0

Quoted 14 lines

LOG flags 0 level 4

Chain OUTPUT (policy ACCEPT 74 packets, 8568 bytes)
pkts bytes target prot opt in out source destination

I new to security of a network. Am I close?

thanks
john

#2 lore raw
Quoted 2 lines · Klemen Kecman

For dynamic IP (ADSL)
and for static IP (Cable)

I know this is off-topic, but I just thought I'd point out that these are not
universal distinctions. Different operators provide different services.
For example, I have a dynamic IP cable service from NTL, and a static IP ADSL service from BT, here in the UK.

Antony.

Signature · 9 lines
The idea that Bill Gates appeared like a knight in shining armour to lead all 
customers out of a mire of technological chaos neatly ignores the fact that 
it was he who, by peddling second-rate technology, led them into it in the 
first place.

 - Douglas Adams in The Guardian, 25th August 1995

                                                     Please reply to the list;
                                                           please don't CC me.
author
#3 lore raw
In reply to Klemen Kecman
Quoted 3 lines

$IPT -A POSTROUTING -t nat -s $IP_LAN_RNG -o $IF_NET -j SNAT --to-source $IP_NET

i have that line in my firewall script. but it still doesn't mask my internet work

Quoted 3 lines

That is for routing. If you want to secure your network and the router itselfe it takes alot more .. like setting up a firewall :)

I have that part setup. All ports a block but the ones that I need. the firewall will drop all pings to the outside nic and inside nic. I just have to mask the internal network

#4 lore raw
Quoted 5 lines · John Black
Quoted 2 lines

$IPT -A POSTROUTING -t nat -s $IP_LAN_RNG -o $IF_NET -j SNAT --to-source $IP_NET

i have that line in my firewall script. but it still doesn't mask my internet work

Please post your complete ruleset, including the definitions of variables such
as $IP_LAN_RNG, so we can see if there's something wrong. By all means
disguise any public IP's if you wish, but not so much that we can't tell which one is which (if you have more than one).

Please also tell us how you are testing the rules and why you think it doesn't work (I know that may sound obvious, but every little helps...)

Regards,

Antony.

Signature · 7 lines
Your work is both good and original.  Unfortunately the parts that are good 
aren't original, and the parts that are original aren't good.

 - Samuel Johnson

                                                     Please reply to the list;
                                                           please don't CC me.