Problem: I want to be able to ping a domain name, sourcing from a particular interface on a Cisco router.

Scenario: I have Router-A, an it has a management address of I can only connect to this router using that address from a certain location, which is how security is set up, and it cannot be changed. I would like to be able to connect to Router-A and then setup DNS with:

ip domain-lookup
ip name-server

Then, from the command line, I would want to do something like:

ping www.google.com source interface FastEthernet0

So, why cant i do this? Well, because when you introduce the domain name into the ping statement, you are not giving the option to source it anymore.

So, just use an extended ping? Although it seems like you would have that option, after you enter the domain name in, you don't get the option to source it anymore.

Why are you trying to source it from Fas0? Because that subnet is allowed to query the DNS, no other address on the device is allowed, by the DNS server, to make queries.

So, just send the request from an end device connected to the router? I cant, and this is not answering the problem, it has to be done from the command line on the router.

I had the idea of tclsh with something like:

foreach var {
} {ping $var repeat 5 source Fas0}

But that does not work.

Any ideas would be greatly appreciated.

  • what you men by Because that subnet is allowed to query the DNS, no other address on the device is allowed, by the DNS server, to make query's.
    – Gadeliow
    Sep 5, 2015 at 8:06
  • 3
    Your error is the use of the word interface and urls. ping www.google.com source f0/1 works just fine (as long as it resolves) The interface selected to actually perform the name lookup is not controlled by the exec command. (ip domain lookup source-interface sets it)
    – Ricky
    Sep 5, 2015 at 9:06
  • 1
    @Gadeliow - the Fas0 has an address range assigned to it, this is in a different vrf from the other interfaces. So in my example, my management address is and the Lan address is So if i were to query the DNS from any other interface other than the Fas 0, the security on the DNS would recognize it was not coming from a trusted ip range, and would simply drop the request.
    – psniffer
    Sep 5, 2015 at 9:32
  • @ Ricky Beam - thanks, that solves it, that issue, still does not work though, i assume there are other restrictions in place that are stopping it.
    – psniffer
    Sep 5, 2015 at 9:33
  • 1
    @psniffer, as I recall, when you use source in a command, it only affects the source of the command you are using, in this case ping. As such, when the command passes the hostname to the OS to query DNS, the query will not make use of this source statement and source the traffic from the interface it exits.
    – YLearn
    Oct 5, 2015 at 19:29

1 Answer 1


Basically, you need to check the connectivity between this router and the DNS server through FastEthernet0.

  1. Try to ping it globally with no source interface
  2. Try to ping the DNS server IP address using this source interface or the IP address assigned to it
  3. Try to ping anything local in your domain first (e.g. your PC's fully qualified domain name), then try to ping a global site, since it may be an Internet access problem ( IP address range)
  4. Try Cisco troubleshooting list, this case its may be of help CISCO DNS TS

I just tried the 'ip name-server X.X.X.X' command on my core switch (X.X.X.X is my DNS server IP address) and everything worked perfect internally and externally (I used ping and traceroute to idjsrv.beyti.local) as shown:

enter image description here

(I used ping and traceroute to www.google.com) as shown:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.