Solved Unable to get DNS service

I'm not sure if I understand. You are DHCP client in this scenario, you can't generally influence what DHCP server gives you. You can manually alter resolv.conf to whatever you want but depending on network settings you may not be able to use it -- your exact problem with google's DNS.

I don't use FreeBSD for desktop any more, I'm not sure if there's an option to do this (change part of the network config based on location) automatically. On Solaris you can assign network profiles.
Maybe somebody will answer you in that thread.
Yes, so my problem now is when I use windows or other OS, DNS server is automatically assigned by DHCP protocol (there is an option to change manually). But what I am facing in FreeBSD now is I can only get assigned IP but not DNS server from DHCP server, I can only do it manually (via altering resolv.conf). And if I leave it empty, it just doesn't use any DNS server for lookup. So I was wondering if there is a way to let FreeBSD work like other OS (like shown in picture below) get both IP and DNS server from DHCP server.

Screenshot 2023-05-05 213740.png
 
Picture was not required for it.
Maybe this is a WM (window manager) specific issue. Given your network, I don't know why resolv.conf didn't get updated. Even within WM, when you open a console and change to root, doing dhclient wlan0 should update resolv.conf.

But then again, I'm not using FreeBSD as desktop. My experiece with WM and wlan devices is limited.
 
Picture was not required for it.
Maybe this is a WM (window manager) specific issue. Given your network, I don't know why resolv.conf didn't get updated. Even within WM, when you open a console and change to root, doing dhclient wlan0 should update resolv.conf.

But then again, I'm not using FreeBSD as desktop. My experiece with WM and wlan devices is limited.
Thanks anyway!! You already helped a lot.
 
If I am not mistaken, It is already doing that unless you edit resolv.conf manually. You can delete it and it should set the appropriate nameserver every time dhclient(8) is called.

If you still want to use google's ns, you can use local-unbound(8).

/etc/rc.conf
Code:
local_unbound_enable="YES"

/etc/resolv.conf
Code:
nameserver 127.0.0.1
options edns0

/var/unbound/forward.conf
Code:
forward-zone:
    name: "."
    forward-addr: 8.8.8.8
    forward-addr: 8.8.4.4

/var/unbound/unbound.conf
Code:
include: /var/unbound/forward.conf
 
If I am not mistaken, It is already doing that unless you edit resolv.conf manually. You can delete it and it should set the appropriate nameserver every time dhclient(8) is called.

If you still want to use google's ns, you can use local-unbound(8).

/etc/rc.conf
Code:
local_unbound_enable="YES"

/etc/resolv.conf
Code:
nameserver 127.0.0.1
options edns0

/var/unbound/forward.conf
Code:
forward-zone:
    name: "."
    forward-addr: 8.8.8.8
    forward-addr: 8.8.4.4

/var/unbound/unbound.conf
Code:
include: /var/unbound/forward.conf
Thanks for the advice, I've tried deleting resolve.conf as well as leaving it blank, and kill current dhclient(8) and start a new one. Neither of these provided me name service(both return Unknown host aftering pinged google.com).
And I will check unbound out in the future but it's not what I want at the moment.
 
Back
Top