IP routing

This commit is contained in:
Kroese 2023-05-10 05:48:46 +02:00 committed by GitHub
parent fa69ff9166
commit 3a41f2dda0

View File

@ -27,6 +27,8 @@ configureDHCP() {
IP=$(ip address show dev "${VM_NET_DEV}" | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/)
[[ "${DEBUG}" == [Yy1]* ]] && set -x
# Create a macvlan network to allow for communication between the host and the VM guest
{ ip link add link "${VM_NET_DEV}" "${VM_NET_VLAN}" type macvlan mode bridge ; rc=$?; } || :
if (( rc != 0 )); then
@ -41,6 +43,7 @@ configureDHCP() {
ip route del "${NETWORK}" dev "${VM_NET_DEV}"
ip route add "${NETWORK}" dev "${VM_NET_VLAN}" metric 0
# Create a macvtap network for the VM guest
{ ip link add link "${VM_NET_DEV}" name "${VM_NET_TAP}" address "${VM_NET_MAC}" type macvtap mode bridge ; rc=$?; } || :
if (( rc != 0 )); then
@ -50,9 +53,6 @@ configureDHCP() {
ip link set "${VM_NET_TAP}" up
ip address flush "${VM_NET_DEV}"
ip address flush "${VM_NET_TAP}"
{ set +x; } 2>/dev/null
TAP_NR=$(</sys/class/net/"${VM_NET_TAP}"/ifindex)
@ -95,7 +95,6 @@ configureNAT () {
[[ "${DEBUG}" == [Yy1]* ]] && set -x
# Create bridge with static IP for the VM guest
{ ip link add dev dockerbridge type bridge ; rc=$?; } || :
if (( rc != 0 )); then