1 |
Am Dienstag, 14. März 2006 19:24 schrieben Sie: |
2 |
> I created the script as you suggested, and when I executed it ALL the |
3 |
> lights on the ports that have connections go nuts |
4 |
|
5 |
Okay, your switches are layer 2 switches, not layer 3 switches then... (they |
6 |
don't understand IP traffic, only ethernet traffic; a broadcast ping is a |
7 |
broadcast ethernet packet which gets forwarded to every port by a layer 2 |
8 |
switch). I didn't think of that when I sent out the snippet; our switches are |
9 |
layer 3 switches, and they won't forward packets between different network |
10 |
segments, even when they are in the same ethernet segment. |
11 |
|
12 |
But, you can still make this work if you have two computers connected to the |
13 |
network, one which you know the switch port and IP of. |
14 |
|
15 |
Your setup should look something like this: |
16 |
|
17 |
------------------------------------ |
18 |
| Switch | |
19 |
--|------------------------------|-- |
20 |
Port 1 (192.168.0.1) Port x (your Laptop, fixed at 192.168.123.45, |
21 |
some address not on your network) |
22 |
|
23 |
Port 1 mustn't necessarily be port 1, may also be any other port, just as you |
24 |
may use any other IP you know. |
25 |
|
26 |
Then, try the following: |
27 |
|
28 |
#!/bin/sh |
29 |
# Set up networking, adjust to fit your network. |
30 |
ifconfig $1 192.168.123.45 netmask 255.255.0.0 broadcast 192.168.255.255 |
31 |
|
32 |
# Standard loop. |
33 |
while true |
34 |
do |
35 |
ping -f -w $2 192.168.0.1 # Your known host IP |
36 |
sleep $2 |
37 |
done |
38 |
|
39 |
When you call this script (just as before), only those two ports which are |
40 |
present in the diagram above should start to fire (and sleep), and as you |
41 |
know one of them, the other can't be hard to actually discern from the rest |
42 |
of the ports on the switch. |
43 |
|
44 |
If the above doesn't work, there are other ways which involve creating |
45 |
ethernet packets with invalid recipient address at high speeds which |
46 |
shouldn't get forwarded by a layer 2 switch, but these involve a little more |
47 |
trickery than a small shell script. I'd be happy to write a little |
48 |
Python-Program which does just this, but before I do, test the above. ;-) |
49 |
|
50 |
-- |
51 |
--- Heiko. |
52 |
|
53 |
-- |
54 |
gentoo-user@g.o mailing list |