LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   working of a switch (https://www.linuxquestions.org/questions/linux-networking-3/working-of-a-switch-577715/)

anil_mnnit06 08-17-2007 02:27 AM

working of a switch
 
i m having doubts regarding workin of a switch........

suppose there are four ports p1,p2,p3,p4........
each oh which is connected to node A,B,C,D respectively.....

intially the swicthing table maintain by the switch will have no entry,
so when packets come for A ,it will be send to each of the nodes.
but as it keeps on recieving packets and after delievring...it make the entry that on which port which node is connected by storing it MAC addresses.....
nxt time when packets come for A, it will be send directly to A...
switching table is mainatin for a particaulr time period also..
i hop upto this much i m correct.......if any where i hav gone then
plzz tell...i m a beginner..


now suppose within this time period i interchange the node A and B
i.e port p1 is conneccted to B, and port p2 is connected to A

now if packets comes for A ....
then who will be recieving the packets A or B ......???

bigearsbilly 08-17-2007 02:41 AM

I should imagine as it's netwok infrastructure it is
sending to the MAC address of it's clients, it don't care
what physical port it is on

anil_mnnit06 08-17-2007 09:50 AM

what do you mean by network infrastructure..........could you plzz elaborte little more.......
i was not able to get your point...
has it any thing to do with IP address..........?????

bigearsbilly 08-17-2007 09:59 AM

i'm sure there's something here ...
http://en.wikipedia.org/wiki/Network...ss_translation
http://en.wikipedia.org/wiki/Network_switch

no it doesn't care about IP addresses (AFAIK)
it just routes packets on their MAC address, i.e. their unique hardware
address. All equipment,(e.g. a network card) has a unique address.
this is like the IP address within the local network.

joemadeus 08-19-2007 10:38 AM

Actually, neither of those wikipedia pages mention infrastructure. I'm curious to hear the answer of the original poster's question, too, since I'm trying to get a Debian box running with two Ethernet devices and a wireless card on the lan side, plus another Ethernet device for the wan side (connected to a cable modem.) I want the box to behave like a switch. I have iptables up and running with port forwarding, but the arp tables seem to get screwed up with more than one device attached (they're all using static IPs on 198.168.0.0/24)

I was told that I need to set up the lan-side devices as infrastructure ports (or switch ports) but using the word "switch" in just about any search engine you come across (including the one here) doesn't give me what I need.

Would you mind updating the wikipedia entries, or adding some info here so I can do it? (with your permission, of course.)

Thanks!


-j

joemadeus 08-22-2007 08:48 AM

Bump -- Any info on creating (if I need to) switch ports using a debian distro? Thanks.


-j

farslayer 08-22-2007 11:49 AM

A switch creates an mac-address-table that lists all the connected devices and what ports they are on by passively listening to the traffic it is passing.

If the switch does not find the mac address it is looking for (in your example the hosts were moved to different ports) teh switch or NIC on the sending PC can do an arp-broadcast and ASK who owns mac address xxxxxx. the NIC owning that address will reply and the mac-address-table will be updated. the switch can then forward the packet to the appropriate device.

It's also possible with spanning-tree enabled on the switch that when you swap the hosts those ports will begin the spanning-tree process and learn the mac-addresses of the connected hosts at that time and the table will be updated before the switch allows those ports to start forwarding traffic again. Cisco: How spanning tree works

sometimes the arp cache will not update soon enough (common on Cisco Routers) and connectivity issues will be a problem until you forcefully clear the arp-cache / mac-addresss-table or wait up to a half hour in some cases for it to happen automatically.

joemadeus 08-22-2007 10:20 PM

Farslayer, thanks for the info. Have you been able to create a switch using standard PC hardware and a Debian distro? (I noticed that you mentioned sid & etch in your personal info.) I assume I don't even need to define an interface for the two lan-side ethernet ports (i.e., no entry in /etc/network/interfaces) which means no ip address, etc.. Any tutorials, docs, howtos, etc. that you know of?

Thanks again.


-j

farslayer 08-22-2007 11:31 PM

Never done that.. it's cheaper to just buy a switch these days.

Well a bridge is basically a two port switch, so look into setting up a bridge, A switch is basically a bridge with more than two ports...

I would suggest you start by looking at the Bridge how-to http://linux-net.osdl.org/index.php/Bridge

best recommendation I can make to you if you want to pursue making your own switch.

joemadeus 08-23-2007 08:51 AM

Thanks -- good point re: setting up a bridge. You're right, of course, I gain nothing by building my own. It was mostly for the learning exercise.


-j


All times are GMT -5. The time now is 05:20 PM.