[Users] Using veth on debian
Nils Domrose
nils at domrose.net
Mon Mar 5 13:02:03 EST 2007
Hi all,
today i need setup a Virtual Server with a veth device since a
commercial Software required a Mac Address for the license.
I think that it won't be the lasttime that we require such a setup
(unfortunately), therfore I put some more effort into the scripts and
added information to the wiki.
http://wiki.openvz.org/Virtual_Ethernet_device
I basicaly change the vznetaddroute script mentioned in the wiki:
#!/bin/bash
VZCONFDIR=/etc/vz
VZHOSTIF=$BASH_ARGV
. $VZCONFDIR/conf/$VEID.conf
if [ -n $VETH_IP_ADDRESS ]; then
echo "Adding interface $VZHOSTIF and route $VETH_IP_ADDRESS
for VE$VEID to VE0"
/sbin/ifconfig $VZHOSTIF 0
echo 1 > /proc/sys/net/ipv4/conf/$VZHOSTIF/proxy_arp
echo 1 > /proc/sys/net/ipv4/conf/$VZHOSTIF/forwarding
/sbin/ip route add $VETH_IP_ADDRESS dev $VZHOSTIF
else
echo "found no VETH_IP_ADDRESS in $VZCONFDIR/conf/$VEID.conf!"
exit 1;
fi
exit
with this little script one is finaly able to just apply changes to
the VE's config file by adding a VETH_IP_ADDRESS variable including
the desired IP Address, the rest is done by the script.
I decided to not include the sysctl / proc settings for forwarding
and proxy arp into this script since I prefere the /etc/networks/
interfaces way.
e.g.
auto eth0
iface eth0 inet static
address 10.1.1.1
netmask 255.255.255.0
network 10.1.1.0
broadcast 10.1.1.255
gateway 10.215.1.254
dns-nameservers 10.215.1.20
dns-search prod.your.domain
up sysctl -w net.ipv4.conf.eth0.proxy_arp=1
up sysctl -w net.ipv4.conf.eth0.forwarding=1
Hope this helps someone ;-)
Nils Domrose
More information about the Users
mailing list