OpenVZ...VEs that need different gateways on the


Apr 25, 2005
So I've setup my initial VE and everything worked great. I was given two static IPs from my server provider. (Server is Co-located) One for the HN and one for the VE. They are with the gateway Since everything was working how I wanted I ordered 5 more static IPs. However, these IPs are with the gateway of Now, what do I need to do to get these new IPs working in some new VEs? This is all on CentOS 5 HN and VEs.

Thanks for any help.

(I've asked this same question on their support forum with no replies yet :()

Deleted member 12106

What happens if you try to use the same gateway as the last one?


Aug 16, 2004
Thanks for the link but apparently you need to be registered to view it and registrations are disabled :p I figured it has something to do with the routing tables but I don't know enough about setting up routing tables.

Ah yeah oops! SL is a datacenter and that is a private forum for people with servers. Here is the post:

So, a little howto.
Let`s say we do it for VE # 101, and must add private IP:
Also, we have private IP for node itself as, and public IP for node as

Firstly add IP normally, even if it doesn't work.


vzctl set 101 --ipadd --save

Create executable file


# if one of these files does not exist then something is really broken

. /etc/sysconfig/vz

ip route del dev venet0 scope link src
ip route add dev venet0 scope link src

Ok, after enter to ve 101
vzctl enter 101
and add to rc.local following:


ip r a dev venet0 scope link src

After reboot VPS and it should works

vzctl restart 101

give that a shot