Configuration d'un container (140) en virtual ethernet device (veth)
OBJECTIFS : A partir d'un serveur hôte équipé d'une carte ethernet multi-ports, installer des CTs publics et des privés sur des ports ethernet différents
création d'une interface eth1 sur le serveur hôte
# vi /etc/network/interfaces
allow-hotplug eth1 iface eth1 inet static address 10.72.1.3 netmask 255.255.255.0 network 10.72.1.0 broadcast 10.72.1.255 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 10.72.1.2 dns-search fr.auf up route add -net 10.72.0.0 netmask 255.255.0.0 gw 10.72.1.1
# ifup eth1
création du container 140 à partir d'un template
Le template doit contenir le paquet "iproute" installé
# vzctl create 140 --ostemplate debian-4.0-i386-minimal
# vzctl set 140 --netif_add eth1,00:80:C8:CD:67:6D,, --save
# vzctl set 140 --nameserver 10.72.1.2 --save
# vzctl set 140 --hostname devel140 --save
configuration de la virtual ethernet device pour le container 140
# ifconfig veth140.1 0
# echo 1 > /proc/sys/net/ipv4/conf/veth140.1/forwarding
# echo 1 > /proc/sys/net/ipv4/conf/veth140.1/proxy_arp
# echo 1 > /proc/sys/net/ipv4/conf/eth1/forwarding
# echo 1 > /proc/sys/net/ipv4/conf/eth1/proxy_arp
configuration du container 140
# vzctl start 140
# vzctl enter 140
# vi /etc/network/interfaces
auto lo iface lo inet loopback auto eth1 iface eth1 inet static address 10.72.1.4 netmask 255.255.255.255 up route add default dev eth1
# /etc/init.d/network restart
Test d'accessibilité au container 140
A partir du container :
devel140:/# ping 10.72.1.1 PING 10.72.1.1 (10.72.1.1) 56(84) bytes of data. 64 bytes from 10.72.1.1: icmp_seq=1 ttl=63 time=0.329 ms 64 bytes from 10.72.1.1: icmp_seq=2 ttl=63 time=0.309 ms 64 bytes from 10.72.1.1: icmp_seq=3 ttl=63 time=0.221 ms 64 bytes from 10.72.1.1: icmp_seq=4 ttl=63 time=0.197 ms 64 bytes from 10.72.1.1: icmp_seq=5 ttl=63 time=0.241 ms 64 bytes from 10.72.1.1: icmp_seq=6 ttl=63 time=0.219 ms
A partir d'une machine du réseau
toto@10.72.0.174:~$ ping 10.72.1.4 PING 10.72.1.4 (10.72.1.4) 56(84) bytes of data. 64 bytes from 10.72.1.4: icmp_seq=1 ttl=63 time=0.631 ms 64 bytes from 10.72.1.4: icmp_seq=2 ttl=63 time=0.618 ms 64 bytes from 10.72.1.4: icmp_seq=3 ttl=63 time=0.528 ms 64 bytes from 10.72.1.4: icmp_seq=4 ttl=63 time=0.619 ms 64 bytes from 10.72.1.4: icmp_seq=5 ttl=63 time=0.562 ms 64 bytes from 10.72.1.4: icmp_seq=6 ttl=63 time=0.485 ms