OpenVZ Forum


Home » General » Support » how to set subnet mask
Re: how to set subnet mask [message #8772 is a reply to message #8757] Wed, 06 December 2006 07:58 Go to previous message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
Hello,

I really don't know why do you need it ('cause <venet0 in VE> is directly connected to <venet on HN>), but will explain how to do it.

Step by step guide (works at least for vzctl-3.0.13):

1. Determine which template do you use for the VE in question:
# grep TEMPL /etc/vz/conf/202.conf
OSTEMPLATE="fedora-core-4-i386-default
#

So this is fedora-core-4 in my case.

2. Figure out which script runs to setup network for this template:
# grep =  /etc/vz/dists/fedora-core-4.conf
ADD_IP=redhat-add_ip.sh
DEL_IP=redhat-del_ip.sh
SET_HOSTNAME=redhat-set_hostname.sh
SET_DNS=set_dns.sh
SET_USERPASS=set_userpass.sh
SET_UGID_QUOTA=set_ugid_quota.sh
POST_CREATE=postcreate.sh
#

I can see that script redhat-add_ip.sh runs when we do --ipadd.

4. Modify script in order it to use required NETMASK:
# grep NETMASK /etc/vz/dists/scripts/redhat-add_ip.sh
NETMASK=255.255.255.255
NETMASK=255.255.255.255" > ${IFCFG_DIR}/bak/${VENET_DEV_CFG}:${ifnum} || \
# vim /etc/vz/dists/scripts/redhat-add_ip.sh
[root@white ~]# grep NETMASK /etc/vz/dists/scripts/redhat-add_ip.sh
NETMASK=255.255.255.248
NETMASK=255.255.255.248" > ${IFCFG_DIR}/bak/${VENET_DEV_CFG}:${ifnum} || \

5. Check that it works:

# vzctl start 202
Starting VE ...
VE is mounted
Setting CPU units: 1000
VE start in progress...
# vzctl enter 202
entered into VE 202
[ve]# ifconfig | grep Mask
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet addr:127.0.0.1  P-t-P:127.0.0.1  Bcast:0.0.0.0  Mask:255.255.255.248

[ve]# exit
logout

exited from VE 202
# vzctl stop 202
Stopping VE ...
VE was stopped
VE is unmounted
# /etc/init.d/vz stop
Stopping OpenVZ:                                           [  OK  ]
# /etc/init.d/vz start
Starting OpenVZ:                                           [  OK  ]
Bringing up interface venet0:                              [  OK  ]
Configuring interface venet0:                              [  OK  ]
# vzctl start 202
Starting VE ...
VE is mounted
Setting CPU units: 1000
VE start in progress...
# vzctl enter 202
entered into VE 202
[VE]# ifconfig -a | grep Mask
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet addr:127.0.0.1  P-t-P:127.0.0.1  Bcast:0.0.0.0  Mask:255.255.255.248


HTH,
Vasily.
 
Read Message
Read Message
Previous Topic: vzquota : (error) Quota on syscall for 777: No such file or directory
Next Topic: ERROR: Core::SplitDevPath: Cannot get device for
Goto Forum:
  


Current Time: Thu Sep 04 04:07:12 GMT 2025

Total time taken to generate the page: 0.10044 seconds