To add a network bridge in OpenVZ, you should follow these steps carefully:
1. Login to the OpenVZ server: Login as the root user on your OpenVZ server where you want to create the bridge.
1. Install Bridge Utilities: Install the bridge utilities package with the following command:
```
apt-get install bridge-utils
```
1. Create a Bridge: Create a new bridge by editing the network interfaces file:
```
nano /etc/network/interfaces
```
Here, you can add the following lines to create a bridge:
```
auto br0
iface br0 inet static
address [your_ip]
netmask [your_netmask]
network [your_network]
broadcast [broadcast_address]
gateway [your_gateway]
bridge_ports eth0
bridge_stp off
bridge_maxwait 0
```
Replace the values within the brackets with the appropriate values for your network.
1. Restart the Network: Bring down the physical network interface and bring it up again with the following commands:
```
ifdown eth0
ifup br0
```
1. Edit OpenVZ Container Configuration: Now you need to adjust the configuration file of your container. Let’s say your container ID is 101, then edit the config file with:
```
nano /etc/vz/conf/101.conf
```
Add or modify NETIF line for bridging as follows:
```
NETIF=“ifname=eth0,bridge=br0,mac=00:18:51:27:27:21,host_ifname=veth101.0,host_mac=00:18:51:A4:6B:6F“
```
1. Restart the container: After making changes, save and quit the editor and restart the OpenVZ container with:
```
vzctl restart 101
```
Now your container should be a part of the bridge and you can communicate with it directly as if it were a physical machine on your network. Make sure to replace the values in the examples with the valid ones for your own network environment. Remember, modifying network configurations may interrupt any open connections to your server, so plan accordingly.