0

I want to set up a network switch with several servers connected to it that must be port forwarded.

Please refer to the below diagram for my setup:

                ___Computer 2
                |
Router-->Switch-|
                |__Computer 1

So my question to you is this:

If my router assigns IP's as 192.168.0.x will computer 1 and computer 2 have two seperate IP addresses following the 192.168.0.x format?

Grammargeek
  • 130
  • 1
  • 1
  • 7

2 Answers2

5

You have three separate issues here. First, assigning unique IP addresses to Computer 1 and Computer 2 in the LAN (the right side of your diagram). If the router implements a DHCP server, and the switch is just a transparent switch, then the different computers will be served different IP addresses. This is how routers usually work, so you should be fine.

Second, doing port forwarding on traffic coming into the router from the WAN (the left edge of your diagram). Again, most routers implement network address translation (NAT), so the multiple IP addresses on the LAN appear as only one IP address to the WAN. This means that incoming connection requests will generally be refused, as there's no way for the router to know which LAN IP address to route the request to. If the router supports port forwarding, then you can configure it to route connection requests to a specific external port to a specific port on a specific internal IP address. For example, you could have incoming port 80 requests be routed to computer 1's web server, and incoming port 22 requests routed to computer 2's ssh daemon.

Third, what happens when one of the computers is turned off for a few days, and then turned back on? The DHCP server may issue a different IP address for that computer, breaking your port forwarding configuration. To solve this, many routers support "static DHCP", where they always issue a specific IP address to a specific computer (identified by its MAC address).

So: you need DHCP, port forwarding, and static DHCP to do what you seem to want to do.

Daniel Griscom
  • 493
  • 1
  • 4
  • 15
3

If your switch does offer DHCP, then it needs to be configured properly if you want it to give out leases for 192.168.0.0/24.

The IP assigned to your switch can be without any relation to the DHCP range, which the switch might offer.

However, in your setup it is more likely that the router is acting a as DHCP server and the switch will thus just do typical layer 2 tasks and forward your packets.

Leon Kramer
  • 148
  • 10
  • How do I find out if it supports DHCP? (I havent bought it yet I'm still figuring out if it's the best option) – Grammargeek Jul 07 '15 at 00:26
  • So, I have a question, uf it's doing this will it act as though I just had a bunch of extra ports on my router? – Grammargeek Jul 07 '15 at 00:36
  • Basically yes. Relatively securely as opposed to a hub. – Michael Bailey Jul 07 '15 at 00:49
  • Okay then, that was basically what I needed to know, thanks! – Grammargeek Jul 07 '15 at 00:57
  • 1
    Virtually no switches will offer DHCP - this is typically done by the router. – davidgo Jul 07 '15 at 03:00
  • Unfortunately, it seems the reviewers consider your question off-topic here. In similar cases I would suggest to try http://superuser.com or http://networkengineering.stackexchange.com , where it would be considered probably ontopic. – peterh Jul 09 '15 at 02:55