This repository has been archived on 2019-11-14. You can view files and clone it, but cannot push or open issues or pull requests.
rip-vm2/partage/config.sh

65 lines
1.6 KiB
Bash
Raw Normal View History

2019-10-25 10:44:49 +02:00
#!/bin/sh
2019-11-14 12:51:11 +01:00
#if [ $(id -u) != 0 ]; then
# setxkbmap fr bepo -option ctrl:nocaps
# xset r rate 200 30
# exit 0
#fi
2019-10-25 10:44:49 +02:00
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
2019-11-14 12:51:11 +01:00
ip route add $lan2 via 172.16.2.156 #132
ip route add $lan4 via 172.16.2.156 #132
2019-10-25 10:44:49 +02:00
;;
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
2019-11-14 12:51:11 +01:00
ip route add $lan1 via 172.16.2.186 #162
ip route add $lan3 via 172.16.2.186 #162
2019-10-25 10:44:49 +02:00
;;
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
2019-11-14 12:51:11 +01:00
#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
#ip route add $lan4 dev tun0
2019-10-25 10:44:49 +02:00
;;
vm2-6)
ip address add fc00:1234:1::26/64 dev eth1
ip address add fc00:1234:2::26/64 dev eth2
;;
vm3-6)
2019-10-25 23:53:43 +02:00
ip address add fc00:1234:2::36/64 dev eth1
2019-10-25 10:44:49 +02:00
ip address add 172.16.2.186/28 dev eth2
ip route add $lan1_6 via fc00:1234:2::26
2019-11-14 12:51:11 +01:00
#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
#ip route add $lan3 dev tun0
2019-10-25 10:44:49 +02:00
;;
*)
echo "Nom dhôte non reconu."
exit 1
;;
esac