OpenVZ Forum


Home » General » Support » 200 IPs in a single VE?
200 IPs in a single VE? [message #28538] Sun, 23 March 2008 08:06 Go to next message
mperkel is currently offline  mperkel
Messages: 253
Registered: December 2006
Senior Member
Is there and easy way to put 200 IPs in a VE without typing in the whole list? Something like 65.49.42.70-254 ?

Re: 200 IPs in a single VE? [message #28547 is a reply to message #28538] Sun, 23 March 2008 16:14 Go to previous messageGo to next message
curx
Messages: 739
Registered: February 2006
Location: Nürnberg, Germany
Senior Member

# CTID=<CTID>; IPR=65.49.42 ; START=70; STOP=254; for dip in `seq $START $STOP`; do vzctl set $CTID --ipadd $IPR.$dip --save ; done

Re: 200 IPs in a single VE? [message #28548 is a reply to message #28547] Sun, 23 March 2008 16:39 Go to previous messageGo to next message
mperkel is currently offline  mperkel
Messages: 253
Registered: December 2006
Senior Member
I don't understand that. Do I add that to the config file?

Also, If I give it a list I noticed that this doesn't work:

IP_ADDRESS="65.49.42.70 \
65.49.42.71"

how do you do multiline?


Re: 200 IPs in a single VE? [message #28549 is a reply to message #28548] Sun, 23 March 2008 17:04 Go to previous messageGo to next message
mperkel is currently offline  mperkel
Messages: 253
Registered: December 2006
Senior Member
Never mind - I figured it out.

IP_ADDRESS="65.49.42.70"
IP_ADDRESS="65.49.42.71"
IP_ADDRESS="65.49.42.72"
IP_ADDRESS="65.49.42.73"
IP_ADDRESS="65.49.42.74"
IP_ADDRESS="65.49.42.75"
IP_ADDRESS="65.49.42.76"
IP_ADDRESS="65.49.42.77"
IP_ADDRESS="65.49.42.78"
IP_ADDRESS="65.49.42.79"


Re: 200 IPs in a single VE? [message #28553 is a reply to message #28549] Mon, 24 March 2008 08:01 Go to previous message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

I don't think it will work. Maybe it works with vzctl, but not with the shell scripts, some of which are sourcing container configs. If a shell script is sourcing the file, all the subsequent assignments will overwrite the previous one, so a shell script will think this container only have one IP (the last one from the config).

Your best shot is space-separated list, as documented in man vps.conf. Shell script written by curx above does just what you want (and the fact that it uses vzctl set --save means those IPs are saved into config file.

Alternatively, you can do something like:

IPR=65.49.42 ; START=70; STOP=254; echo -n 'IP_ADDRESS="'; for dip in `seq $START $STOP`; do echo -n $IPR.$dip "" ; done; echo '"'

if you want to modify the config file directly, add the output of the above shell code to /etc/vz/conf/CTID.conf (and make sure you have removed previous IP_ADDRESS declaration from it).


Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png

[Updated on: Mon, 24 March 2008 08:02]

Report message to a moderator

Previous Topic: numothersock question
Next Topic: Having trouble mounting in a VE
Goto Forum:
  


Current Time: Sat Nov 16 14:35:12 GMT 2024

Total time taken to generate the page: 0.03040 seconds