From 6cd83509f6da8641c8510f3c778c04390ca160df Mon Sep 17 00:00:00 2001 From: primardj Date: Thu, 1 Feb 2024 02:24:27 +0000 Subject: [PATCH] add possibility to connect two vm on the same bridge. --- vm-start.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/vm-start.sh b/vm-start.sh index 133202e..b9cf1a5 100755 --- a/vm-start.sh +++ b/vm-start.sh @@ -38,7 +38,7 @@ OPTION available -display gtk -vga qxl create_disk= Def a create disk to boot on. Is necessary for using create, or need the variable INSTALLATION_DISK_LOCATION to be set. net=nat:id Add a nat connection to the vm. By default there is already one. - net=tap: Connect the vm to the tap interface . Please use the script set-tap.sh as root to create the tap interface. #TODO + net=tap: Connect the vm to the tap interface . Please use the script set-tap.sh as root to create the tap interface. in the conf file, a mac field have to be set. for two vm to connect togethers, their mac addresses on the same network have to be differents. net=none The vm will have no network interface " @@ -208,7 +208,15 @@ set_net() { -device virtio-net,netdev=${1#*:}" ;; "tap") - echo "tap" + echo "ajout de l'interface tap ${1#*:}" + if [ "${mac}" == "" ] + then + echo "error, no mac set" + exit 1 + fi + network="${network} \ + -netdev bridge,id=${1#*:} \ + -device virtio-net,netdev=${1#*:},mac=${mac}" ;; "none") echo "no interface will be connected."