Routing for servers on the same subnet

Routing for servers on the same subnet

Both servers are connected to the same switch. If you need a connection between the
servers, you have to set a static route on each server (if using DHCP) or change their netmask to /32 (if using static IP configuration).
This is necessary as we use the “protected ports” security feature on our switches.

Here is an example of how you can do that on linux:
—————–%<—————–
ip route add <OTHER-IP>/32 via <GATEWAY> dev <NETWORK-DEVICE>
—————–%<—————–

Replace <OTHER-IP> with the IP address of the other server, <GATEWAY> with the gateway IP address of your network switch, and <NETWORK-DEVICE> with the name of the NIC that connects to the switch.

On Windows:

  1. Identify the subnet IP address of the other server on the same subnet.
  2. Identify the netmask of your subnet.
  3. Identify the gateway IP address of your network switch.
  4. Run the following command to add a static route:

route (-p to make it permanent) add [Subnet-IP] mask [netmask] [Gateway]

Replace [Subnet-IP] with the subnet IP address of the other server, [netmask] with the netmask of your subnet, and [Gateway] with the gateway IP address of your network switch. Use the -p option to make the route permanent, so it persists after a reboot.

Remember that setting static routes may impact the routing of network traffic, so make sure you fully understand the consequences before implementing them.

 

—————%<—————