Skip to content

Instantly share code, notes, and snippets.

@hub-cap
Created August 8, 2014 17:55
Show Gist options
  • Save hub-cap/8e90b5f47d289e613ceb to your computer and use it in GitHub Desktop.
Save hub-cap/8e90b5f47d289e613ceb to your computer and use it in GitHub Desktop.
virsh -c lxc:/// net-destroy default
virsh -c lxc:/// net-undefine default
echo "<network>
<name>default</name>
<uuid>feb3e820-777f-c3df-defe-94d8c140791a</uuid>
<forward mode='nat'/>
<bridge name='br100' stp='on' delay='0' />
<mac address='52:54:00:F4:0B:84'/>
<ip address='10.0.0.1' netmask='255.255.255.0'>
<dhcp>
<range start='10.0.0.2' end='10.0.0.254' />
</dhcp>
</ip>
</network>" | sudo tee /etc/libvirt/qemu/networks/default.xml
virsh -c lxc:/// net-define /etc/libvirt/qemu/networks/default.xml
virsh -c lxc:/// net-start default
Do openvz stuff now and profit
@rmyers
Copy link

rmyers commented Aug 8, 2014

Sudo tee? why u no use the '>>'

@hub-cap
Copy link
Author

hub-cap commented Aug 11, 2014

cuz you need to be root running those commands to get redirection to a file that is owned by root.

baz@marceline:~$ echo "FOO" >> /etc/libvirt/ZOMG
bash: /etc/libvirt/ZOMG: Permission denied

baz@marceline:~$ sudo echo "FOO" >> /etc/libvirt/ZOMG
bash: /etc/libvirt/ZOMG: Permission denied

baz@marceline:~$ echo "FOO" | sudo tee /etc/libvirt/ZOMG
FOO

@rmyers
Copy link

rmyers commented Aug 11, 2014

I see makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment