LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   separating networks connected through the same switch (https://www.linuxquestions.org/questions/linux-networking-3/separating-networks-connected-through-the-same-switch-905102/)

dave247 09-26-2011 01:23 PM

separating networks connected through the same switch
 
Hey. I am working on a networking research project and trying to increase my understanding in some areas.

I have a Linux dhcp server connected to a single 24-port switch. The dhcp server is 150.50.0.1. I would like to serve ip addresses to computers in two separate rooms. One room is going to be on the 150.50.0.0 network with hosts 150.50.0.1 to 150.50.15.254 and the other room will be 150.50.16.1 to 150.50.31.254 (I know this provides more hosts than the switch can handle, but I'm not worried about that atm).

Now I am at the point where I realize that I can't simply separate the ip addresses of the computers among the two rooms unless I use static ip's associated with the mac addresses of the computers. So my question is how is this usually done? Would I have to connect the computers in each room to their own gateway device which then connects to the switch? How do I tell my dhcp server what networks each room is on?

Other thoughts: I assume I could collect the mac addresses from each room and then dynamically assign addresses to each based on the network group they are under...

thanks for any input.

andrewthomas 09-26-2011 01:42 PM

Since a switch is a layer-2 device, all the ports connected to the switch (exclusive of the uplink (if it has one) have to be on the same subnet.

Unless you have a switch that is capable of using VLANs you are going to be limited to the same subnet.

You would need a layer-3 device to have separate networks.

baldy3105 09-26-2011 02:33 PM

Hmmm, beg to differ. Since a switch is a L2 device it is completely IP network agnostic. You can have 100 IP networks running on it if you want. Typically we configure one subnet per vlan but this is just to keep things tidy, it does not have to be the case.

Typically for what you are doing you would just leave all the devices in one subnet on the switch and run longer cables. why make things more complex than they need to be?

You could have two switches and run an uplink between them. Tidier on cabling.

If you want two subnets because you want to play with them you could place a secondary IP subnet on your server nic or on another nic, and have half the hosts use the second subnet. The server then becomes your router.
will break
If your switch supports vlans you could place the secondary subnet into another vlan, but you don't have to. You do not have a big enough network to worry about L2 separation of hosts. If you did this then your server would need to have one nic in each vlan or be configured for 802.1q vlan tagging.

If your server only has one nic and you want to keep one network on it then you could join the two subnets with a router. This could in the same way as the server be connected on one interface per vlan or on a vlan tagged interface. You would need to configure the router to forward BOOTP or your DHCP will break.

This is probably the most difficult thing about networking, there are so many ways to acheive the same thing!

dave247 09-26-2011 03:10 PM

Thanks for the reply, Baldy.

I suppose the reason I wanted separate subnets is because I am trying to simulate a network where I allow certain things on one network that I don't on the other such as internet access -- for security reasons.

After I made the post, I got to thinking: I could get in and configure the switch so that specific groups of ports could be used for each subnet. Of course I could just use two switches instead... or a router... or install another nic in my server (one nic per subnet). However, I am trying to work with the equipment I have.

It is so true that there are many different ways to achieve the same results! It would probably be easiest to assign static ip addresses on my network. That would cut down on all this complexity.

Thanks for the input!


All times are GMT -5. The time now is 07:53 PM.