All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Schmieg <jonathan.schmieg@triplex.de>
To: lartc@vger.kernel.org
Subject: [LARTC] routing problems with two SDSL-connections
Date: Wed, 13 Jul 2005 14:25:51 +0000	[thread overview]
Message-ID: <42D5246F.80303@triplex.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 1118 bytes --]


Hello List,


in our office we have two independant SDSL-connections.
One of them is a flatrate, the other is a dedicated line to our webfarm.
The goal is to route all the traffic to the webfarm through the
dedicated line and all other traffic through the flatrate.
The maschine has three nics:
eth0: internal network
eth1: webfarm
eth2: flatrate
Each connection uses its own router. It is possible to access the
internet through both connections, for example with ping -I interface
address.
I wrote an script for the issue mentioned above:
please take a look at the attachment
The whole thing works great under Knoppix, but neither with gentoo, nor
with debian sarge (I want to use debian sarge for the router).
Just for testing I took another maschine with gentoo and there it also
works. (same kernel-, same iptables-, same iproute2-versions and also
the same nics)
With tcpdump I can see that packets sent by a client from the internal
network leave the gateway, the answer comes back but is not passed on
the the client.
I hope somebody has an idea how I could solve the problem,

greetings,
Jonathan Schmieg




[-- Attachment #2: script.sh --]
[-- Type: text/plain, Size: 2087 bytes --]

#!/bin/sh

## Variablen
GATEWAY_DEF=X.X.X.25
GATEWAY_T2=Y.Y.Y.177
IP_T2=Y.Y.Y.180
IFACE_INT=eth0

## Kernelparameter
echo "1" > /proc/sys/net/ipv4/conf/all/forwarding

############
## Status ##
############
if [ "$1" = "status" ]
then
        echo "Default Route"\n
        ip route show
        echo "Spacenet Route"\n
        ip route show table 2
        echo "Rules"\n
        ip rule show
        echo "Markierungen"\n
        iptables -t mangle -L ROUTING -v -x 2> /dev/null
        exit
fi

##########
## Stop ##
##########
iptables -t mangle -D PREROUTING -j ROUTING 2> /dev/null > /dev/null
iptables -t mangle -D FORWARD -j ROUTING 2> /dev/null > /dev/null
iptables -t mangle -F ROUTING 2> /dev/null > /dev/null
iptables -t mangle -X ROUTING 2> /dev/null > /dev/null

ip route del table 2
ip route del default via $GATEWAY_DEF
ip rule del from $IP_T2 table 2
ip rule del fwmark 66 table 2
ip route flush cache

if [ "$1" = "stop" ]
then
        echo "Routing removed"
        exit
fi

###########
## Start ##
###########

## 2. Tabelle anlegen
ip route show table main | grep -Ev ^default | while read ROUTE ; do ip route add table 2 $ROUTE; done
ip route add default via $GATEWAY_T2 table 2

## Defaultgw setzen
ip route add default via $GATEWAY_DEF

##Routing regeln setzen
ip rule add from $IP_T2 table 2

ip route flush cache
ip rule add fwmark 66 table 2

##Iptables Tabelle anlegen
iptables -t mangle -N ROUTING
iptables -t mangle -I PREROUTING -j ROUTING
iptables -t mangle -I FORWARD -j ROUTING

## Markieren Kleinwebs
iptables -t mangle -A ROUTING  -i $IFACE_INT -p all -d Y.Y.A.0/24 -j MARK --set-mark 66

## Markieren KUNDE
iptables -t mangle -A ROUTING  -i $IFACE_INT -p all -d Y.Y.B.0/24 -j MARK --set-mark 66

## Markieren Maintanace
iptables -t mangle -A ROUTING  -i $IFACE_INT -p all -d 192.168.100.0/24 -j MARK --set-mark 66

## NAT setzen / passiert aber normal in der Firewall  :) 
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.10.0/24 -j SNAT  --to-source Y.Y.Y.180
iptables -t nat -A POSTROUTING -o eth2 -s 192.168.10.0/24 -j SNAT --to-source X.X.X.30


[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

                 reply	other threads:[~2005-07-13 14:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42D5246F.80303@triplex.de \
    --to=jonathan.schmieg@triplex.de \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.