This guide was my email to my collegeue way back in 10 Apr 2008, i put it here for my reference later on..
=======
Dear server-admin
below are guide on how to enable the second nic to the VM,
A. Network setup.
1. put a new switch for network 34.x, then connect the second NIC of the servers to the new switch.
2. configure the 2nd nic with 34.x network ip, exp, (helios1: eth0: 192.168.33.60, eth1: 192.168.34.60)
B. bridging setup
1. in /etc/xen/scripts, create a new scripts (named it as multiplebridge.sh) with content as below"
---------[multiplebridge.sh]---------------
#!/bin/sh
# start bridges on both eth0 and eth1
XENDIR="/etc/xen/scripts"
$XENDIR/network-bridge "$@" netdev=eth0 bridge=xenbr0 vifnum=0
$XENDIR/network-bridge "$@" netdev=eth1 bridge=xenbr1 vifnum=1
---------------------[end ]-----------------------
make sure to chmod this file to 755 (executable).
# chmod 755 multiplebridge.sh
2. make backup copy of /etc/xen/xend-config.sxp
# cd /etc/xen/
# cp xend-config.sxp xend-config.sxp.ori
3. edit the file (xend-config.sxp)
find this line:
(network-script network-bridge)
replace with :
(network-script multiplebridge.sh)
save and close.
4. edit the virtual domain config file (exp. /etc/xen/helios1)
find this line:
vif = [ 'mac=00:16:3e:5a:d8:28, bridge=xenbr0',]
add to the line new entry such as below
vif = [ 'mac=00:16:3e:5a:d8:
28, bridge=xenbr
0','
mac=00:16:3e:5a:d8:38, bridge=xenbr1' ]
** make sure to change the mac address to something different than the other, in the exp. above
i just change 2 to 3 ( 28 --> 38).
*** the above example is for helios1 only, the mac address will not be the same for other servers.
save and close.
5. restart the network service.
# service network restart
make sure that the second network card is started.
6. shutdown all virtual machine currently running.
# xm shutdown helios1
7. restart xend services
# service xend restart
8. make sure that the second bridge interface is enable..
# brctl show
bridge name bridge id STP enabled interfaces
xenbr0 8000.feffffffffff no vif3.0
peth0
vif0.0
xenbr1 8000.feffffffffff no vif3.1
peth1
vif0.1# ifconfig
xenbr0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:765 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:152041 (148.4 KiB) TX bytes:0 (0.0 b)
xenbr1 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:89 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:21396 (20.8 KiB) TX bytes:0 (0.0 b)9. start the virtual machine (helios1)
# xm create -c helios1
C . Configure the new interface in virtual machine
1. logon to the virtual machine as root.
# xm console helios1
2. make a copy of /etc/sysconfig/network-scripts/ifcfg-eth0 to ifcfg-eth1
# cd /etc/sysconfig/network-scripts/
# cp ifcfg-eth0 ifcfg-eth1
3. edit ifcfg-eth1, change the one in red. as below, set the new ip for the new interface ( 34.x network)
------[
original :ifcfg-eth1]-------
# Xen Virtual Ethernet
DEVICE=
eth0 BROADCAST=192.168.
33.255
HWADDR=00:16:3E:5A:D8:
28IPADDR=192.168.
33.60
NETMASK=255.255.255.0
NETWORK=192.168.
33.0
ONBOOT=yes
GATEWAY=192.168.33.1 (DELETE)TYPE=Ethernet
----------------------
------[
new :ifcfg-eth1]-------
# Xen Virtual Ethernet
DEVICE=
eth1BROADCAST=192.168.
34.255
HWADDR=00:16:3E:5A:D8:
38IPADDR=192.168.
34.60
NETMASK=255.255.255.0
NETWORK=192.168.
34.0
ONBOOT=yes
TYPE=Ethernet
----------------------
save and close.
4. restart the network services.
# service network restart
5. make sure that the new interface is enable..
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:3E:5A:D8:28
inet addr:192.168.33.60 Bcast:192.168.33.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:fe5a:d828/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:694 errors:0 dropped:0 overruns:0 frame:0
TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:149651 (146.1 KiB) TX bytes:8196 (8.0 KiB)
eth1 Link encap:Ethernet HWaddr 00:16:3E:5A:D8:38
inet addr:192.168.34.60 Bcast:192.168.34.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:fe5a:d838/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:8196 (8.0 KiB)6. done.. that it.. the second nic is enable.. good luck.
p/s - the above example is from helios1_dom0 /helios1 , you can use it as a reference for the other servers, the scripts, running 2nd NIC etc.. it all there, just need to be connected to a switch

regards
adi.hazman/CDC