All of lore.kernel.org
 help / color / mirror / Atom feed
* sub interface filtering
@ 2003-04-02 18:45 Mike
  2003-04-02 19:20 ` Martijn Lievaart
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Mike @ 2003-04-02 18:45 UTC (permalink / raw)
  To: netfilter

Hi guys I have the following setup and rules. And I cant seem to get the
filtering to work.



Interfaces:



eth0

<internetIP>

eth1

<privateIP>

eth2

<routeable internetIP/28>

eth2:0

<routeable internetIP/28>

eth2:1

<routeable internetIP/28>



I have the following rules



iptables -P FORWARD DROP

iptables -I FORWARD -i eth0 -o eth2 -p tcp -m state --state
NEW,ESTABLISHED,RELATED --dport 80 -j ACCEPT

iptables -I FORWARD -i eth0 -o eth2 -p tcp -m state --state
NEW,ESTABLISHED,RELATED --dport 443 -j ACCEPT

iptables -A FORWARD -i eth0 -o eth2 -p tcp -m state --state
NEW,ESTABLISHED,RELATED,INVALID -j DROP



iptables -t nat -A PREROUTING -p tcp <routeable internetIP/28> --dport 80 -j
DNAT --to 192.168.1.197

iptables -t nat -A PREROUTING -p tcp <routeable internetIP/28> --dport
443 -j DNAT --to 192.168.1.197
iptables -t nat -A POSTROUTING -o eth2 -s 192.168.1.197 -j SNAT --to
<routeable internetIP/28

ifconfig eth2:0 <routeable internetIP/28> broadcast <routeable
internetIP/28> netmask 255.255.255.240


iptables -t nat -A PREROUTING -p tcp -d <routeable internetIP/28 --dport
80 -j DNAT --to 192.168.1.198

iptables -t nat -A PREROUTING -p tcp <routeable internetIP/28> --dport
443 -j DNAT --to 192.168.1.198
iptables -t nat -A POSTROUTING -o eth2 -s 192.168.1.198 -j SNAT --to
<routeable internetIP/28

ifconfig eth2:1 <routeable internetIP/28> broadcast <routeable
internetIP/28> netmask 255.255.255.240






but when I scan eth2:1 or eth2:2 from an outside machine I can see ALL the
local services (ssh, ptptp,dns etc..) Is connection not passing the
forwading chain?





^ permalink raw reply	[flat|nested] 13+ messages in thread
* RE: sub interface filtering
@ 2003-04-02 19:53 Daniel Chemko
  2003-04-02 20:34 ` Mike
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Chemko @ 2003-04-02 19:53 UTC (permalink / raw)
  To: Rob Sterenborg, netfilter

Correct. Aliases are obsolete from what I can see. IProute2 adds IP
addresses directly to interfaces, so eth0 could have 10 IP addresses
instead of the awkward eth0:0 eth0:1, etc. mechanism. In this system,
you filter based on IP address instead of interface alias.

-----Original Message-----
From: Rob Sterenborg [mailto:rob@sterenborg.info] 
Sent: Wednesday, April 02, 2003 11:39 AM
To: netfilter@lists.netfilter.org
Subject: RE: sub interface filtering

> Hi guys I have the following setup and rules. And I cant seem to get
the filtering to work.
> eth2:0
> 
> <routeable internetIP/28>
> 
> eth2:1
> 
> <routeable internetIP/28>

AFAIK it is because you cannot filter eth<x>:y (but you can filter the
IP address of course).


Rob




