Fix macvtap issues and move to network_mode: host
This commit is contained in:
parent
c228d08149
commit
343b79a659
@ -1,4 +1,5 @@
|
|||||||
FROM alpine
|
FROM ubuntu
|
||||||
RUN apk add qemu-system-x86_64 qemu-modules bash
|
# iproute2 in Alpine linux does not properly handle macvtap interfaces
|
||||||
|
RUN apt-get update && apt-get install -y qemu-kvm bash iproute2
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
ENTRYPOINT /entrypoint.sh
|
ENTRYPOINT /entrypoint.sh
|
||||||
|
10
README.md
10
README.md
@ -24,3 +24,13 @@ Insert Jenkins or your favourite CI/CD software SSH public keys into
|
|||||||
`C:\ProgramData\ssh\administrators_authorized_keys` and adjust ACL-s as described
|
`C:\ProgramData\ssh\administrators_authorized_keys` and adjust ACL-s as described
|
||||||
[here](https://www.concurrency.com/blog/may-2019/key-based-authentication-for-openssh-on-windows)
|
[here](https://www.concurrency.com/blog/may-2019/key-based-authentication-for-openssh-on-windows)
|
||||||
Use the resulting virtual machine disk image with this Docker image.
|
Use the resulting virtual machine disk image with this Docker image.
|
||||||
|
|
||||||
|
|
||||||
|
# Debugging
|
||||||
|
|
||||||
|
If you can't ping the VM from host, make sure bridge mode is used
|
||||||
|
on the macvlanX interface:
|
||||||
|
|
||||||
|
```
|
||||||
|
ip -d link show type macvtap
|
||||||
|
```
|
||||||
|
@ -2,14 +2,17 @@
|
|||||||
set -x
|
set -x
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Create macvlan interface on Docker's eth0
|
PARENT=bond0.1
|
||||||
ip link add link eth0 name macvtap0 type macvtap mode bridge
|
MACVTAP=macvtap$OFFSET
|
||||||
ip link set dev macvtap0 address ${MAC:?}
|
|
||||||
ip link set macvtap0 up
|
! ip link delete $MACVTAP
|
||||||
|
ip link add link $PARENT name $MACVTAP type macvtap mode bridge
|
||||||
|
ip link set dev $MACVTAP address ${MAC:?}
|
||||||
|
ip link set $MACVTAP up
|
||||||
|
|
||||||
# No udev in Docker
|
# No udev in Docker
|
||||||
IFS=: read major minor < <(cat /sys/devices/virtual/net/macvtap0/tap*/dev)
|
IFS=: read major minor < <(cat /sys/devices/virtual/net/$MACVTAP/tap*/dev)
|
||||||
DEV=/dev/tap$(cat /sys/class/net/macvtap0/ifindex)
|
DEV=/dev/tap$(cat /sys/class/net/$MACVTAP/ifindex)
|
||||||
rm -fv $DEV
|
rm -fv $DEV
|
||||||
mknod $DEV c $major $minor
|
mknod $DEV c $major $minor
|
||||||
|
|
||||||
@ -25,5 +28,6 @@ mknod $DEV c $major $minor
|
|||||||
-usb \
|
-usb \
|
||||||
-device usb-ehci,id=ehci \
|
-device usb-ehci,id=ehci \
|
||||||
-device usb-tablet,bus=usb-bus.0 \
|
-device usb-tablet,bus=usb-bus.0 \
|
||||||
-vnc :0 \
|
-netdev tap,id=hostnet0,fd=9 9<>$DEV \
|
||||||
-netdev tap,id=hostnet0,vhost=on,fd=9 9<>$DEV
|
-nographic -vga qxl
|
||||||
|
# -vnc :$OFFSET
|
||||||
|
Loading…
Reference in New Issue
Block a user