I have a CentOS 7 PC (with 2 NIC cards) and 2 servers. I'd like to access these servers from the 2 NICs in a different way. Something like one server can be reached only from NIC1, and the other server should be accessed only from NIC2. I've realized that I'm unable to put them into the same subnet using the IP addresses 10.10.10.{1-4}/29 for some reason.

However, should this work?

NIC1:     ->     Server1:
NIC2:     ->     Server2:

I'm always confused with networking and subnetting. Please advise.

  • 3
    I'm afraid those addresses/masks don't make sense. A /30 subnet has two usable host IPs each. In the case of, you have the correct host IPs - .1 on your client host, and .2 on the server host. Unfortunately, the only 2 usable IPs for are .5 and .6. .4 cannot be used for a host, as it is the network address. Before going any further, you need to fix those assignments for NIC2. Once you do that, it should just work. – guzzijason Oct 18 '18 at 14:56
  • Use a firewall (e.g. iptables) on the servers to limit which source IP addresses can connect to the servers. On the client with the two NICs either you get a setup with two /30 networks and it will use the correct source IP address to connect to each server or, if all IP addresses are the in a /24 network, you should use static host routes to use the correct exit interface. – Tommiie Oct 18 '18 at 14:58

@guzzijason have technically answered the question for me and pointed out a mistake I've made calculating the IP address.

So the sollution was:

  • PC:

    • eth0:
    • eth1:
  • Server1

    • eth0:
  • Server2

    • eth0:

Thank you Mate!

| improve this answer | |

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.