Create new subnet over existing subnet

Ricardo Marimon asked:

I have three servers that currently have ips,, and They can see each other and talk to each other. I would like to create a second subnet, on top of the 192.168.1.x, which is 10.170.x.x.

I can assign ips to each of the three servers,, and, with ip addr add dev eth0. The problem I’m having is how to do the routing. I can’t ping any server over the 10.170.x.x network. I believe that I need to create some peer-to-peer bridges but I have no clue on how to get started. Any ideas?

My answer:

As has been noted by others, when you use ip address add and don’t provide a network mask or CIDR range, /32 is assumed, and so no routes are created for the subnet.

To resolve the issue, you add the CIDR range as well:

ip addr add dev eth0

To make the change persistent you add it to /etc/network/interfaces. This can be done the cheap and dirty way through a post-up command, but the proper way is to add a second stanza containing only that address:

auto eth0
iface eth0 inet static

iface eth0 inet static

Note in particular that, despite what you will read in outdated Internet guides, you should not use eth0:0 for the second IP address. This form is deprecated and has been for years (which means it is likely to be removed from Linux at any time).

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.