mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
On utilise dhcp sur le container, le réseau ne fonctionne pas bien sur une IP fixe
This commit is contained in:
parent
9afe00d30d
commit
58ad18cbc6
1 changed files with 7 additions and 3 deletions
|
@ -33,6 +33,7 @@ sudo apt-get install -y lxc lxctl >> "$LOG_BUILD_LXC" 2>&1
|
|||
os_name=$(sed -n -e '/PRETTY_NAME/ s/^.*=\|"\| .*//gp' /etc/os-release);
|
||||
if [ os_name == "Ubuntu" ]
|
||||
then
|
||||
echo -e "\e[1m> Install lxc-templates debootstrap si Ubuntu\e[0m" | tee "$LOG_BUILD_LXC"
|
||||
sudo apt-get install -y lxc-templates debootstrap >> "$LOG_BUILD_LXC" 2>&1
|
||||
fi
|
||||
|
||||
|
@ -69,8 +70,8 @@ sudo ifup $LXC_BRIDGE --interfaces=/etc/network/interfaces.d/$LXC_BRIDGE >> "$LO
|
|||
echo -e "\e[1m> Configuration réseau du conteneur\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||
sudo sed -i "s/^lxc.network.type = empty$/lxc.network.type = veth\nlxc.network.flags = up\nlxc.network.link = $LXC_BRIDGE\nlxc.network.name = eth0\nlxc.network.hwaddr = 00:FF:AA:00:00:01/" /var/lib/lxc/$LXC_NAME/config >> "$LOG_BUILD_LXC" 2>&1
|
||||
|
||||
echo -e "\e[1m> Configuration réseau de la machine virtualisée\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||
sudo sed -i "s@iface eth0 inet dhcp@iface eth0 inet static\n\taddress $PLAGE_IP.2/24\n\tgateway $PLAGE_IP.1@" /var/lib/lxc/$LXC_NAME/rootfs/etc/network/interfaces >> "$LOG_BUILD_LXC" 2>&1
|
||||
# echo -e "\e[1m> Configuration réseau de la machine virtualisée\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||
# sudo sed -i "s@iface eth0 inet dhcp@iface eth0 inet static\n\taddress $PLAGE_IP.2/24\n\tgateway $PLAGE_IP.1@" /var/lib/lxc/$LXC_NAME/rootfs/etc/network/interfaces >> "$LOG_BUILD_LXC" 2>&1
|
||||
|
||||
echo -e "\e[1m> Configure le parefeu\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||
sudo iptables -A FORWARD -i $LXC_BRIDGE -o $main_iface -j ACCEPT >> "$LOG_BUILD_LXC" 2>&1
|
||||
|
@ -85,6 +86,9 @@ sudo lxc-ls -f >> "$LOG_BUILD_LXC" 2>&1
|
|||
echo -e "\e[1m> On lance l'interface réseau\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||
sudo lxc-attach -n $LXC_NAME -- /etc/init.d/networking start
|
||||
|
||||
echo -e "\e[1m> On récupére l'ip du container\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||
IP_CONTAINER=$(sudo lxc-attach -n $LXC_NAME -- ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
|
||||
echo -e "\e[1m> Update et install aptitude sudo git\e[0m" | tee -a "$LOG_BUILD_LXC"
|
||||
sudo lxc-attach -n $LXC_NAME -- apt-get update
|
||||
sudo lxc-attach -n $LXC_NAME -- apt-get install -y aptitude sudo git
|
||||
|
@ -113,7 +117,7 @@ sudo lxc-attach -n $LXC_NAME -- chown pchecker: -R /home/pchecker/.ssh >> "$LOG_
|
|||
echo | tee -a $HOME/.ssh/config <<EOF >> "$LOG_BUILD_LXC" 2>&1
|
||||
# ssh $LXC_NAME
|
||||
Host $LXC_NAME
|
||||
Hostname $PLAGE_IP.2
|
||||
Hostname $IP_CONTAINER
|
||||
User pchecker
|
||||
IdentityFile $HOME/.ssh/$LXC_NAME
|
||||
EOF
|
||||
|
|
Loading…
Add table
Reference in a new issue