On 05/24/2012 04:31 AM, Jan van der Vyver wrote:
> Hi
>
> I have a server with 2 routers(192.168.254.1 and 192.168.254.3)
> connected on the same interface on the server(192.168.254.2). Both route
> to a 10.0.0.0/8 network.
>
> I have the following custom rules which sorts out the routing for me and
> below each have written the shorewall equivalent and marked some stuff
> with ????
>
> Please check what I have and help me on the ????
>
> ip rule add fwmark 0x1 table r1
>
> ip rule add fwmark 0x2 table r2
>
>>>>>/etc/shorewall/providers
>
>>>>>#NAME NUMBER MARK DUPLICATE INTERFACE GATEWAY                    OPTIONS   
>>>>>                     COPY
>
>>>>>r1    1              1        -            eth0            192.168.254.1 
>>>>>track            ??
>
>>>>>r1    2              2        -            eth0            192.168.254.2 
>>>>>track            ??

You need the 'shared' option as well as 'track'. If you specify 
USE_DEFAULT_RT=Yes (which I recommend), then you need nothing in the 
COPY column.

There are a couple of errors in the second line above; the provider name 
should be r2 and the gateway address should be 192.168.254.3.

>
> ip route add 10.0.0.0/8 via 192.168.254.1 table r1
>
> ip route add 10.0.0.0/8 via 192.168.254.3 table r2
>
>  >>>>/etc/shorewall/routes

#PROVIDER               DEST                    GATEWAY         DEVICE
r1                      10.0.0.0/8              192.168.254.1   eth0
r2                      10.0.0.0/8              192.168.254.3   eth0

Those are superfluous, however, since the default routes for r1 and r2 
go to the same gateways.

>
> -A PREROUTING -p tcp -m tcp --dport 22120 -j MARK --set-mark 0x01
>
> -A PREROUTING -p tcp -m tcp --dport 22122 -j MARK --set-mark 0x02
>
>  >>>>|/etc/shorewall/tcrules|
>
>>>>>#ACTION      SOURCE        DEST            PROTO      PORT(S)        
>>>>>SOURCE    USER TEST LENGTH TOS CONNBYTES HELPER
>
>>>>>#                                                                          
>>>>>                      PORT(S)
>
>>>>>1:T              0.0.0.0/0 0.0.0.0/0 TCP          22120                    
>>>>>-              -        -        -            -      -
>
>>>>>2:T              0.0.0.0/0 0.0.0.0/0 TCP          22122


#ACTION    SOURCE      DEST      PROTO     PORT(S)
1:P        eth3        -         tcp       22120
2:P        eth3        -         tcp       22122

There, I'm assuming that eth3 is the 'net' interface.

>-A PREROUTING -p tcp -m tcp --dport 22120 -j DNAT --to-destination 
>10.0.2.62:6001

>-A PREROUTING -p tcp -m tcp --dport 22122 -j DNAT --to-destination 
>10.0.0.5:6001
>>>>>#ACTION    SOURCE DEST                        PROTO      DEST        
>>>>>SOURCE    ORIGINAL
>
>>>>>#                                                                          
>>>>>    PORT        PORT(S) DEST
>
>>>>>DNAT          net        apn:10.0.2.61:6001      tcp          22120        
>>>>>    -              196.44.33.33
>
>>>>>DNAT          net        apn:10.0.0.5:6001      tcp          22122         
>>>>>   -              196.44.33.33

Those look correct, assuming that the server's net IP address is 
196.44.33.33.

> -A POSTROUTING -d 10.0.0.0/8 -j SNAT --to-source 192.168.254.2
>
>  >>>>|/etc/shorewall/masq|
>
> |>>>>|#INTERFACE      SOURCE                      ADDRESS                  
> PROTO      PORT(S)
>
>>>>>eth0                  ??        192.168.254.2

#INTERFACE         SOURCE         ADDRESS
eth0:10.0.0.0/8    -              192.168.254.2

-Tom
-- 
Tom Eastep        \ When I die, I want to go like my Grandfather who
Shoreline,         \ died peacefully in his sleep. Not screaming like
Washington, USA     \ all of the passengers in his car
http://shorewall.net \________________________________________________

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Shorewall-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-users

Reply via email to