Newbie: DHCP only works from console

Ormek

Cadet
Joined
Dec 26, 2020
Messages
3
Hi,

I just installed TrueNAS (12.2-RELEASE-p2) for the first time. Now I can get an ip address via DHCP only, if I do it manually through the console shell. How can I fix it, to work immediatly after every reboot?

After reboot the console states the web user interface is assigned https://0.0.0.0. So, getting an address via DHCP did not work.
If I go into 9) Shell. I can make it work with the following:
Code:
root@truenas[~]# ifconfig re0 down
Dec 26 06:51:52 truenas 1 2002-12-26T06:51:52.917109-08:00 truenas.local dhclient 1265 - - Interface re0 is down, dhclient exiting
root@truenas[~]# Dec 26 06:51:52 truenas 1 2002-12-26T06:51:52.922961-08:00 truenas.local dhclient 1265 - - connection closed
Dec 26 06:51:52 truenas 1 2002-12-26T06:51:52.923110-08:00 truenas.local dhclient 1265 - - exiting.
ifconfig re0 up
root@truenas[~]#service dhclient forcestart re0
Starting dhclient.
DHCPDISCOVER on re0 to 255.255.255.255 port 67 interval 8
DHCPOFFER from 192.168.0.1
DHCPREQUEST on re0 to 255.255.255.255 port 67
DHCPACK from 192.168.0.1
bound to 192.168.0.61 -- renewal in 1800 seconds.

After that I can access the system using its web interface. Network connection seems to be fine. Of course, I like the system to automatically receive its IP address, either via DHCP or through static allocation. (The later did not work for me either: I could set an address, but not connect to anything. I did not investigate further on that path, so no detailed description here.)

Here are my hardware details:
  • Motherboard make and model
    • MSI B75MA-P45 G43 MS-7798
  • CPU make and model
    • Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
  • RAM quantity
    • 16GB
  • Hard drives, quantity, model numbers, and RAID configuration, including boot drives
    • Shouldn't yet matter, because I am not configuring/using them yet.
    • I am booting from a 32GB ScanDisk USB-Stick
    • 2 HDD drives: WDC WD10EADS-22M2B0 931GB (will eventually be used in a pool)
    • 2 HDD drives: SAMSUNG HD154UI 1.36TB (will eventually be used in a pool)
    • 1 SSD drive: Crucial CT500MX200SSD1 (should not be touched by trueNAS)
  • Hard disk controllers
    • Intel 7 Series/C210 Series Chipset Family 6-port SATA Controller [AHCI mode]
  • Network cards
    • RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
The whole thing is about reusing existing hardware to have some NAS-storage at home for backup and external storage. I read, that realtek controller do cause problems (at least in the past), but it does seem to work, after I force it.

Some other things I tried and their outcome:
Code:
root@truenas[~]# service dhclient restart re0 
're0' is not a DHCP-enabled interface
dhclient already running? (pid=1203).

Code:
root@truenas[~]# service dhclient forcerestart re0 
Stopping dhclient
WAITING for PIDS: 1878Dec 26 07:26:40 truenas 1 2020-12-26T07:26:40.677757-08:00 truenas.local dhclient 1206 - - connection closed
Dec 26 07:26:40 truenas 1 2020-12-26T07:26:40.677855-08:00 truenas.local dhclient 1206 - - exiting.
.
Starting dhclient.
DHCPDISCOVER on re0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on re0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on re0 to 255.255.255.255 port 67 interval 21
DHCPDISCOVER on re0 to 255.255.255.255 port 67 interval 21
DHCPDISCOVER on re0 to 255.255.255.255 port 67 interval 2
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

Code:
root@truenas[~]# service dhclient status re0 
dhclient is running as pid 1970.
root@truenas[~]# service dhclient stop re0 
're0' is not a DHCP-enabled interface


As it seems, I have to "down and up" the interface to get an ip address -- or maybe event to actually enable it. Running those 3 lines of code after boot automatically, might be workaround, but I'd rather like to know how to configure the system to work in the first place.

What surprises me is that re0 is not recognized as a DHCP-enabled interface, but a dhclient is running for it after reboot.
I attached the output of dmesg. As you can see the disks have problems too, but that I like to address later.

I hope you can point me to better diagnosing the problem and eventually resolve it.

Thanks in advance,
Oliver
 

Attachments

  • truenas.dmesg.txt
    51.6 KB · Views: 302

Tigersharke

BOfH in User's clothing
Administrator
Moderator
Joined
May 18, 2016
Messages
893
I'm sorry that your request for help seems to have been overlooked, missed.

I am not an expert with networking though presently things seem to be working fine on my FreeBSD system overall. What do you have in your /etc/rc.conf or /etc/rc.conf.local file?

You may need to add lines such as those below, adjust for your router's IP:
Code:
network_interfaces="re0 lo0"
defaultrouter="172.16.0.1"
background_dhclient="YES"
ifconfig_re0="up"
ifconfig_re0="DHCP"
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
As discussed in many other threads, the Realtek interfaces are buggy, and it depends on the particular chipset. Failing to come up and needing to be poked-at is definitely one of the known failure modes. The Realteks are powered by a hamster or two in a spinny wheel, and yours may just be permanently crippled or something.

Most users end up being very unhappy with them, and we typically suggest that people buy a (real, non-knockoff) Intel Desktop CT adapter instead, which works swimmingly well with FreeNAS.

You can also try installing a post-boot task that toggles the interface down and up until it "takes."
 
Last edited:

Ormek

Cadet
Joined
Dec 26, 2020
Messages
3
Thank you for your feedback. I did try as @Tigersharke suggested. I first had to figure out I need to change /conf/base/etc/rc.conf. It did not help though: the interface did try for a few seconds to reach the defaultrouter, but then failed again. No change on the DHCP front.

I now placed a script on [/conf/base]/mnt/myscripts (although that folder will probably be gone with the next update) and run it post-init as a task.
My problem is thus resolved.

Thank you!
 
Top