Operations on Virtual Private Servers
35
Setting Network Parameters
In order to be accessible from the network, a Virtual Private Server shall be assigned a correct
IP address and host name; DNS server addresses shall also be configured. The session below
illustrates setting the Virtual Private Server 101 network parameters:
# vzctl set 101 --hostname test101.my.org --save
Hostname for VPS set: test101.my.org
Saved parameters for VPS 101
# vzctl set 101 --ipadd 10.0.186.1 --save
Adding IP address(es): 10.0.186.1
Saved parameters for VPS 101
# vzctl set 101 --nameserver 192.168.1.165 --save
File resolv.conf was modified
Saved parameters for VPS 101
This command will assign VPS 101 the IP address of 10.0.186.1, the host name of
test101.my.org, and set the DNS server address to 192.168.1.165. The
–-save
flag saves all
the parameters to the VPS configuration file.
You can issue the above commands when the Virtual Private Server is running. In this case, if
you do not want the applied values to persist, you can omit the
–-save
option and the applied
values will be valid only until the Virtual Private Server shutdown.
To check whether SSH is running inside the Virtual Private Server, use
vzctl exec
, which
allows executing any commands in the Virtual Private Server context.
# vzctl start 101
[This command starts VPS 101, if it is not started yet]
# vzctl exec 101 service sshd status
sshd is stopped
# vzctl exec 101 service sshd start
Starting sshd: [ OK ]
# vzctl exec 101 service sshd status
sshd (pid 16036) is running...
The above example assumes that VPS 101 is created on the Fedora Core template. For other OS
templates, please consult the corresponding OS documentation.
For more information on running commands inside a VPS from the Hardware Node, see the
Running Commands in Virtual Private Server
subsection.