-1

Setup: I have 4 Raspberry Pis at home interconnect via a switch (normal router) in my home network. Now I can access them on my pc and use SSH.

What do I want: I want to write a python script that automatically reconfigures the network topology of my little "cluster". Physically, they are all interconnected but I want to configure the nodes such that, let's say, they communicate in a ring topology where 1 -> 2 -> 3 -> 4 -> 1. Other topologies are also possible.

Purpose: I can then easily reconfigure the network topology and then test distributed applications on the cluster and see how they behave.

Question: To start, I would like to know which config files I have to touch in Linux to reconfigure the network topology? I know Linux but I am not an expert so I would be very happy to collect some tipps. A good idea would be to manually configure it by hand at first, and then later I can use my script. My idea is, as an example, to add routing table entries on each node of the cluster, such that node x forwards an incoming packet, depending on its source and destination node, to the next hop. With all the new routing/forwarding, I can then establish a new network topology. E.g., in a ring topology, node 1 has to forward its packet to node 2 if it wants to send it to node 3. So there is one extra node/hop inbetween.

XHotSniperX
  • 712
  • 7
  • 25
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Dec 03 '17 at 22:40
  • @jww I am sorry about that. My question was not complete and I edited it now. I know, it's not a programming question but it is about developing a Python library that can automatically configure the network topology of a linux cluster. – XHotSniperX Dec 04 '17 at 15:11

1 Answers1

0

With a single switch, Ethernet uses a star topology physically. Logically, it's a bus.

You don't need to rearrange anything since each host can talk to any other without any restrictions.

If you really want to inhibit communication other than following the indicated ring, you'd need to filter unwanted connections. There are various ways to realize that but without the reason behind it it's hard to say which one's right.

Zac67
  • 2,761
  • 1
  • 10
  • 21
  • Thank you very much. I just edited my question. I thought of ring, star and tree topologies. First I should configure it by hand manually, but later I want to write a Python script that automatically configures the cluster. Do you know which config files I need to touch and edit? – XHotSniperX Dec 04 '17 at 15:14
  • Don't overcomplicate it. Just use the cluster in the ways you want and set up the software you're working with in the desired topology. Ethernet is a star (or tree) but it will also work excellently when the data flows are following a ring topology. – Zac67 Dec 04 '17 at 17:53
  • My purpose is to test distributed applications on different network topologies. So I want different topologies. And with the script, others can then easily configure linux clusters. – XHotSniperX Dec 04 '17 at 21:41