Linux route 2nd internal network

ip-routinglinuxrouting

In my network configuration, I have three switches:

  1. Internet (xx.xx.140.129/25)
  2. Internal SAN (10.1.1.0/24)
  3. iLo management (10.1.30.0/24)

I have one Linux server which I use for management that needs to have access to all three networks, however it only has 2 NICs. I've cabled switches #2 and #3 together, so there is a physical path between them, and I've tried ip route add 10.1.1.0/24 eth0, but that did not work. Any ideas on how this could be done?

[root@ilo]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
XX.XX.140.128 0.0.0.0           255.255.255.128 U     0      0        0 eth1
10.1.30.0       0.0.0.0         255.255.255.0   U     0      0        0 eth0
10.1.1.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
0.0.0.0         XX.XX.140.129   0.0.0.0         UG    0      0        0 eth1

Best Answer

If you want to separate the traffic for security reasons, you should use VLAN tagging. For this you will need managed switches.

If you do not need to separate the traffic for security, then you should use the same IP prefix for #2 and #3

If you still want to use your design, (e.g. if you plan to separate the networks later with managed switches), then you can use IP aliases (add secondary IP addresses) on an interface.

To debug your network problem go on the network stack from physical layer to the application one:

  1. test your cables. Do you have link up on all interfaces on the path? e.g. all ethernet LEDs are blinking for all interfaces?
  2. is the device answering to arping, ping. Try both using IP and hostname.
  3. run traceroute and see how the packets are routed. Debug with ip route get <IP_destination> to find on which interface will the packets get routed.
  4. use telnet, nc, etc. to see if the application is answering.

EDIT: Run:

ip route del 10.1.1.0/24 dev eth0   # remove the fixed route
ip addr add 10.1.1.1/24 dev eth0    # add an IP alias 

The problem is that you do not have an IP from 10.1.30.0/24 prefix on the eth0.