Solved question about DNS resolve with fix IP and defaultrouter in freebsd14.3 ?

dear all:
i am newguy... now i have made configure with re0 network card in below.
#for Slcom
ifconfig_re0="inet 172.20.1.2 netmask 255.255.255.0"
defaultrouter="172.20.1.254"

the file /etc/resolv.conf configuration as below .
nameserver 1.1.1.1
nameserver 8.8.8.8

i can use my re0 ping gateway ....it's working . but when i ping bing.com it's not work ..
so ii check the dns with command resolvconf -l ,i got nothing...

i think i have fix the IP and gateway. so the dns was not work.

how to fix my issue ? thanks.
 
Chances are you don't have any connectivity beyond your gateway. Google and CloudFlare public DNS 8.8.8.8 and 1.1.1.1 are also pingable, so you should have success if you ping them directly by IP. If that doesn't work, two things could be the matter:

1. Your gateway/firewall blocks those resolvers. Not very likely, but not completely out of the question either.
2. You don't have connectivity beyond your gateway at all.

So.. I looked up Bing for you, and when I did it lived at 150.171.28.10. That IP should also be pingable for you.

If none of the IP's results in a ping, you probably don't have connectivity beyond your gateway. Check your local routing table. Here's mine:

Code:
$ netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags         Netif Expire
default            10.0.10.1          UGS             re0
10.0.10.0/24       link#1             U               re0
10.0.10.26         link#2             UHS             lo0
127.0.0.1          link#2             UH              lo0

Yours should show a 'default' line that has 172.20.1.254 as its gateway. If it doesn't, try restarting routing:

Code:
#/etc/rc.d/routing restart

..or just do a reboot, and check your tables again. It should definitely have picked up your gateway by now and things should be working.
 
resolvconf(8) is used to maintain the information from the DHCP and ppp or other VPN service to update the/etc/resolv.conf file. It's not used to retrieve the information from the file.
So when you configure your static IP address and put static DNS nameservers in/etc/resolv.conf you will not get any information back using resolvconf -l command.
If you want to see if your DNS is working you can use the host command or drill to query the IP address from the hostname for example:
host bing.com
bing.com has address 150.171.27.10
bing.com has address 150.171.27.10
bing.com has IPv6 address 2620:1ec:33::10
bing.com has IPv6 address 2620:1ec:33:1::10

# drill bing.com
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 37224
;; flags: qr rd ra ; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;; bing.com. IN A

;; ANSWER SECTION:
bing.com. 5 IN A 150.171.28.10
bing.com. 5 IN A 150.171.27.10

;; AUTHORITY SECTION:

;; ADDITIONAL SECTION:

;; Query time: 7 msec
;; SERVER: 8.8.8.8
;; WHEN: Thu Nov 20 15:47:44 2025
;; MSG SIZE rcvd: 58


Your DNS port 53 may be filtered or redirected by your ISP and all requests on that port may be blocked. You can test this by trying to connect to the port 53 using telnet or nc
nc -v -z 8.8.8.8 53

# nc -v -z 8.8.8.8 53
Connection to 8.8.8.8 53 port [tcp/domain] succeeded!
 
Does ping 8.8.8.8 work? If not you should check the configuration of that gateway host itself. You probably forgot it should NAT that outgoing traffic. Or the gateway host itself has no internet connection. The problem isn't on this host in any case, it's on that gateway host.
 
Dear all :
thanks for your help... yes ,
i can ping 1.1.1.1 and 8.8.8.8
can not ping bing.com

i think i have lost dns .. where we can configure it in fixing IP and gateway..thanks.
 
cat /etc/nsswitch.conf
#
# nsswitch.conf(5) - name service switch configuration file
#
group: compat
group_compat: nis
hosts: files dns
netgroup: compat
networks: files
passwd: compat
passwd_compat: nis
shells: files
services: compat
services_compat: nis
protocols: files
rpc: files
 
dear gpw928 :
thanks for your help.. yes, the 53 port has been some one blocked ..

other quesiton, : if i fixed my ip and gateway to my re0 interface .. what i need to configure for re0 dns and where ? thanks.
 
In the first instance we must determine where port 53 is blocked. VladiBG had some really good suggestions above.

If you can't install nc(1) (to show us the output of nc -v -z 8.8.8.8 53), then your easiest approach is probably to find out if your ISP has recommendations for the IP address of their preferred name server (they always do), and use that instead of 1.1.1.1 or 8.8.8.8.
 
In the first instance we must determine where port 53 is blocked. VladiBG had some really good suggestions above.

If you can't install nc(1) (to show us the output of nc -v -z 8.8.8.8 53), then your easiest approach is probably to find out if your ISP has recommendations for the IP address of their preferred name server (they always do), and use that instead of 1.1.1.1 or 8.8.8.8.
Dear gpw928:
where we can put ISP dns in my freebsd14.3 when i fixed IP and gateway ? (is it in /etc/resolv.conf ?) thanks.
 
Assuming that your ISP's name server IP address is "a.b.c.d".

Place the single line nameserver a.b.c.d in /etc/resolv.conf

Make sure you can ping a.b.c.d.
 
Back
Top