Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there any way to tell if the computer you are currently working on is connected to a switch (edit: before it goes to a router and the internet)? Preferable on Linux, but I'm interested in answers for Mac and Windows as well.

Of course tracing the cable doesn't count.

share|improve this question
    
Is this just for curiosity's sake or are you trying to answer another question? –  Stephen Jennings Oct 17 '09 at 23:51
    
Mostly for curiosities sake. I just recently learning how find a MAC address by IP (arp -a) and now I'm wondering if it can be applied to switches as well. –  Jason Axelson Oct 17 '09 at 23:57
add comment

2 Answers 2

up vote 2 down vote accepted

You could open Wireshark and look for any network activity. This will work on Linux, Windows and Mac.

share|improve this answer
    
I may not have been clear enough in my original question so I've clarified it a bit. I've used Wireshark before and I'm not sure how it would help me see if I'm connected to a switch before the router (and eventually the internet at large). –  Jason Axelson Oct 17 '09 at 23:42
1  
If you see traffic not from or to the computer you're running Wireshark on, then you're connected to a hub. If you don't, then you're either alone on your subnet, nobody else is sending data, or you're connected to a switch. –  Stephen Jennings Oct 17 '09 at 23:46
    
Ah, in that case - if it's a managed switch - you could perhaps try to throw some SNMP at it (e.g., with net-snmp). However, this requires knowing the switch's IP address, so it's probably not very useful... However, if you know the router's IP, you could perhaps ping it with a time-to-live (hop-limit) of 1; if there's no reply then there may be a switch in the "middle". I've not tested this, so it may not work! –  sblair Oct 17 '09 at 23:58
    
Correct me if I'm wrong, but I think that using Wireshark you wouldn't see any extra traffic if you are connected to a switch that is connected to a router and if you connect directly to a router. Is that correct? –  Jason Axelson Oct 17 '09 at 23:59
    
You might see some "maintenance" messages sent from the switch, such as messages for the spanning tree protocol. But it would obviously depend on the switch. –  sblair Oct 18 '09 at 0:17
add comment

On the command line

ip l

shows something like

2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether 00:19:db:ba:76:37 brd ff:ff:ff:ff:ff:ff

where NO-CARRIER indicates detachment from the switch.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.