TP sysres IMA5sc 2018/2019 G1 : Différence entre versions
De Wiki d'activités IMA
Ligne 29 : | Ligne 29 : | ||
nsenter -t 14601 -n ip address add dev eth0 192.168.0.101/24 | nsenter -t 14601 -n ip address add dev eth0 192.168.0.101/24 | ||
− | nsenter -t 14620 -n ip address add dev eth1 | + | nsenter -t 14620 -n ip address add dev eth1 172.26.145.243/24 |
nsenter -t 14612 -n ip address add dev eth0 192.168.0.102/24 | nsenter -t 14612 -n ip address add dev eth0 192.168.0.102/24 | ||
nsenter -t 14620 -n ip address add dev eth0 192.168.0.103/24 | nsenter -t 14620 -n ip address add dev eth0 192.168.0.103/24 | ||
+ | |||
+ | Routage sur routeur depuis Proxy Inverse: | ||
+ | |||
+ | ip route add default via 172.26.145.254 dev eth 1 | ||
brctl show: | brctl show: | ||
Ligne 61 : | Ligne 65 : | ||
64 bytes from 192.168.0.102: icmp_seq=20 ttl=64 time=0.110 ms | 64 bytes from 192.168.0.102: icmp_seq=20 ttl=64 time=0.110 ms | ||
64 bytes from 192.168.0.102: icmp_seq=21 ttl=64 time=0.056 ms | 64 bytes from 192.168.0.102: icmp_seq=21 ttl=64 time=0.056 ms | ||
+ | |||
+ | Config Proxy Reverse: | ||
+ | |||
+ | Dans site-available/000-config.conf: | ||
+ | |||
+ | ProxyPass /site1 http://192.168.0.101/ | ||
+ | ProxyPassReverse /site1 http://192.168.0.101/ | ||
+ | ProxyPass /site2 http://192.168.0.102/ | ||
+ | ProxyPassReverse /site2 http://192.168.0.102/ | ||
+ | ProxyRequests Off | ||
+ | |||
10H15 => Serveurs Web OK | 10H15 => Serveurs Web OK |
Version du 19 novembre 2018 à 10:09
Phase1:
export proxy ... dd if=/dev/zero of= bs=1024k count=10240 mkfs Partition umount Partition mount Partition /tmp/pointd'acancrage debootstrap stable --include=vim,apache2
unshare -p -f -m -u -n chroot /tmp/fs[1-3] /bin/sh -c "mount /proc ; /bin/bash" ;
Phase2:
Création de deux interfaces liées :
ip link add vif1 type veth peer name eth0@vif1 ip link add vif2 type veth peer name eth0@vif2 ip link add vif3 type veth peer name eth0@vif3 ip link add vif4 type veth peer name eth1@vif4
Déplacement du pair dans un espace réseau différent :
ip link set eth0@vif1 netns /proc/14601/ns/net name eth0 ip link set eth0@vif2 netns /proc/14612/ns/net name eth0 ip link set eth0@vif3 netns /proc/14620/ns/net name eth0 ip link set eth1@vif4 netns /proc/14620/ns/net name eth1
Configuration réseau dans l’espace alternatif :
nsenter -t 14601 -n ip address add dev eth0 192.168.0.101/24 nsenter -t 14620 -n ip address add dev eth1 172.26.145.243/24 nsenter -t 14612 -n ip address add dev eth0 192.168.0.102/24 nsenter -t 14620 -n ip address add dev eth0 192.168.0.103/24
Routage sur routeur depuis Proxy Inverse:
ip route add default via 172.26.145.254 dev eth 1
brctl show:
bridge name bridge id STP enabled interfaces br-50de43cf6b72 8000.024270463a85 no br-9964383bb7d2 8000.0242c526b998 no bridge 8000.00224d7af070 no eth0 eth1 vif4 docker0 8000.0242e82e829c no veth5fcd2d1 vSwitchBanane 8000.3299e99137df no vif1 vif2 vif3
Activation:
ip link set vif1,2,3,4 up ip link set vSwtichBanane up ip link set vif4 master bridge
Flush docker:
iptables -F iptables -F -t nat iptables -P FORWARD ACCEPT
Ping reverse proxy vers conteneur2:
root@zabeth08:/# ping 192.168.0.102 PING 192.168.0.102 (192.168.0.102) 56(84) bytes of data. 64 bytes from 192.168.0.102: icmp_seq=19 ttl=64 time=1024 ms 64 bytes from 192.168.0.102: icmp_seq=20 ttl=64 time=0.110 ms 64 bytes from 192.168.0.102: icmp_seq=21 ttl=64 time=0.056 ms
Config Proxy Reverse:
Dans site-available/000-config.conf:
ProxyPass /site1 http://192.168.0.101/ ProxyPassReverse /site1 http://192.168.0.101/ ProxyPass /site2 http://192.168.0.102/ ProxyPassReverse /site2 http://192.168.0.102/ ProxyRequests Off
10H15 => Serveurs Web OK