OpenVZ...VEs that need different gateways on the HN...how?

supergper

Gawd
Joined
Apr 25, 2005
Messages
766
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 209.17.191.xxx/23 with the gateway 209.17.191.1. Since everything was working how I wanted I ordered 5 more static IPs. However, these IPs are 209.17.186.xxx/23 with the gateway of 209.17.186.1. 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 :()
 
D

Deleted member 12106

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

eth00

[H]ard|Gawd
Joined
Aug 16, 2004
Messages
1,090
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: 10.10.10.10
Also, we have private IP for node itself as 10.10.10.0, and public IP for node as 75.126.10.10

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

Code:

vzctl set 101 --ipadd 10.10.10.10 --save

Create executable file
/etc/sysconfig/vz-scripts/101.mount

Code:

#!/bin/bash
#
# if one of these files does not exist then something is really broken

. /etc/sysconfig/vz
. $VE_CONFFILE

ip route del 10.10.10.10 dev venet0 scope link src 75.126.10.10
ip route add 10.10.10.10 dev venet0 scope link src 10.10.10.0

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

Code:

ip r a 10.0.0.0/8 dev venet0 scope link src 10.10.10.10

After reboot VPS and it should works

vzctl restart 101

give that a shot
 
Top