Re: Problem z routingiem.
On Mon, Sep 26, 2005 at 01:12:07AM +0200, Wójciak wrote:
> Miroslaw Kwasniak napisał(a):
> >To pozostają wg mnie następujące możliwości:
> >- klienci mają firewalle
>
> Nie.
>
> >- klienci nie mają maski 255.255.255.0
>
> Mają dobre maski.
>
> >- klienci nie wiedzą gdzie routować do "sąsiedniej posieci"
>
> Do defaulta?
>
> >- na serwerze wyciąłeś w iptables
>
> Nie, wyczyściłem wszystkie regułki.
A default policy jest DROP ???
Może routing na serwerze jest pokopany? Albo NAT.
Przyjrzyj się dokładnie co pokazuje "ip route list", a jak nie pomoże to
"ip route list table all".
Nie pomyliłeś przypadkiem interfejsów (eth1<->eth0), kolega z tym walczył
dwa dni temu ;)
> >
> >Narzędzia do diagnostyki :)
> >- na kliencie ping (jak windows to batch w pętli)
> >- tcpdump na obu interfejsach
>
> 01:04:59.979446 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto:
> ICMP (1), length: 84) 10.0.0.22 > 192.168.1.2: ICMP echo request, id
> 5170, seq 1, length 64
Dobrze by było użyć 'tcpdump -e ...' i popatrz do kogo (jaki MAC) to
naprawdę idzie.
> To wszystki co otrzymuje cyklicznie co sekundę. Na docelowym interfejsie
> cisza :(
>
> >- watch "iptables ...."
>
> A to nie wiem co to takie... Muszę się wgryźć bardziej w doce.
Myślałem, że zaskoczysz :) Sam używałem protezek, ale ponieważ .bash_history
mi się przepełnia, to zrobiłem skrypcik 'iptables.watch' (w załączniku). O to
jego help:
$ iptables.watch -h
iptables.watch version 0.03, Mon Sep 26 12:48:24 CEST 2005
(c) Miroslaw Kwasniak, licence GPL 2.0
Displays only active chains/rules in iptables
Usage:
iptables.watch -h
iptables.watch [-o ipt_options] [-ns] [-w width] [-W|-Wd] [-Z] [table [table ...]]
-h : this help
-o ipt_options : iptables options, default = --line-numbers -vxnL
-ns : no squeeze spaces
-w width : display width, default = ${COLUMNS:-80}
-W : display via 'watch', default = to stdout
-Wd : display via 'watch -d'
-Z : zero iptables counters
[table [table ..]] : list only specified tables, default = `cat /proc/net/ip_tables_names`
uses: iptables, grep, sed, cat, cut and (optionally) watch
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To potrzebne programy
Proponuję wystartować "iptables.watch -Z -Wd".
Jeżeli jesteś w stanie wyłączyć inny ruch, to już z krótkiej obserwacji
łatwo wywnioskujesz gdzie grzęźnie ping.
> >W pięć minut problem rozwiążesz ;)
>
> Dzięki za wiarę we mnie, ale chyba przeceniasz moje zdolności ;)
Swoje też za często przeceniam :(
#
# Script is in bash but don't use '#!/bin/bash' and use 'kill -SIGWINCH $$'
# This is '$COLUMNS' workaround, at least with Debian bash_2.05b-26
#echo COLUMNS $COLUMNS
kill -SIGWINCH $$; # without this 'kill' $COLUMNS are undefined in script
#echo COLUMNS $COLUMNS;exit
#------------------------------------------------------
# Usage
help ()
{
cat <<EOF
iptables.watch version 0.03, Mon Sep 26 12:48:24 CEST 2005
(c) Miroslaw Kwasniak, licence GPL 2.0
Displays only active chains/rules in iptables
Usage:
iptables.watch -h
iptables.watch [-o ipt_options] [-ns] [-w width] [-W|-Wd] [-Z] [table [table ...]]
-h : this help
-o ipt_options : iptables options, default = --line-numbers -vxnL
-ns : no squeeze spaces
-w width : display width, default = \${COLUMNS:-80}
-W : display via 'watch', default = to stdout
-Wd : display via 'watch -d'
-Z : zero iptables counters
[table [table ..]] : list only specified tables, default = \`cat /proc/net/ip_tables_names\`
uses: iptables, grep, sed, cat, cut and (optionally) watch
EOF
}
#------------------------------------------------------
# Parameters
while [ $# -gt 0 ] ;do
case "$1" in
-o) IPT_OPT="$2"; shift 2;;
-ns) SQEEZE=false; shift ;;
-w) WIDTH="$2"; shift 2;;
-W) WATCH=watch; shift ;;
-Wd) WATCH="watch -d"; shift ;;
-Z) ZERO=true; shift ;;
-h) help; exit ;;
-*) echo "error $*"; help; exit 1;;
*) TABLES="$*"; break;;
esac
done
#------------------------------------------------------
# Defaults
exec 2>&1
COLUMNS=${COLUMNS:-80}
WIDTH=${WIDTH:-$COLUMNS}
SQEEZE=${SQEEZE:-true}
ZERO=${ZERO:-false}
IPT_OPT=${IPT_OPT:---line-numbers -vxnL}
TABLES="${TABLES:-`cat /proc/net/ip_tables_names`}"
#------------------------------------------------------
# Functions
list_table ()
{
set -e
exec 2>&1
local w="$1"
local o="$2"
local t="$3"
iptables -t "$t" $o |
grep -v ' 0 *0 \|^$\|pkts *bytes *target' |
sed "s/^Chain /Chain $t:/;$CSQEEZE" |
cut -c1-"$w"
}
list_iptables ()
{
set -e
exec 2>&1
local t
for t in $TABLES; do
list_table "$WIDTH" "$IPT_OPT" "$t"
done |
sed '
/^Chain .*\(references\| 0 packets\)/{
:A
${ /^Chain .*\(references\| 0 packets\).*$/{ d } }
N
/\nChain /{ s/^.*\n//; bA }
}
'
}
set_CSQEEZE()
{
local h="`iptables $IPT_OPT INPUT|head -2|tail -1`"
h=${h/target*/}
h=${#h}
CSQEEZE="h;s/^\(.\{$h,$h\}\).*/\1/;x;s/^\(.\{$h,$h\}\)//;s/ \+/ /g;x;G;s/\n//"
}
#------------------------------------------------------
# Run it
$SQEEZE && set_CSQEEZE
#echo CSQEEZE="$CSQEEZE" $SQEEZE $WIDTH $COLUMNS;list_table "$WIDTH" "$IPT_OPT" nat;exit
export -f list_iptables list_table
export IPT_OPT WIDTH TABLES CSQEEZE
$ZERO && for t in $TABLES; do iptables -t "$t" -Z; done
$WATCH list_iptables
Reply to: