|
|
@ -5,6 +5,8 @@
|
|
|
|
base_chemin_mv="/tmp/ramdisk/qemu-adm"
|
|
|
|
base_chemin_mv="/tmp/ramdisk/qemu-adm"
|
|
|
|
bin_qemu="/usr/bin/qemu-system-x86_64"
|
|
|
|
bin_qemu="/usr/bin/qemu-system-x86_64"
|
|
|
|
bin_qemu_img="/usr/bin/qemu-img"
|
|
|
|
bin_qemu_img="/usr/bin/qemu-img"
|
|
|
|
|
|
|
|
bin_ip="/usr/bin/ip"
|
|
|
|
|
|
|
|
bin_bridge="/usr/sbin/bridge"
|
|
|
|
chemin_services_demons="/usr/local/etc/systemd/system"
|
|
|
|
chemin_services_demons="/usr/local/etc/systemd/system"
|
|
|
|
chemin_services_production="/etc/systemd/system"
|
|
|
|
chemin_services_production="/etc/systemd/system"
|
|
|
|
nom_script=$(basename $0)
|
|
|
|
nom_script=$(basename $0)
|
|
|
@ -551,11 +553,11 @@ genCmdIntRzo(){
|
|
|
|
# Création d'une interface simple
|
|
|
|
# Création d'une interface simple
|
|
|
|
if [[ "${pont_init}" -eq 1 && "${vlan_init}" -eq 2 && "${interface_init}" -eq 1 ]]; then
|
|
|
|
if [[ "${pont_init}" -eq 1 && "${vlan_init}" -eq 2 && "${interface_init}" -eq 1 ]]; then
|
|
|
|
# Commandes à executer au demarrage
|
|
|
|
# Commandes à executer au demarrage
|
|
|
|
commandes_a_executer_on+=( "ip tuntap add ${interface} mode tap" )
|
|
|
|
commandes_a_executer_on+=( "${bin_ip} tuntap add ${interface} mode tap" )
|
|
|
|
commandes_a_executer_on+=( "ip link set ${interface} up" )
|
|
|
|
commandes_a_executer_on+=( "${bin_ip} link set ${interface} up" )
|
|
|
|
commandes_a_executer_on+=( "ip link set ${interface} master ${pont}" )
|
|
|
|
commandes_a_executer_on+=( "${bin_ip} link set ${interface} master ${pont}" )
|
|
|
|
# Commandes à exectuer à l'arrêt
|
|
|
|
# Commandes à exectuer à l'arrêt
|
|
|
|
commandes_a_executer_off+=( "ip link del ${interface}" )
|
|
|
|
commandes_a_executer_off+=( "${bin_ip} link del ${interface}" )
|
|
|
|
|
|
|
|
|
|
|
|
# Réinitialisation des variables témoins
|
|
|
|
# Réinitialisation des variables témoins
|
|
|
|
pont_init=0
|
|
|
|
pont_init=0
|
|
|
@ -565,13 +567,13 @@ genCmdIntRzo(){
|
|
|
|
# Création d'une interface non étiqueté (access)
|
|
|
|
# Création d'une interface non étiqueté (access)
|
|
|
|
elif [[ "${pont_init}" -eq 1 && "${vlan_init}" -eq 1 && "${interface_init}" -eq 1 ]]; then
|
|
|
|
elif [[ "${pont_init}" -eq 1 && "${vlan_init}" -eq 1 && "${interface_init}" -eq 1 ]]; then
|
|
|
|
# Commandes à executer au demarrage
|
|
|
|
# Commandes à executer au demarrage
|
|
|
|
commandes_a_executer_on+=( "ip tuntap add ${interface} mode tap" )
|
|
|
|
commandes_a_executer_on+=( "${bin_ip} tuntap add ${interface} mode tap" )
|
|
|
|
commandes_a_executer_on+=( "ip link set ${interface} up" )
|
|
|
|
commandes_a_executer_on+=( "${bin_ip} link set ${interface} up" )
|
|
|
|
commandes_a_executer_on+=( "ip link set ${interface} master ${pont}" )
|
|
|
|
commandes_a_executer_on+=( "${bin_ip} link set ${interface} master ${pont}" )
|
|
|
|
commandes_a_executer_on+=( "bridge vlan del dev ${interface} vid 1 PVID untagged master" )
|
|
|
|
commandes_a_executer_on+=( "${bin_bridge} vlan del dev ${interface} vid 1 PVID untagged master" )
|
|
|
|
commandes_a_executer_on+=( "bridge vlan add dev ${interface} vid ${vlan} pvid untagged master" )
|
|
|
|
commandes_a_executer_on+=( "${bin_bridge} vlan add dev ${interface} vid ${vlan} pvid untagged master" )
|
|
|
|
# Commandes à exectuer à l'arrêt
|
|
|
|
# Commandes à exectuer à l'arrêt
|
|
|
|
commandes_a_executer_off+=( "ip link del ${interface}" )
|
|
|
|
commandes_a_executer_off+=( "${bin_ip} link del ${interface}" )
|
|
|
|
|
|
|
|
|
|
|
|
# Réinitialisation des variables témoins
|
|
|
|
# Réinitialisation des variables témoins
|
|
|
|
pont_init=0
|
|
|
|
pont_init=0
|
|
|
@ -580,15 +582,15 @@ genCmdIntRzo(){
|
|
|
|
|
|
|
|
|
|
|
|
# Création d'une interface étiqueté (trunk)
|
|
|
|
# Création d'une interface étiqueté (trunk)
|
|
|
|
elif [[ "${pont_init}" -eq 1 && "${ieee8021q_init}" -eq 1 && "${interface_init}" -eq 1 ]]; then
|
|
|
|
elif [[ "${pont_init}" -eq 1 && "${ieee8021q_init}" -eq 1 && "${interface_init}" -eq 1 ]]; then
|
|
|
|
commandes_a_executer_on+=( "ip tuntap add ${interface} mode tap" )
|
|
|
|
commandes_a_executer_on+=( "${bin_ip} tuntap add ${interface} mode tap" )
|
|
|
|
commandes_a_executer_on+=( "ip link set ${interface} up" )
|
|
|
|
commandes_a_executer_on+=( "${bin_ip} link set ${interface} up" )
|
|
|
|
commandes_a_executer_on+=( "ip link set ${interface} master ${pont}" )
|
|
|
|
commandes_a_executer_on+=( "${bin_ip} link set ${interface} master ${pont}" )
|
|
|
|
commandes_a_executer_on+=( "bridge vlan del dev ${interface} vid 1 PVID untagged master" )
|
|
|
|
commandes_a_executer_on+=( "${bin_bridge} vlan del dev ${interface} vid 1 PVID untagged master" )
|
|
|
|
for ((id_label_vlan=0 ; "${nb_params_label}" - "${id_label_vlan}" ; id_label_vlan++)); do
|
|
|
|
for ((id_label_vlan=0 ; "${nb_params_label}" - "${id_label_vlan}" ; id_label_vlan++)); do
|
|
|
|
commandes_a_executer_on+=( "bridge vlan add dev ${interface} vid ${label_vlan[${id_label_vlan}]} tagged master" )
|
|
|
|
commandes_a_executer_on+=( "${bin_bridge} vlan add dev ${interface} vid ${label_vlan[${id_label_vlan}]} tagged master" )
|
|
|
|
done
|
|
|
|
done
|
|
|
|
# Commandes à exectuer à l'arrêt
|
|
|
|
# Commandes à exectuer à l'arrêt
|
|
|
|
commandes_a_executer_off+=( "ip link del ${interface}" )
|
|
|
|
commandes_a_executer_off+=( "${bin_ip} link del ${interface}" )
|
|
|
|
|
|
|
|
|
|
|
|
# Réinitialisation des variables témoins
|
|
|
|
# Réinitialisation des variables témoins
|
|
|
|
pont_init=0
|
|
|
|
pont_init=0
|
|
|
@ -611,7 +613,7 @@ recupParams(){
|
|
|
|
# Récupération des données d'après le fichier de configuration
|
|
|
|
# Récupération des données d'après le fichier de configuration
|
|
|
|
if [ "${nom_param}" == "PONT" ]; then
|
|
|
|
if [ "${nom_param}" == "PONT" ]; then
|
|
|
|
if [[ ${verif_params} == "vrai" ]]; then
|
|
|
|
if [[ ${verif_params} == "vrai" ]]; then
|
|
|
|
if [[ $(ip link show "${val_param}" 2> /dev/null) ]]; then
|
|
|
|
if [[ $(${bin_ip} link show "${val_param}" 2> /dev/null) ]]; then
|
|
|
|
pont="${val_param}"
|
|
|
|
pont="${val_param}"
|
|
|
|
pont_init=1
|
|
|
|
pont_init=1
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -651,7 +653,7 @@ recupParams(){
|
|
|
|
done
|
|
|
|
done
|
|
|
|
elif [ "${nom_param}" == "INTERFACE" ]; then
|
|
|
|
elif [ "${nom_param}" == "INTERFACE" ]; then
|
|
|
|
if [[ ${verif_params} == "vrai" ]]; then
|
|
|
|
if [[ ${verif_params} == "vrai" ]]; then
|
|
|
|
if [[ ! $(ip link show "${val_param}" 2> /dev/null) ]]; then
|
|
|
|
if [[ ! $(${bin_ip} link show "${val_param}" 2> /dev/null) ]]; then
|
|
|
|
if [[ "${vlan_init}" -eq 1 || "${vlan_init}" -eq 2 || "${ieee8021q_init}" -eq 1 ]]; then
|
|
|
|
if [[ "${vlan_init}" -eq 1 || "${vlan_init}" -eq 2 || "${ieee8021q_init}" -eq 1 ]]; then
|
|
|
|
interface="${val_param}"
|
|
|
|
interface="${val_param}"
|
|
|
|
interface_init=1
|
|
|
|
interface_init=1
|
|
|
|