[Users] Access to private and public IP in VPS

Arjan Schrijver arjan at anymore.nl
Wed Nov 14 04:51:48 EST 2007


I actually did this a few days ago.
Just add both the public and the private IP address to the VE using
these commands (don't use veth interfaces):

HN# vzctl set 100 --ipadd [publicip] --save
HN# vzctl set 100 --ipadd [privateip] --save

In the VE you should now have two ethernet devices: venet0 and venet0:1
To make it actually work, you have to add routes inside the VE to the
network that isn't available using the default route:

VE# route add -net [privatenetwork] netmask 255.255.255.0 gw [privateip]

So to explain the above command, you add the route to [privatenetwork]
(i.e. 192.168.1.0) using its own IP address as the gateway. You can add
this route to one of the startup scripts of your VE, so it gets added
when the VE boots.

Remember, this only works when your Hardware Node knows both networks
(in its routing table).

Regards,
Arjan


Frederik wrote:
> I have a hardware node with two network interfaces, one with a public IP 
> address, one with a private IP address. Now I would like a VPS to also 
> have a public IP address and a private IP address so both networks can be 
> accessed directly. How should this be configured? Is it possible without 
> using veth interfaces?
>
>   



More information about the Users mailing list