Hello,

IB4m a quite newbye on OpenBSD and need some help with routing dependent on
the source network.

This is the diagram of the scenary: (public IPs aren't the real ones)

           (ISP1)                               (ISP2)
          ADSL-DHCP                         SHDSL:80.25.145.193
             |                                        |
             |                                        |
     ---------------------        ---------------------------
     |Ext IP: DHCP          |        |Ext IP : 80.25.145.193    |
     |Int IP: 192.168.0.1 |        |Int IPs: 80.25.145.192/29|
     ---------------------        ---------------------------
             |                                        |
             |                                        |
     |------------------------------------------------------|
     |     bge0: 192.168.0.254          bge1: 80.25.145.194     |
     |
|
     |                 OpenBSD 4.2 FIREWALL                           |
     |     Default gateway: 192.168.0.1                               |
     |
|
     |     bge2: 172.16.0.254           bge3: 172.31.0.254       |
     |------------------------------------------------------|
             |                                        |
             |                                        |
             |                                        |
      ------------------               ------------------
     /       LAN             \            /       DMZ              \
    /   172.16.0.0/24     \          /   172.31.0.0/24         \
   |                            |        |                                |
   |  gw: 172.16.0.254   |       |                                 |
   |                            |        | WEB_SRV: 172.31.0.21 |
    \                          /          \                               /
     \                       /              \                           /
      -----------------                -------------------

The expected behavior:

1.) Workstations on LAN net (172.16.0.0/24) must reach Internet through ISP1
(172.16.0.X --> 172.16.0.254 --> 192.168.0.10 --> 192.168.0.1 --> ISP1).
2.) Servers on DMZ net (172.31.0.0/24) must reach Internet through ISP2
(172.31.0.X --> 172.31.0.254 --> 80.25.145.194 --> 80.25.145.193 --> ISP2).
3.) Web server on DMZ net must be reachable from Internet through ISP2 (ISP2
--> 80.25.145.194 --> 172.31.0.254 --> 172.31.0.21).
4.) Responses to incoming Web server (DMZ net) must be reply through ISP2
(172.31.0.21 --> 172.31.0.254 --> 80.25.145.194 --> 80.25.145.193 --> ISP2).

I've been testing many configurations without any success:
a) With/without multipathing.
b) With/without "route-to" and "reply-to" filter rules.
...

B?Can anyone please help me?

Bellow is my pf.conf file, i've removed the "routing outgoing trafic to
ISP2" to avoid confusions with my wrongly builted rules.

#############################################################################
##
#############################################################################
##
##
##      $OpenBSD: pf.conf,v 1.34 2007/02/24 19:30:59 millert Exp $
##
## See pf.conf(5) and /usr/share/pf for syntax and examples.
## Remember to set net.inet.ip.forwarding=1 and/or
net.inet6.ip6.forwarding=1
## in /etc/sysctl.conf if packets are to be forwarded between interfaces.
#############################################################################
##
#############################################################################
##

#############################################################################
##
##  CONF: Local interfaces
#############################################################################
##

## ISP1
isp1_if = "bge0"
isp1_ip = "192.168.0.254"
isp1_gw = "192.168.0.1"
isp1_net = "192.168.0.0/24"

## ISP2
isp2_if = "bge1"
isp2_ip = "80.25.145.194"
isp2_gw = "80.25.145.193"
isp2_net = "80.25.145.192/29"

## LAN
lan_if = "bge2"
lan_ip = "172.16.0.254"
lan_net = "172.16.0.0/24"

## DMZ
dmz_if = "bge3"
dmz_ip = "172.31.0.254"
dmz_net = "172.16.0.0/24"

#############################################################################
##
##  CONF: Local servers/services
#############################################################################
##

## WEB Server
srv_web_001 = "172.31.0.21"

#############################################################################
##
##  CONF: Extended Security
#############################################################################
##

private_networks  = "{10.0.0.0/8 172.16.0.0/12}"
pseudo_private_networks  = "{192.168.0.0/16}"
public_interfaces = "{" $isp1_if $isp_2if "}"

#############################################################################
##
##  CONF: Loopback interface
#############################################################################
##

set skip on lo

#############################################################################
##
##  SCRUB
#############################################################################
##

scrub in all

#############################################################################
##
##  NAT: FTP-Proxy
#############################################################################
##

nat-anchor "ftp-proxy/*"
nat on $isp1_if inet from $lan_if -> ($isp1_if)
rdr-anchor "ftp-proxy/*"
rdr pass on $lan_if proto tcp to port ftp -> 127.0.0.1 port 8021


#############################################################################
##
##  NAT: From LAN and DMZ to INTERNET
#############################################################################
##

nat on $isp1_if from $lan_net to any -> ($isp1_if)
nat on $isp2_if from $dmz_net to any -> ($isp2_if)

#############################################################################
##
##  REDIRECT: Redireccionamiento WEB (http y https)
#############################################################################
##

rdr on $isp2_if proto tcp from any to $isp2_if \
   port http -> $srv_web_001 port http

rdr on $isp2_if proto tcp from any to $isp2_if \
   port https -> $srv_web_001 port https

#############################################################################
##
##  FILTER: Extended Security
#############################################################################
##

antispoof quick for {lo $lan_if $dmz_if}

block in  quick on $public_interfaces from $private_networks to any
block out quick on $public_interfaces from any to $private_networks
block in  quick on $isp2_if from $pseudo_private_networks to any
block out quick on $isp2_if from any to $pseudo_private_networks

#############################################################################
##
##  FILTER: Routing outgoing to ISP2
#############################################################################
##

???

#############################################################################
##
##  FILTER: Allow all trafic  (B!B!WARNING!!: JUST FOR DEBUG)
#############################################################################
##

pass  in quick on $public_interfaces all
pass out quick on $public_interfaces all
--
View this message in context:
http://www.nabble.com/select-outgoing-route-depending-on-souce-interface-%28n
et%29-tp15863445p15863445.html
Sent from the openbsd user - misc mailing list archive at Nabble.com.

Reply via email to