Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have to develop a project for the university. It has to do with complex routing.
I have one linux box with one Ethernet interface, a Layer 2 switch with 801.1q (VLAN) support and four routers. Each router has four Ethernet ports. The Linux box and the routers are connected to the switch.
Is it possible to route traffic from the linux box interface to a specific router interface and vice-versa only by configuring the linux box and the switch? What is the best way to achieve this purpose?
I thought about using VLANs (one for each router interface) but I have some doubts...
Ok, so, correct me if I'm wrong, I enable different aliases on the interface and then I configure the switch to route the traffic based on the source IP address (in case of packets coming from the linux box) or the port (in case of packets coming from one of the routers' interfaces).
Switches do not perform routing as they operate at layer 2 (apart from layer3 switches) in your case the linux box will be able to get to all the routers as it will have an ip address in all of the router ranges.
Just using a suitable route table may work, however if routers are running Linux it may reach the wrong interface of the correct router. Static neighbour (ARP) cache entries will solve that.
Using VLANs is a robust solution given a suitable switch, and will work even if the routers misbehave.
The routers are the question mark: the project is somewhat generic about the router specs. The whitepaper only says it has an integrated 4-port switch (not VLAN-aware) and a WAN Ethernet port. All four ports are connected to the main switch (VLAN-aware).
I was thinking about pros and cons of the two approaches and the subtle questions I may be facing during the exam... something like this: "suppose all four routers are of the same subnet: how can I route packets?"
I guess the best way is to create sixteen VLANs, one for each router interface (4 routers, 4 ports each). Both the linux box and the main switch are VLAN-aware so I can send traffic over the unique interface I have available on the linux box. I should statically bind sixteen ports on the switch to the router interfaces so that each router interface gets bounded to a specific VLAN. Packets routing between VLANs should be managed on the routers' switches. Unfortunately this way I can route traffic only for groups of four interfaces...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.