I have two physical servers, their configuration as following:

NETMASk= (different NETMASK)

Because of the different NETMASK, I'm wondering if I put the two servers in the same Switch, will this be ok?


If two devices with the same address are on the same network, then you will have a address conflict.

You may possibly be able to get away with this on two separate networks using NAT, but it can get pretty ugly, and it should only be used for a time until one or the other can be readdressed.

  • thank you! what do you mean "two separate networks", does it mean use Vlan or use two switches? – Jack Apr 12 at 23:55
  • Because routers route traffic between networks, each router interface is in a separate network, but each must be uniquely addressed. You would need at least two routers. See this question. – Ron Maupin Apr 13 at 0:00

Because of the different NETMASK, I'm wondering if I put the two servers in the same Switch, will this be ok?

No, using different subnet masks does not stop an IP conflict. there are basically two possible outcomes.

Some IP stacks do a check for duplicate addresses before bringing the interface up, others don't. If the device that comes up second does a duplicate check then you end up with one system working and the other not. If (due to a lack of duplicate checks) both interfaces come up then which server traffic gets sent to becomes unpredictable leading to troubleshooting nightmares.

If your switch has management features then you can split the devices onto seperate vlans. This will stop them conflicting with each other, but will also mean there is no direct path between them.

It is possible to build a NAT box to allow them to communicate, but it's tricky because most NAT implementations don't handle overlapping address spaces. This typically means if you want to make two servers with the same IP talk to each other you have to NAT the traffic twice with two separate instances of the NAT engine.

Note that two separate instances of the NAT engine does not necessarily mean two separate hardware devices. For example modern Linux kernels have a feature called "network namespaces" that allows multiple separate instances of the network stack (including the NAT engine).


Because of the different NETMASK, I'm wondering if I put the two servers in the same Switch, will this be ok?


The netmask is only used for routing a packet - decide whether the destination is local or which gateway to use. The netmask is not used for addressing, so two nodes using the same IP address on the same L2 segment/switch/VLAN always conflict.

As already outlined, workarounds involving NAT, ARP filtering, static ARP, port forward filtering (private VLAN) or such are possible but usually very much to be avoided.

[*] Two servers on the same switch doesn't explicitly exclude using multiple VLANs where duplicate IP addresses are certainly possible (yet impractical).

  • Thanks, I was setting two same ips because I'd like to do Anycast. I was also trying to figure out same ip problem by using Vlans, but you mentioned it is impractical. So do you have any practical ideas please? – Jack Apr 15 at 19:06
  • Anycast for two adjacent servers doesn't make sense. Do you need load balancing? – Zac67 Apr 15 at 19:16
  • yes,two adjacent servers for Anycast. I gave them different bgp peers, so far I just would like to test the Anycast capacity before we having our second IDC. – Jack Apr 15 at 19:19
  • Well, with separate routing and separate VLANs that should work. – Zac67 Apr 15 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.