Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Default is great if you want something that just works without any configuration or setup. However, if you have spent a week or more learning how to use a pfSense VM, then you probably want to use that to get to the outside world.Your problem is that each VM is connected to eth0 and eth1 and now since both have DHCP, both adapters have received not only an IP address but also a gateway and a DNS address. You can configure the VM to prefer a specific DNS server address. You cannot ungateway an Ethernet adapter that has a gateway address assigned by DHCP. You have to express a preference by changing a “metric” number in etc/netplan/50-cloud-init.yaml. The

vanilla This is the problem with a “multihomed” machine (a read or virtual computer with two network adapters both of which are configured to have different gateway and DNS server addresses). No operating system knows what to do, and the rules for resolving the ambiguity are usually hidden.

Except here, where the Multipass documentation clearly states that they configure eth0 to be preferred by setting the route-metric of all other adapters to 200 (while eth0 has the default value of 100 which is better). This is by design. So if Sandbox has an IP subnet of 192.168.4.0/24, then each system will only use eth1 to talk to a destination on that subnet. All other traffic to all other addresses goes out eth0, the Default network, and the Host NAT.

If you want to change this edit etc/netplan/50-cloud-init.yaml. The vanilla file installed by Multipass looks like this:

Code Block
network:
    ethernets:
        default:
            dhcp4: true
            match:
                macaddress: 52:54:00:0c:8d:5e
        extra0:
            dhcp4: true
            dhcp4-overrides:
                route-metric: 200
            match:
                macaddress: 52:54:00:e2:fc:f7
            optional: true

The two LAN adapters are identified by their Ethernet macaddress, which is generated by Hyper-V when the VM first starts up and connects to the networks. Here the second adapter is called extra0 and you can recognize it because it is listed second and because it is optional: true. The important part is the line

route-metric: 200.

The default value when none is specified is 100, which you can see applies to the first adapter “default:”. Linux prefers the adapter with the lower metric. So you need to change the route-metric of the second adapter from “200” to pretty much anything less that 100 (say 50). Save the file and now each VM will prefer to route external traffic to the Sandbox network and its pfSense (or other type) of routerChange the line on the second adapter where it says

route-metric: 200.

Change 200 to 50, or any number less than 100. Reboot or reload the network configuration this VM will use eth0 only to talk to addresses on the Default network and will send all non-local traffic to the gateway in Sandbox (pfSense or TPLink).

Again I will point to the same reference document for the file, which is no more helpful on this point than the previous change https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html .