#!/bin/sh if [ $(id -u) != 0 ]; then setxkbmap fr bepo -option ctrl:nocaps xset r rate 200 30 exit 0 fi sysctl -w net.ipv4.ip_forward=1 sysctl -w net.ipv6.conf.all.forwarding=1 lan1=172.16.2.128/28 lan2=172.16.2.160/28 lan3=172.16.2.144/28 lan4=172.16.2.176/28 lan1_6=fc00:1234:1::/64 lan2_6=fc00:1234:2::/64 case $(hostname) in vm1) ip address add 172.16.2.131/28 dev eth1 ip address add 172.16.2.151/28 dev eth2 ip route add $lan2 via 172.16.2.132 ip route add $lan4 via 172.16.2.132 ;; vm2) ip address add 172.16.2.132/28 dev eth1 ip address add 172.16.2.162/28 dev eth2 ip route add $lan3 via 172.16.2.131 ip route add $lan4 via 172.16.2.163 ;; vm3) ip address add 172.16.2.163/28 dev eth1 ip address add 172.16.2.183/28 dev eth2 ip route add $lan1 via 172.16.2.162 ip route add $lan3 via 172.16.2.162 ;; vm1-6) ip address add 172.16.2.156/28 dev eth1 ip address add fc00:1234:1::16/64 dev eth2 ip route add $lan2_6 via fc00:1234:1::26 ip route add $lan1 via 172.16.2.151 ip route add $lan2 via 172.16.2.151 ip route add $lan4 via 172.16.2.151 ;; vm2-6) ip address add fc00:1234:1::26/64 dev eth1 ip address add fc00:1234:2::26/64 dev eth2 ;; vm3-6) ip address add fc00:1234:2::36/64 dev eth1 ip address add 172.16.2.186/28 dev eth2 ip route add $lan1_6 via fc00:1234:2::26 ip route add $lan1 via 172.16.2.183 ip route add $lan2 via 172.16.2.183 ip route add $lan3 via 172.16.2.183 ;; *) echo "Nom d’hôte non reconu." exit 1 ;; esac