Linux Netfilter discussions
 help / color / mirror / Atom feed
* Re: netfilter question
@ 2004-02-19 16:23 John Black
  2004-02-19 17:06 ` Antony Stone
  0 siblings, 1 reply; 15+ messages in thread
From: John Black @ 2004-02-19 16:23 UTC (permalink / raw)
  To: netfilter


>
>this assumption is because you're saying 161.x.x.x/21  as destination,
>all other destinations that doesnt belong to 161.x.x.x to
>161.x.x+8.x+255 will be not nat'ed
>

right now i just have 1 class C private network.

At work i have a static class B ipaddress of 161.x.x.x/255.255.252.0 with the
private class C network 192.168.0.0/255.255.255.0

john
http://www.arbbs.net/


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: netfilter question
@ 2004-02-19 20:25 John Black
  2004-02-19 21:22 ` Antony Stone
  0 siblings, 1 reply; 15+ messages in thread
From: John Black @ 2004-02-19 20:25 UTC (permalink / raw)
  To: netfilter


>I think you simply need to remove the "-d 161.x.x.x/21" from your rule and

>things will start working the way you want.
>
>Regards,
>

just wanted to make sure this is right.
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0  -j SNAT --to 161.x.x.x


<iptables -t nat -L -n> gives me

Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
 
Chain POSTROUTING (policy ACCEPT) 
target     prot opt source               destination
SNAT       all  --  192.168.0.0/24       0.0.0.0/0          to:161.x.x.x

is that right? so that should mask my internetwork?  

john
 

http://www.arbbs.net/


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: netfilter question
@ 2004-02-19 16:56 John Black
  0 siblings, 0 replies; 15+ messages in thread
From: John Black @ 2004-02-19 16:56 UTC (permalink / raw)
  To: netfilter

>
> - for packets which have a source address in the range 192.168.0.0/24
> - and are going out of interface eth0
> - and have a destination address in the range 161.x.x.x/21
>translate the source address to 161.x.x.x
>
>Any other packets (eg: ones with a destination address of the netfilter 
>website server) will not match this rule, and will not be translated.
>
>I think you simply need to remove the "-d 161.x.x.x/21" from your rule and

>things will start working the way you want.
>
>Regards,
>
>Antony.
thanks i will try it when i get to work.

john
http://www.arbbs.net/


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: netfilter question
@ 2004-02-19 16:00 John Black
  0 siblings, 0 replies; 15+ messages in thread
From: John Black @ 2004-02-19 16:00 UTC (permalink / raw)
  To: netfilter

>if 24 bits define a mask that is considered as Class C
>
>24-21 = 3 
>2 power 3 = 8 
>
>so, its 8 /24 or 8 Class C networks.

sorry it has been awhile since i have had basic networking.
http://www.arbbs.net/


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: netfilter question
@ 2004-02-19 14:13 John Black
  2004-02-19 14:51 ` Alexis
  0 siblings, 1 reply; 15+ messages in thread
From: John Black @ 2004-02-19 14:13 UTC (permalink / raw)
  To: netfilter


>
>Okay, so that rule is going to hide your 192.168.0.0/24 >network behind the
public address of the firewall for all >packets going to addresses in the range
161.x.x.x/21 (ie 8 >Class C's in size).
8 Class C's?

>How are you testing this and deciding it doesn't work?
im testing it with my windows machine going to the msn chat rooms, because i
know i will show you what ip address you are coming from.  is there a better
way to check it.

>(By the way, why are you only translating packets which are >going to (presumably)
your ISP?   What about packets going >anywhere else on the Internet?).

I thought that translated all of the packets?  How is it only translating packets
to the ISP?

john
http://www.arbbs.net/


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: netfilter question
@ 2004-02-19 13:38 John Black
  2004-02-19 14:18 ` Antony Stone
  0 siblings, 1 reply; 15+ messages in thread
From: John Black @ 2004-02-19 13:38 UTC (permalink / raw)
  To: netfilter

>Please post your complete ruleset, including the definitions >of variables such

>

here are the rule sets.  
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

iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 \
-d 161.x.x.x/21 -j SNAT --to 161.x.x.x

<iptables -L -nvx>

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

<iptables -t nat -L> 
target  prot opt source            destination 
SNAT    all  --  192.168.0.0/24    161.x.x.x/21 to:161.x.x.x


John
http://www.arbbs.net/


^ permalink raw reply	[flat|nested] 15+ messages in thread
* netfilter question
@ 2004-02-19  3:32 John Black
  2004-02-19  8:19 ` Klemen Kecman
  0 siblings, 1 reply; 15+ messages in thread
From: John Black @ 2004-02-19  3:32 UTC (permalink / raw)
  To: netfilter

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





^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2004-02-19 21:22 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-19 16:23 netfilter question John Black
2004-02-19 17:06 ` Antony Stone
  -- strict thread matches above, loose matches on Subject: below --
2004-02-19 20:25 John Black
2004-02-19 21:22 ` Antony Stone
2004-02-19 16:56 John Black
2004-02-19 16:00 John Black
2004-02-19 14:13 John Black
2004-02-19 14:51 ` Alexis
2004-02-19 13:38 John Black
2004-02-19 14:18 ` Antony Stone
2004-02-19  3:32 John Black
2004-02-19  8:19 ` Klemen Kecman
2004-02-19  9:22   ` Antony Stone
2004-02-19 13:06   ` John Black
2004-02-19 13:17     ` Antony Stone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox