Networking with SIMH (or QEMU) on Debian (buster)

When upgrading my system I discovered that there are some obvious (and not so obvious) changes needed to my original post on order to get networking to work with SIMH and QEMU.

As usual begin by making sure your system is up to date.

apt-get update; apt-get upgrade

Then we need to install the packages to allow us to create the TAP/TUN interfaces and create a network bridge to allow them to connect to the network.

apt-get install libpcap0.8 bridge-utils uml-utilities
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  user-mode-linux
The following NEW packages will be installed:
  bridge-utils libpcap0.8 uml-utilities
0 upgraded, 3 newly installed, 0 to remove and 1 not upgraded.
Need to get 226 kB of archives.
After this operation, 729 kB of additional disk space will be used.
  :
  :
  :
Setting up libpcap0.8:amd64 (1.8.1-6) ...
Setting up bridge-utils (1.6-2) ...
Setting up uml-utilities (20070815.2-1) ...
Processing triggers for systemd (241-7~deb10u3) ...
Processing triggers for libc-bin (2.28-10) ...
 

Then we need to configure the network interfaces, if you are using SIMH you need to create at least one ‘tap’ interface, but I prefer to create multiple interfaces so I can dedicate an interface to each virtual machine that I run using SIMH.

The obvious difference between this version of the configuration file and the original it that the command to bring up each interface has changed, the less obvious difference is that if you are only using QEMU you just need to configure the network bridge and can skip the sections in red since QEMU now creates the devices on the fly (and it doesn’t use any existing device names so you can use QEMU and SIMH on the same system at the same time).

nano  /etc/network/interfaces

/etc/network/interfaces
 
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
 
source /etc/network/interfaces.d/*
 
# The loopback network interface
auto lo
iface lo inet loopback
 
# The wireless network interface
allow-hotplug wlan0
iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
 
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
 
# Virtual interface
auto tap0
iface tap0 inet manual
   pre-up tunctl -t tap0 -u <username>
   up ip link set dev tap0 up
   down ip link set dev tap0 down
 
# Virtual interface
auto tap1
iface tap1 inet manual
   pre-up tunctl -t tap1 -u <username>
   up ip link set dev tap1 up
   down ip link set dev tap1 down
 
# Virtual interface
auto tap2
iface tap2 inet manual
   pre-up tunctl -t tap2 -u <username>
   up ip link set dev tap2 up
   down ip link set dev tap2 down
 
# Virtual interface
auto tap3
iface tap3 inet manual
   pre-up tunctl -t tap3 -u <username>
   up ip link set dev tap3 up
   down ip link set dev tap3 down
 

# Bridge interface 
auto br0
iface br0 inet static
   address 192.168.0.167
   netmask 255.255.255.0
   network 192.168.0.0
   broadcast 192.168.0.255
   gateway 192.168.0.254
   bridge_ports eth0 tap0 tap1 tap2 tap3
   bridge_stp off
   bridge_maxwait 5

Note – Don’t forget to comment out the physical network interface configuration.

For all these changes to take effect you need to reboot.

reboot

After rebooting you should see the new interfaces by listing the current IP addresses.

ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
    link/ether 2c:41:38:17:5a:e8 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether a0:88:b4:e8:1e:ac brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.67/24 brd 192.168.0.255 scope global dynamic wlan0
       valid_lft 3530sec preferred_lft 3530sec
4: tap0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master br0 state DOWN group default qlen 1000
    link/ether 5e:1b:5e:e3:23:a8 brd ff:ff:ff:ff:ff:ff
5: tap1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master br0 state DOWN group default qlen 1000
    link/ether 62:50:5a:88:04:34 brd ff:ff:ff:ff:ff:ff
6: tap2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master br0 state DOWN group default qlen 1000
    link/ether 22:1a:26:17:4f:fc brd ff:ff:ff:ff:ff:ff
7: tap3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master br0 state DOWN group default qlen 1000
    link/ether 46:dd:65:7d:e6:f7 brd ff:ff:ff:ff:ff:ff
8: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 22:1a:26:17:4f:fc brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.167/24 brd 192.168.0.255 scope global br0
       valid_lft forever preferred_lft forever

This entry was posted in Debian, Networking, Virtualisation and tagged , , . Bookmark the permalink.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.