public inbox for lartc@vger.kernel.org
 help / color / mirror / Atom feed
* reroute icmp traffic from one interface to another
@ 2016-05-31 14:13 Ηλια Χατζηστυλη
  2016-05-31 15:40 ` Andy Furniss
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ηλια Χατζηστυλη @ 2016-05-31 14:13 UTC (permalink / raw)
  To: lartc


Hello,
I have an openwrt firmware installed in my router and I want to  
configure a Home and a Guest interface.
So I have two internal interfaces(home,guest) and the external(eth1).  
First I have to send all traffic from the two internal  
interfaces(wlan0,wlan0-1) to external(eth1). With my project I have to  
measure latency so I use nping. However when I use the command
"sudo nping -c 3200 --data-length 1460  x.x.x.x" with network seted to  
upload bandiwidth 2Mbps and with data length 1460 B (1460*8\x11740) we  
expect minimum delay 11740/2000000=5.8ms . Nonetheless, the avg ping  
time is about 0.8-3 ms which means that my iptables commands doesn't  
work properly for the ping traffic (icmp type). Do you know how I can  
route this traffic with the tcp one? I'm pretty sure that icmp traffic  
is enqueued because when the home user is uploading a file nping  
command takes out the proper delay.

Thank you in advance,
Chatzistyli Ilia

My code is:

#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org

echo "Starting bandwidth shaping"
IPT=/usr/sbin/iptables
IF=eth1
#interface home user
IFHU=wlan0
#interface guest user
IFGU=wlan0-1
IP="$(ifconfig eth1 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' '  
-f 1)"    # IP eth1 Interface
IPHU\x192.168.5.1
IPGU\x192.168.3.1



$IPT -t filter -F
$IPT -t filter -X
$IPT -t nat -F
$IPT -t nat -X
$IPT -t mangle -F
$IPT -t mangle -X
$IPT -t raw -F
$IPT -t raw -X
# Default Policies fuer integrierte Ketten festlegen:

$IPT -t nat -P PREROUTING ACCEPT
$IPT -t nat -P POSTROUTING ACCEPT
$IPT -t nat -P OUTPUT ACCEPT
$IPT -t filter -P INPUT ACCEPT
$IPT -t filter -P FORWARD ACCEPT
$IPT -t filter -P OUTPUT ACCEPT

#----------send wlan0-1 & wlan0 to eth1
         echo "iptables interface traffic redirect"
         iptables -t nat -A POSTROUTING --out-interface $IF -j MASQUERADE
         iptables -A FORWARD --in-interface $IFHU -j CLASSIFY --set-class 2:1
         iptables -A FORWARD --in-interface $IFGU -j CLASSIFY --set-class 2:2
#here i tryed to add -p icmp --icmp-type any etc or -p any but still  
had the same problem.
         echo "end of iptables"

#--------------------------------------


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

end of thread, other threads:[~2016-06-01 16:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-31 14:13 reroute icmp traffic from one interface to another Ηλια Χατζηστυλη
2016-05-31 15:40 ` Andy Furniss
2016-05-31 23:40 ` Ηλια Χατζηστυλη
2016-06-01 16:45 ` Andy Furniss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox