I have the following:

xxx.xxx.199.208/29 xxx.xxx.221.64/27

The /29 IP block is available directly from the network drop The /27 IP block is statically routed to xxx.xxx.199.210 of the /29

Here's how eth0 is configured:

auto eth0
allow-hotplug eth0
iface eth0 inet static
address xxx.xxx.199.210
gateway xxx.xxx.199.209
broadcast xxx.xxx.199.215
network xxx.xxx.199.208

So, basically there's no problem with /29 block, but I don't get the /27 block to se the light. I have enabled net.ipv4.ip_forward=1 on sysctl, have created routes, vlans, interfaces aliases, but I'm basically just fishing from what I have found around. No luck. Although i got the feeling I'm pretty close and there's only a tiny step missing.

The box is a hardware node, so the /27 block will be used to assign IPs to openvz containers. So I need to setup this the most efficient and secured way, maybe I'm letting my mind wander and there's nothing to worry about efficiency or security.

This is what command route -n outputs:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
xxx.xxx.221.65 UH    0      0        0 venet0
xxx.xxx.199.208 U     0      0        0 eth0         xxx.xxx.199.209         UG    0      0        0 eth0

There's one container running as you can see on the first route, I can ping it from the HN and viceversa, but I can't ping anything else from the container to the outside.


You can add additional virtual network interfaces in Linux using formatting as such:

ifconfig eth0 netmask
ifconfig eth0:1 netmask
ifconfig eth0:2 netmask

All three IP addresses will be active on the same physical interface, each will be visible in an ifconfig listing and the appropriate actions will happen just as though they were different interfaces.

Hopefully that covers what you need to know.

| improve this answer | |
  • Virtual interfaces are deprecated, the correct way to add additional IPs is with the ip tool. – mgorven Mar 1 '13 at 20:49
  • I have done it before, but no luck. Somebody told me that even with the virtual interfaces I would need to route the new subnet – blackliquid Mar 1 '13 at 20:55

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.