From: "Holger" Date: Sat, 08 May 2004 22:02:45 +0000 Subject: [LARTC] Dual Multipath DSL Script Problem! Message-Id: <001f01c43548$362db8a0$0314a8c0@de> MIME-Version: 1 Content-Type: multipart/mixed; boundary="----=_NextPart_000_001C_01C43558.F51980E0" List-Id: To: lartc@vger.kernel.org This is a multi-part message in MIME format. ------=_NextPart_000_001C_01C43558.F51980E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello! I had found a script to multipath DSL connections: http://linux.com.lb/beta/index.pl?node=3DLoad%20Balancing%20Across%20Mult= iple%20Links I have made some modifications, but in second part of this mail are some = errors: __________________________________________________________________ First the script: __________________________________________________________________ #!/bin/bash # iptables userspace executable=20 iptables=3D"/usr/local/sbin/iptables"=20 # Internal Interface=20 NET_INT_INT=3Deth0=20 # Internal IP=20 NET_INT_IP=3D192.168.20.1 # Internal Subnet=20 NET_INT_SUB=3D24=20 # Internal Network=20 NET_INT_NET=3D192.168.20.0=20 # First external interface=20 NET_EXT_INT1=3Deth1=20 # First external IP=20 NET_EXT_IP1=3D192.168.21.1=20 # First external interface's gateway=20 NET_EXT_GW1=3D192.168.21.2 # Second external interface=20 NET_EXT_INT1=3Deth2=20 # Second external IP=20 NET_EXT_IP1=3D192.168.22.1=20 # Second external interface's gateway=20 NET_EXT_GW1=3D192.168.22.2=20 echo "Flushing All Tables"=20 iptables -F=20 iptables -F -t nat=20 iptables -F -t mangle=20 iptables -X -t nat=20 iptables -X -t mangle=20 iptables -X=20 echo "Mangle eth1"=20 iptables -t mangle -N eth1=20 iptables -t mangle -F eth1=20 iptables -t mangle -A eth1 -p tcp -j LOG --log-prefix " MANGLE_TCP_ETH1 = "=20 iptables -t mangle -A eth1 -p icmp -j LOG --log-prefix " = MANGLE_ICMP_ETH1 "=20 iptables -t mangle -A eth1 -j MARK --set-mark 1=20 echo "Mangle eth2"=20 iptables -t mangle -N eth2=20 iptables -t mangle -F eth2=20 iptables -t mangle -A eth2 -p tcp -j LOG --log-prefix " MANGLE_TCP_ETH2 = "=20 iptables -t mangle -A eth2 -p icmp -j LOG --log-prefix " = MANGLE_ICMP_ETH2 "=20 iptables -t mangle -A eth2 -j MARK --set-mark 2=20 echo "NAT"=20 iptables -t nat -N SPOOF_ETH1=20 iptables -t nat -F SPOOF_ETH1=20 iptables -t nat -A SPOOF_ETH1 -j LOG --log-prefix " SPOOF_ETH1 "=20 iptables -t nat -A SPOOF_ETH1 -j SNAT --to-source $NET_EXT_IP1=20 iptables -t nat -N SPOOF_ETH2=20 iptables -t nat -F SPOOF_ETH2=20 iptables -t nat -A SPOOF_ETH2 -j LOG --log-prefix " SPOOF_ETH2 "=20 iptables -t nat -A SPOOF_ETH2 -j SNAT --to-source $NET_EXT_IP2 echo "Setting some local network rules..."=20 iptables -A INPUT -p icmp -s $NET_INT_NET/$NET_INT_SUB -d $NET_INT_IP -j = ACCEPT=20 echo "Setting Mangle rules for eth1..."=20 iptables -t mangle -A OUTPUT -o ! $NET_INT_INT -m random --average 50 -j = eth1=20 iptables -t mangle -A PREROUTING -i $NET_INT_INT -m random --average 50 = -j eth1=20 ip ro add default via $NET_EXT_GW1 dev $NET_EXT_INT1 table 10 ip ru add fwmark 1 table 10=20 ip ro fl ca=20 echo "Setting Mangle rules for eth2..."=20 iptables -t mangle -A OUTPUT -o ! $NET_INT_INT -m random --average 50 -j = eth2=20 iptables -t mangle -A PREROUTING -i $NET_INT_INT -m random --average 50 = -j eth2=20 ip ro add default via $NET_EXT_GW2 dev $NET_EXT_INT2 table 20 ip ru add fwmark 2 table 20=20 ip ro fl ca=20 echo "Setting up spoofing rules..."=20 iptables -t nat -A POSTROUTING -o $NET_EXT_INT1 -j SPOOF_ETH1=20 iptables -t nat -A POSTROUTING -o $NET_EXT_INT2 -j SPOOF_ETH2=20 echo "Adding default route..."=20 ip ro add default nexthop via $NET_EXT_GW1 dev $NET_EXT_INT1 weight 1 = nexthop via $NET_EXT_GW2 dev $NET_EXT_INT2 weight 1=20 echo "Disabling Reverse Path Filtering..."=20 echo 0> /proc/sys/net/ipv4/conf/eth1/rp_filter=20 echo 0> /proc/sys/net/ipv4/conf/eth2/rp_filter=20 echo "Enabling IPv4 Packet forwarding..."=20 echo "1"> /proc/sys/net/ipv4/ip_forward=20 __________________________________________________________________ Second the errors: __________________________________________________________________ debian:~/script# sh natfilter=20 Flushing All Tables=20 Mangle eth1=20 Mangle eth2=20 NAT=20 iptables v1.2.6a: Unknown arg `--to-source'=20 Try `iptables -h' or 'iptables --help' for more information.=20 Setting some local network rules...=20 Setting Mangle rules for eth1...=20 Setting Mangle rules for eth2...=20 Error: an inet address is expected rather than "dev".=20 Setting up spoofing rules...=20 Warning: weird character in interface `-j' (No aliases, :, ! or *).=20 Bad argument `SPOOF_ETH2'=20 Try `iptables -h' or 'iptables --help' for more information.=20 Adding default route...=20 Error: an IP address is expected rather than "dev"=20 Disabling Reverse Path Filtering...=20 Enabling IPv4 Packet forwarding... __________________________________________________________________ Thank you very much! Direct contact: fte112 (at) gmx.de ------=_NextPart_000_001C_01C43558.F51980E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello!
 
I had found a script to multipath DSL=20 connections:
 
http://linux.com.lb/beta/index.pl?node=3DLoad%20Bal= ancing%20Across%20Multiple%20Links
 
I have made some modifications, but in = second part=20 of this mail are some errors:
 
__________________________________________________________________
 
First the script:
__________________________________________________________________
 
#!/bin/bash
 

# iptables userspace executable =
iptables=3D"/usr/local/sbin/iptables"=20
 
# Internal Interface
NET_INT_INT=3Deth0
 
# Internal IP
NET_INT_IP=3D192.168.20.1
 
# Internal Subnet
NET_INT_SUB=3D24
 
# Internal Network
NET_INT_NET=3D192.168.20.0
 
# First external interface
NET_EXT_INT1=3Deth1
 
# First external IP
NET_EXT_IP1=3D192.168.21.1
 
# First external interface's gateway =
NET_EXT_GW1=3D192.168.21.2
 
# Second external interface
NET_EXT_INT1=3Deth2
 
# Second external IP
NET_EXT_IP1=3D192.168.22.1
 
# Second external interface's gateway =
NET_EXT_GW1=3D192.168.22.2
 
echo "Flushing All Tables"
iptables -F
iptables -F -t nat=20
iptables -F -t mangle
iptables -X -t nat
iptables -X -t = mangle=20
iptables -X
 
echo "Mangle eth1"
iptables -t mangle -N eth1
iptables -t = mangle -F=20 eth1
iptables -t mangle -A eth1 -p tcp -j LOG --log-prefix " = MANGLE_TCP_ETH1=20 "
iptables -t mangle -A eth1 -p icmp -j LOG --log-prefix " = MANGLE_ICMP_ETH1=20 "
iptables -t mangle -A eth1 -j MARK --set-mark 1
 
