Pegasi Wiki

This wiki acts as a memo for our own work so why not share them? Feel free to browse and use out notes and leave a note while at it.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
virsh_template_to_production [2016/01/24 12:04]
Pekka Kuronen
virsh_template_to_production [2017/11/06 10:11] (current)
Line 77: Line 77:
 <​code>​ <​code>​
 from $IPADDRESS table internal from $IPADDRESS table internal
 +</​code>​
 +
 +===== Add a bridged interface to guest =====
 +
 +A configured and working bridge device must exist to do this.
 +
 +==== Bring the interface down ====
 +
 +ifdown xxx
 +
 +==== Add a bridge to the host ====
 +
 +Edit the interface ifcfg init file:
 +
 +<​code>​
 +cd /​etc/​sysconfig/​network-scripts
 +cp -a ifcfg-xxx /root/
 +vim ifcfg-xxx
 +</​code>​
 +
 +Remove lines:
 +
 +<​code>​
 +IPADDR=x.x.x.x
 +PREFIX=x
 +</​code>​
 +
 +Add lines to the end of the file:
 +
 +<​code>​
 +NM_CONTROLLED=no
 +BRIDGE=brN
 +</​code>​
 +
 +Add a new configuration file for the bridge
 +
 +<​code>​
 +vim ifcfg-brN
 +</​code>​
 +
 +Add lines (copy the IP address and mask from the original)
 +
 +<​code>​
 +DEVICE=brN
 +ONBOOT=yes
 +IPADDR=x.x.x.x
 +PREFIX=x
 +TYPE=Bridge
 +NM_CONTROLLED=no
 +STP=off
 +</​code>​
 +
 +==== Set selinux context ====
 +
 +First check the current contexts and copy the right one from there
 +
 +<​code>​
 +ls -alZ
 +</​code>​
 +
 +Then set it
 +
 +<​code>​
 +chcon system_u:​object_r:​net_conf_t:​s0 ifcfg-brN ​
 +</​code>​
 +
 +==== Fire up the interface and the bridge ====
 +
 +I think you only need to fire up the bridge but I did both
 +
 +<​code>​
 +ifup brN
 +ifup xxx
 +</​code>​
 +
 +==== Add the interface to guest ====
 +
 +List existing network devices of a domain first
 +
 +<​code>​
 +virsh domiflist <​domain>​
 +</​code>​
 +
 +From there copy the correct values and add an existing bridge to a domain
 +
 +<​code>​
 +virsh attach-interface dental.pegasi.fi bridge br3 --mac 52:​54:​00:​87:​75:​04 --model rtl8139 --live --config
 </​code>​ </​code>​
  
 ~~DISCUSSION|Leave a comment~~ ~~DISCUSSION|Leave a comment~~
 +~~NOCACHE~~
 +~~QUICKSTATS:​@virsh_template_to_production&​basics~~
 +~~QUICKSTATS:​@virsh_template_to_production&​ip~~
  

  //check if we are running within the DokuWiki environment if (!defined("DOKU_INC")){ die(); } //place the needed HTML source codes BELOW this line