^ permalink raw reply	[flat|nested] 13+ messages in thread
* RE: sub interface filtering
@ 2003-04-02 20:45 Daniel Chemko
  2003-04-05  1:31 ` Qunwei Chen
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Chemko @ 2003-04-02 20:45 UTC (permalink / raw)
  To: netfilter

The Advanced Traffic and Routing Howto had everything I needed. It can
show you how to setup its IP settings etc.. If you want to integrate
into IPTables, the following example shows how simply this can be
accomplished.

$ ip address list
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 100
    link/ether 11:11:11:11:11:11 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.2/24 brd 192.168.1.255 scope global eth0
    inet 192.168.1.111/32 scope global eth0
3: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 100
    link/ether 11:11:11:11:11:11 brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.1/24 brd 192.168.1.255 scope global eth1

You notice that there are 2 addresses on the same interface eth0. I want
to forward each IP address to a separate machine on a different subnet
in this case, so I would do the following:

iptables -t nat -A PREROUTING -j DNAT --destination 192.168.1.2 --to-
destination 192.168.2.2

iptables -t nat -A PREROUTING -j DNAT --destination 192.168.1.111 --to-
destination 192.168.2.111

You could have included "-i eth0" if you really wanted to, but unless
you have the same IP address bolted to different interfaces, I don't see
that mattering much. 


-----Original Message-----
From: Mike [mailto:mikeeo@msn.com] 
Sent: Wednesday, April 02, 2003 12:34 PM
To: Daniel Chemko; netfilter@lists.netfilter.org
Subject: Re: sub interface filtering

I hate to ask but do you have and example of using iproute2 for IP
address aliases?

Thanks,
Mike



^ permalink raw reply	[flat|nested] 13+ messages in thread
* RE: sub interface filtering
@ 2003-04-07 16:48 Daniel Chemko
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Chemko @ 2003-04-07 16:48 UTC (permalink / raw)
  To: chenqunwei, netfilter

http://lartc.org/

-----Original Message-----
From: Qunwei Chen [mailto:chenqunwei@yahoo.com] 
Sent: Friday, April 04, 2003 5:31 PM
To: netfilter@lists.netfilter.org
Subject: Re: sub interface filtering

I tried the google for "Advanced Traffic and Routing Howto" but failed 
to find it. Does anyone have the location of this document?

Thanks in advance,

Qunwei

Daniel Chemko wrote:

>The Advanced Traffic and Routing Howto had everything I needed. It can
>show you how to setup its IP settings etc.. If you want to integrate
>into IPTables, the following example shows how simply this can be
>accomplished.
>
>$ ip address list
>1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue 
>    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
>2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 100
>    link/ether 11:11:11:11:11:11 brd ff:ff:ff:ff:ff:ff
>    inet 192.168.1.2/24 brd 192.168.1.255 scope global eth0
>    inet 192.168.1.111/32 scope global eth0
>3: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 100
>    link/ether 11:11:11:11:11:11 brd ff:ff:ff:ff:ff:ff
>    inet 192.168.2.1/24 brd 192.168.1.255 scope global eth1
>
>You notice that there are 2 addresses on the same interface eth0. I
want
>to forward each IP address to a separate machine on a different subnet
>in this case, so I would do the following:
>
>iptables -t nat -A PREROUTING -j DNAT --destination 192.168.1.2 --to-
>destination 192.168.2.2
>
>iptables -t nat -A PREROUTING -j DNAT --destination 192.168.1.111 --to-
>destination 192.168.2.111
>
>You could have included "-i eth0" if you really wanted to, but unless
>you have the same IP address bolted to different interfaces, I don't
see
>that mattering much. 
>
>
>-----Original Message-----
>From: Mike [mailto:mikeeo@msn.com] 
>Sent: Wednesday, April 02, 2003 12:34 PM
>To: Daniel Chemko; netfilter@lists.netfilter.org
>Subject: Re: sub interface filtering
>
>I hate to ask but do you have and example of using iproute2 for IP
>address aliases?
>
>Thanks,
>Mike
>
>
>  
>





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

end of thread, other threads:[~2003-04-07 16:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-02 18:45 sub interface filtering Mike
2003-04-02 19:20 ` Martijn Lievaart
2003-04-02 19:38 ` Rob Sterenborg
2003-04-02 20:56 ` Joel Newkirk
2003-04-03 15:49   ` Mike
2003-04-03 16:42     ` Joel Newkirk
  -- strict thread matches above, loose matches on Subject: below --
2003-04-02 19:53 Daniel Chemko
2003-04-02 20:34 ` Mike
2003-04-02 20:50   ` Kelly Setzer
2003-04-03  7:10   ` Ralf Spenneberg
2003-04-02 20:45 Daniel Chemko
2003-04-05  1:31 ` Qunwei Chen
2003-04-07 16:48 Daniel Chemko

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.