echo "Mangle eth2"
iptables -t mangle -N eth2
iptables -t = mangle -F=20 eth2
iptables -t mangle -A eth2 -p tcp -j LOG --log-prefix " = MANGLE_TCP_ETH2=20 "
iptables -t mangle -A eth2 -p icmp -j LOG --log-prefix " = MANGLE_ICMP_ETH2=20 "
iptables -t mangle -A eth2 -j MARK --set-mark 2
 
echo "NAT"
iptables -t nat -N SPOOF_ETH1
iptables -t nat -F = SPOOF_ETH1
iptables -t nat -A SPOOF_ETH1 -j LOG --log-prefix " = SPOOF_ETH1 "=20
iptables -t nat -A SPOOF_ETH1 -j SNAT --to-source $NET_EXT_IP1 =
 
iptables -t nat -N SPOOF_ETH2
iptables -t nat -F SPOOF_ETH2=20
iptables -t nat -A SPOOF_ETH2 -j LOG --log-prefix " SPOOF_ETH2 "=20
iptables -t nat -A SPOOF_ETH2 -j SNAT --to-source $NET_EXT_IP2
 
echo "Setting some local network rules..."
iptables -A INPUT -p = icmp -s=20 $NET_INT_NET/$NET_INT_SUB -d $NET_INT_IP -j ACCEPT
 
echo "Setting Mangle rules for eth1..."
iptables -t mangle -A = OUTPUT -o=20 ! $NET_INT_INT -m random --average 50 -j eth1
iptables -t mangle -A=20 PREROUTING -i $NET_INT_INT -m random --average 50 -j eth1
ip ro add = default=20 via $NET_EXT_GW1 dev $NET_EXT_INT1 table 10
ip ru add fwmark 1 table = 10=20
ip ro fl ca
 
echo "Setting Mangle rules for eth2..."
iptables -t mangle -A = OUTPUT -o=20 ! $NET_INT_INT -m random --average 50 -j eth2
iptables -t mangle -A=20 PREROUTING -i $NET_INT_INT -m random --average 50 -j eth2
ip ro add = default=20 via $NET_EXT_GW2 dev $NET_EXT_INT2 table 20
ip ru add fwmark 2 table = 20=20
ip ro fl ca
 
echo "Setting up spoofing rules..."
iptables -t nat -A = POSTROUTING -o=20 $NET_EXT_INT1 -j SPOOF_ETH1
iptables -t nat -A POSTROUTING -o = $NET_EXT_INT2=20 -j SPOOF_ETH2
 
echo "Adding default route..."
ip ro add default nexthop via=20 $NET_EXT_GW1 dev $NET_EXT_INT1 weight 1 nexthop via $NET_EXT_GW2 dev=20 $NET_EXT_INT2 weight 1
 
echo "Disabling Reverse Path Filtering..."
echo 0>=20 /proc/sys/net/ipv4/conf/eth1/rp_filter
echo 0>=20 /proc/sys/net/ipv4/conf/eth2/rp_filter
 
echo "Enabling IPv4 Packet forwarding..."
echo "1">=20 /proc/sys/net/ipv4/ip_forward
 
__________________________________________________________________
 
Second the errors:
__________________________________________________________________
 
debian:~/script# sh natfilter

Flushing All Tables =

Mangle=20 eth1

Mangle eth2

NAT
iptables v1.2.6a: Unknown arg=20 `--to-source'
Try `iptables -h' or 'iptables --help' for more = information.=20

Setting some local network rules...

Setting Mangle rules = for=20 eth1...

Setting Mangle rules for eth2...
Error: an inet = address is=20 expected rather than "dev".

Setting up spoofing rules... =
Warning:=20 weird character in interface `-j' (No aliases, :, ! or *).
Bad = argument=20 `SPOOF_ETH2'
Try `iptables -h' or 'iptables --help' for more = information.=20

Adding default route...
Error: an IP address is expected = rather than=20 "dev"

Disabling Reverse Path Filtering...


Enabling = IPv4=20 Packet forwarding...
 
__________________________________________________________________
 
Thank you very much!
 
Direct contact: fte112 (at)=20 gmx.de
------=_NextPart_000_001C_01C43558.F51980E0-- _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/