dns not working on embedded device? - linux

DNS is not working on my embedded device, I can do ping to 74.125.77.147, but ping to google 's ip address 209.85.231.104 works but ping google.com is not working.
embedded device runs embedded linux, It is able to get its ip from dhcp, board is connected to network via Ethernet connection.
What can be the reason?

Look at the file /etc/resolv.conf. The DHCP client should have put the nameserver's IP in there. If not, then your DHCP server may not be passing a DNS address or the client may be ignoring it?
If there's nothing in your /etc/resolv.conf then try adding the line:
nameserver dns-ip-address
Confirm that DNS resolution works by pinging google.com. Then get your DHCP server to send a DNS IP as part of it's configuration to the client.

Related

How to add (Reverse) DNS entries in Cisco IOS?

I've got a customer where the router needs to be replaced with a Cisco router.
The current router is a linux machine with webmin installed on it.
There's a BIND DNS server with multiple zones.
There's a zone called companyname.be with entries name-ip (address records).
There's also a zone called 192.9.200 (which is the local subnet) with entries address-name (reverse address records).
This configuration can be seen below:
I'm not sure why they need this but someone at the customer's company told me that it's necessary.
In the end the goal is to be able to ping by using a name rather than an IP.
Does someone know how to configure this in Cisco IOS?
I've been searching this for a while now but all I came up with is this link: http://www.firewall.cx/cisco-technical-knowledgebase/cisco-routers/257-cisco-router-dns-server.html
I tried it but this only seems to create a host table on the router itself.
That hosttable is not used by the DNS.
(Can ping to domain name from router CLI but cannot ping to a domain name from a PC with that router as default gateway.)
I've already found the answer here: https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipaddr_dns/configuration/15-sy/dns-15-sy-book/Configuring-DNS.html#GUID-E4A67061-354E-4847-8F56-9A88446C7D30
R1#conf t
R1(config)#ip domain companyname.be
R1(config)#ip name-server 8.8.8.8
R1(config)#ip dns server
R1(config)#ip host computername1.companyname.be
And for the DHCP server to send the DNS server to DHCP clients:
R1(config)#ip dhcp pool pool_name
R1(dhcp-config)#dns-server ip_address_of_router
Now any host can ping computername1.companyname.be.

Why does my vps reply to dns queries even if it has no dns server running?

I've got a cheap openvz Ubuntu vps and i'm trying to run my own dns server on it for learning purpose.
The dns server works fine in localhost (on the vps through ssh), i can query it using dig google.com #127.0.0.1 and i get the expected result (which is not the IP of google.com but a custom one).
When i try to query the dns server from outside the vps, using the same command, I do get a reply but the IP is not what I expect (it's an actual google.com IP).
After further investigation I found out my dns server is not receiving/sending packets when the query is done from outside the vps. So the answer is sent by something else, it seems like inbound packets with destination port 53 are deviated, they do not even reach my dns server.
I tried to query my dns server, still from outside, but this time while the VPS was SHUTDOWN. Magically i got a reply from god knows who.
Changing port from 53 to 54 everything works perfectly.
The problem is i need it to use port 53.
I don't have iptables rules nor any other firewall doing something related to port 53
I also tried to query some other random vps, from different hosting providers, seems like everyone has a dns server running! Why does everyone reply?
Of course i asked technical support, that's what they said:
Hello,
Sorry but we don't do "software" technical support on VPS.
We deliver the hosting and the operating systems, customers that order VPS are their own admins, and have to know how to manage a linux server.
We don't block any port on our side.
Best regards,
Support
Mybe your dns server is bound to the loopback interface only (so it's only listening on localhost). You can check the current service ports used (udp for DNS) using netstat and filter (grep) udp port used
netstat -an | grep ":53"
Also you can test the same dns query using the nslookup command, and checking the dns server ip that answer your dns query, in the result output:
nslookup google.com [dns_server_ip]
Also test it without dns_server_ip to check if there is a default nameserver when the specified nameserver is not responding.
Problem solved, it's my ISP intercepting and replying to dns queries.
I can do dig google.com #1.2.3.4 and i get a reply :D
Who wants to know more about this:
ISP Intercepting DNS Lookups

Resolving hostname in linux (pwnpi)

i am having problems with wget on linux. After little research i found out that i cant get reply from dns server.
But its really strange because other windows machine (in same network switch) can access the dns.
Wireshark gives me info about that linux machine is sending arp requests for dns into network but cant get reply from it.
On windows machine it seems like that it doesnt send arp request for dns servers, but it just send to dns ip address with mac of default gateway which could be resolved by arp on both machines.
What could be wrong?
linux ip is 10.20.5.1 mask: 255.255.252.0
default gw: 10.20.4.1
dns addresses on: 10.230.6.12 10.230.6.13
Not really a programming question but I'm curious.
You're not on the same network as the dns servers so if you want send traffic to the dns you have to go through the gateway hence I would expect an arp request for the gateway and not for the dns
If your machine is really doing arp for the dns address then that makes me believe that your netmask is not what you say it is (maybe not configured hence /8 -- the std for a class A network)
Can you output:
ip a sh
ip route get 10.230.6.12
Rgds
MArcel

Lost internet connectivity: IP address using CentOS

I changed the IP address of my linux machine so that I can communicate with a device. I modified the IP address in the ifconfig-eth0 file to the necessary IP address (IPADDR=192.XXX.X.XXX). I can successfully communicate with my device, but when I rewire my computer to the internet, I cannot connect.
I tried to change the IP address in ifconfig-eth0 back to what google told me my IP address is (130.XXX.XX.XXX), and ran
service network restart
But I am still unable to connect. Any ideas?
I solved the problem by configuring /etc/sysconfig/network-scripts/ifcfg-eth0 (as root) to contain only the following:
DEVICE="eth0"
BOOTPROTO="dchp"
ONBOOT="yes"
Upon restarting the machine, a new IP address was obtained and I was able to connect to the internet.

Troubles accessing the VirtualHost on a local net

Hi I have a Huawei ADSL modem with a dynamic IP. I set up a dynamic dns with freedns and I can easily access my Virtual host on apache from outside my private network, from internet.
So trying to access it from a local network I get a modems login page.
I have the rule in my modems NAT to connect port 80 to my server but it seems it doesnt work from internal net.
My server hosting the virtual host is 192.168.0.1 , the modem has the 192.168.0.254 address.
I tried to put my external domain name into the /etc/hosts file, but if I do that then asterisk server gets confused.
What could be the cause of the problem ? And what would be the best solution to this problem ?
Should I set up a caching DNS on the private side of the net ?
Hugger is half right... Its because your router is blocking loopbacks. The easiest way around this is to edit the hosts file (See the Wiki page) on the computer that is behind the network to see the local IP of the computer as the virtual host your going for. For example if your server is on 192.168.0.1 and the virtual hostname is www.imrad.com then insert
192.168.0.1 www.imrad.com
into your hosts file. If your computer leaves the local network (like a laptop you take to work) and joins a network not behind your router you need to comment out the line in the hosts file.
well actually to access that you must find the local ip address of the server by going into command line/prompt and typing ipconfig /all then you will find ipv4 address. Take note of that.
Go to another computer and your that ip and it will show.
The reason that was happening is because the router/modem knows you are in its network so it will think you ar trying to go top the login page of it. That happens to me too.

Resources