OpenVZ Forum - RDF feed
type: channel
items: how to set subnet mask
items: Re: how to set subnet mask

how to set subnet mask
type: item
description: Im tyring to setup VPS with OpenVZ. I used vzctl command. vzctl set 101 --ipadd [IP] and checked conf cat /etc/sysconfig/vz-scripts/101.conf IP_ADDRESS="[IP]" After that, Start OpenVZ and enter. But, Can not connect network. Because, VE's subnet mask is not HW's. HW's subnet mask 255.255.255.248 VE's subnet mask 255.255.255.255 I tried to change subnet mask and restart network. vi /etc/sysconfig/network-scripts/ifcfg-venet0:0 NETMASK=255.255.255.248 #NETMASK=255.255.255.255 /etc/init.d/network restart VE's success to connect HW. But, after restart OpenVZ, subnet mask back to 255.255.255.255 Anyone know set subnet mask? I could not find command in vzctl --help.
creator: kasarfa
date: 2006-12-05T15:33:49-00:00

Re: how to set subnet mask
type: item
description: 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.
creator: Vasily Tarasov
date: 2006-12-06T07:58:36-00:00