Virtual Machine (interface enp0s4) not assigned dynamic IPv4 address

bar17

Dabbler
Joined
Oct 24, 2019
Messages
33
I have a Ubuntu Server 20.04 virtual machine running on my FreeNAS 11.3-U5 box.

My problem is that my virtual Ubuntu Server is not being assigned an IP address.

I have an Edge Router X with Subnet 10.17.16.0/21 and gateway 10.17.17.4. The DHCP server runs on the Edge Router X.

I recently switched from a NetGear r7000 to my current Edge Router X (ERX) router and only use the r7000 as an AP with DHCP turned off. After years of reliable dd-wrt service it started having some weird problems. Since upgrading to the ERX, everything has been rock solid and all devices on my network have been assigned an IP by the Edge Router X DHCP server, except my virtual VM.

In the past, I had a problem with my virtual Ubuntu server on the FreeNAS. The problem and solution was to edit `/etc/netplan/00-installer-config.yaml` and change `enp0s5` to `enp0s4` as seen here "https://www.truenas.com/community/t...04-server-in-vm-has-no-internet-access.75684/" @KrisBee had the solution. That problem had to do with removing a virtual CD ROM interface and the network interface #/position changing. It is not the current problem, but could be related somehow. Currently, the interface is assigned to the correct physical port and is using the `VIRTIO` interface.

Current /etc/netplan/00-installer-config.yaml configuration:

Code:
    
network:
      ethernets:
        enp0s4:
        dhcp4: true
     version: 2


I think there is something funny with the way that Ubuntu Server, FreeNAS, and the virtual NIC all interact.

Code:
           > ip a
        
           1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default glen 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
               inet6 ::1/128 scope host
                 valid_lft forever preferred_lft forever
           2: enp0s4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default glen 1000
               link/ether 00:a0:98:29:a9:c4 brd ff:ff:ff:ff:ff:ff
               inet6 fe80,2a0:98ff:fe29:a9c4/64 scope link
                 valid_lft forever preferred_lft forever 


As you can see, there is no IPv4 address on the virtual enp0s4 interface.

On boot there is an error message:

"A start job is running for wait for network to be configured".

Searching this error gives suggestions to restart the networking service and/or edit the above mentioned yaml file by adding the line:
optional: true`. Neither of these work.

Running ip route returns nothing.

ping google.com returns ping: google.com: Temporary failure in name resolution.

ip add 10.17.17.99 dev enp0s4

Adds inet 10.17.17.99/32 scope global enp0s4 to the enp0s4 interface.

ip route add 10.17.17.4 dev enp0s4 adds the route 10.17.17.4 dev enp0s4 scope link to the routing table (previously blank).

Neither of these together or separate fix the problem.

If I try the above commands with a subnet \21 it does not work.

The one relevant change I did do that coincides with this problem is that when I switched my routers I changed my network form 10.17.17.0 to 10.17.16.0 because to increase my IP range with the subnet \21 I had to otherwise my router said it was an invalid subnet. Perhaps the virtual machine somehow has the gateway or the subnet mask fixed and is not updating?

I would love to understand how to completely break down/disable/refresh the entire network interface and have the server request an IP from my router. I am not sure if this is a problem specific to the bhyve / freenas vm networking interface (like the above linked problem I had previously) or if it is more generic to linux ubuntu server networking.

Any help is appreciated.
 
Joined
Sep 2, 2018
Messages
5
Hi, Just ran into this on my TrueNas 12.0-U1.1 machine with Ubuntu Server 20.04.1 VM.

I found this forum post that helped out:

Basically, the network device changed from
enp0s5
to
enp0s4 (possibly after removing the CDROM? although I may have switch from VirtIO to the intel E1000)

Updating the network configuration file and running

netplan apply

allowed DHCP to be provision the IP adddress.

Good Luck!
 
Top