All of lore.kernel.org
 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; 28+ 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] 28+ messages in thread
[parent not found: <cad49557-7c7a-83c9-d2b6-71d9624f0d52@miromedia.ca>]
* netfilter question
@ 2012-12-10 20:12 ` Sri Ram Vemulpali
  0 siblings, 0 replies; 28+ messages in thread
From: Sri Ram Vemulpali @ 2012-12-10 20:12 UTC (permalink / raw)
  To: linux-netdev, linux-kernel-mail, linux-newbie

Hi Guys,

I am writing a netfilter hooks module for applying kernel rules on
incoming packets. I am implementing hook at NF_IP_PRE_ROUTING.

From my understanding, after sk_buff passing NF_IP_PRE_ROUTING hook
enters into ip_forward (routing) path, which will determine whether
packet is for local host, if not for local host, then routes to
destination host based on IP header destination info through local
host interface.

My question is, if I modify sk_buff packet ip header info at
NF_IP_PRE_ROUTING hook, with values of external host ip (destination
host), therefore I think this packet will be routed to destination
host from right source interface. Instead passing it to local host.

Please correct my assumption. Or is anything more I should be doing.
Because I am building a system to route the packets applying kernel
rules.

thanks in advance.

-- 
Regards,
Sri.

^ permalink raw reply	[flat|nested] 28+ messages in thread
* netfilter & ipv6
@ 2005-02-08  7:50 Jonas Berlin
       [not found] ` <53965.213.236.112.75.1107867276.squirrel@213.236.112.75>
  0 siblings, 1 reply; 28+ messages in thread
From: Jonas Berlin @ 2005-02-08  7:50 UTC (permalink / raw)
  To: netfilter-devel

Hi!

I have found that there seems to be a bunch of match & target modules 
for iptables that don't exist for ip6tables.. Like CLASSIFY for example. 
And some that exist have only a subset of the features.

Also some modules exist only for linux 2.4 but were never ported to 2.6 
or don't compile cleanly anymore on the newest 2.6 kernels.

While I don't have that much experience of 2.6 yet and only have been 
hacking some smaller modules for 2.4 in the past, I think I should have 
enough skills to at least port/update some of these.

So I thought maybe I could help out with this task - ipv6 is something 
that I hope and think will take over ipv4 some day and I'd like for 
linux to be able to provide the same experience then as ipv4 users of 
iptables have today.

I have some questions..

1. Some modules (will) look almost identical on ipv4 on and ipv6 - would 
there be any point in making the ipv4 modules export some symbols and 
then re-use those methods in ipv6 if it wouldn't imply any (major) 
changes to the ipv4 modules?

2. I think it could be nice to keep track of what modules exist for ipv4 
and ipv6 on some web page and maybe also let people sign up to join the 
porting effort (if there are any =). What do you think? And is that 
something I could help out with as well? I have a server at home that 
could run it, however behind an 0,5M adsl line..

3. If I succeed porting something, what should I name the patch to be 
sent to patch-o-matic-ng? I don't think I could just extend the existing 
ones as that would suggest the original authors have something to do 
with it and also some of them also are pending or already included in 
the ekernel. So, would CLASSIFY_v6 be an acceptable name for the ipv6 
version of CLASSIFY? And maybe condition_26 for the 2.6 port of 
condition from 2.4? What's your general procedure if someone have 
updates to a module that someone else did? Should the original authors 
be contacted instead of sending patches to this list?

Any suggestions you have are welcome!

-- 
- xkr47

^ permalink raw reply	[flat|nested] 28+ messages in thread
* Re: netfilter question
@ 2004-02-19 20:25 John Black
  2004-02-19 21:22 ` Antony Stone
  0 siblings, 1 reply; 28+ 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] 28+ messages in thread
* Re: netfilter question
@ 2004-02-19 16:56 John Black
  0 siblings, 0 replies; 28+ 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] 28+ messages in thread
* Re: netfilter question
@ 2004-02-19 16:00 John Black
  0 siblings, 0 replies; 28+ 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] 28+ messages in thread
* Re: netfilter question
@ 2004-02-19 14:13 John Black
  2004-02-19 14:51 ` Alexis
  0 siblings, 1 reply; 28+ 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] 28+ messages in thread
* Re: netfilter question
@ 2004-02-19 13:38 John Black
  2004-02-19 14:18 ` Antony Stone
  0 siblings, 1 reply; 28+ 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] 28+ messages in thread
* netfilter question
@ 2004-02-19  3:32 John Black
  2004-02-19  8:19 ` Klemen Kecman
  0 siblings, 1 reply; 28+ 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] 28+ messages in thread
* Netfilter Question
@ 2001-10-24 13:09 Shiva Raman Pandey
  0 siblings, 0 replies; 28+ messages in thread
From: Shiva Raman Pandey @ 2001-10-24 13:09 UTC (permalink / raw)
  To: linux-kernel

Hi Friends,
When I get a packet using netfilter/iptables, I want to send it twice.
I mean I want to call set_verdict function twice.
Is it possible?
Is there any method to achieve this?
Do I have to play around packet_id and data_len parameters?
will handle create any problem?

Regards
Shiva



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

end of thread, other threads:[~2016-11-20 17:55 UTC | newest]

Thread overview: 28+ 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
     [not found] <cad49557-7c7a-83c9-d2b6-71d9624f0d52@miromedia.ca>
2016-11-16 13:33 ` Eric Dumazet
2016-11-16 15:02   ` Florian Westphal
2016-11-16 15:23     ` Eric Dumazet
2016-11-17  0:07       ` Florian Westphal
2016-11-17  2:34         ` Eric Dumazet
2016-11-17 15:49         ` Eric Desrochers
2016-11-20  6:33         ` Eric Dumazet
     [not found]           ` <CAGUFhKwQTRRJpfGi2fRkFfGdpLYMN-2F9G+dEsavM7UGbkjjdA@mail.gmail.com>
2016-11-20 17:31             ` Eric Dumazet
2016-11-20 17:55               ` Eric Dumazet
  -- strict thread matches above, loose matches on Subject: below --
2012-12-10 20:12 Sri Ram Vemulpali
2012-12-10 20:12 ` Sri Ram Vemulpali
2005-02-08  7:50 netfilter & ipv6 Jonas Berlin
     [not found] ` <53965.213.236.112.75.1107867276.squirrel@213.236.112.75>
2005-02-10 23:15   ` ULOG target for ipv6 Jonas Berlin
2005-02-11 22:10     ` netfilter question Pedro Fortuna
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
2001-10-24 13:09 Netfilter Question Shiva Raman Pandey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.