:: [DNG] Assigning a specific subnet a…
Página Inicial
Delete this message
Reply to this message
Autor: Steve Litt
Data:  
Para: dng
Assunto: [DNG] Assigning a specific subnet and address to a Devuan Beowulf Qemu guest
Hi all,

My ultimate goal is to have a Devuan VM guest on my Void Linux Daily
Driver Desktop (DDD) that acts like just another metal computer on my
LAN at 192.168.0.0/24. I want it to have address 192.168.0.66. I've
tried to do this sporadically over the past 2 years, never with success.

Here's how far I've gotten: I have a shellscript called upnet.sh that
sets up networking on my DDD, which has no /etc/network/interfaces and
instead requires commands to set up the network. It also sets up
network bridge br0 and tap tap0. It is shown immediately below:

============================================================
#!/bin/sh

# MAKE SURE IP FORWARDING IS ENABLED
echo 1 > /proc/sys/net/ipv4/ip_forward

# DEAL WITH HOSTNAME AND LOCALHOST
hostname=`grep -v "^\s*#" /etc/hostname | head -n1`
ip link set dev lo up

# UNDO ANY POSSIBLE STUFF FROM PREVIOUS UPNET.SH
ip link set dev tap0 down
brctl delif br0 tap0
ip link set dev br0 down
ip addr del 192.168.0.102/24 dev br0
ip addr del 192.168.0.2/24 dev br0
brctl delbr br0
ip link set dev enp40s0 down
ip addr del 192.168.0.102/24 dev enp40s0
ip addr del 192.168.0.2/24 dev enp40s0

# BRING UP enp40s0
ip link set dev enp40s0 up

### GET br0 UP AND RUNNING WITH RIGHT IP ADDRESSES
ip link add name br0 type bridge
ip link set dev enp40s0 master br0
ip addr add 192.168.0.2/24 dev br0
ip addr add 192.168.0.102/24 dev br0
ip link set dev br0 up
ip route add default via 192.168.0.1

### DO THE TUN/TAP STUFF
ip tuntap add tap0 mode tap
brctl addif br0 tap0
ip link set dev tap0 up
============================================================

The ip link, ip addr, and ip route commands shows this works perfectly
on my DDD.

The shellscript that runs my Devuan VM follows:


============================================================
#!/bin/sh

dvddir=/scratch/linuxinst/devuan/devuan_beowulf/installer-iso

qemu-system-x86_64 -m 1024 \
-hda beowulf.disk \
-cdrom $dvddir/devuan_beowulf_3.0.0_amd64-desktop.iso \
-boot c -ctrl-grab -cpu max -vga std -enable-kvm \
-net nic,model=virtio,macaddr=00:00:00:00:00:01 -net tap,ifname=tap0
============================================================

The resulting Devuan VM guest works just fine, can ssh to my LAN
computers, can ssh to my Internet host, but it's still 10.0.2.15 with
default route 10.0.2.2. I want it 192.168.0.66 with default route
192.168.0.1.

I tried setting the VM guest's /etc/network/interfaces to static with
address 192.168.0.66, with the gateway, netmask etc set accordingly,
but after doing that, ip addr on the VM showed no IP address at all.

I feel like I'm closer than I've ever been before, but I'm not there
yet. How do I set up my Devuan VM guest to 192.168.0.66, with proper
gateway, etc, so it can be just another computer on my 192.168.0.0/24
LAN?

Thanks,

SteveT

Steve Litt
Autumn 2020 featured book: Thriving in Tough Times
http://www.troubleshooters.com/thrive