Re: Userland "dig/host" for lookups against /etc/hosts?
it was said: >It works if I ping 'hostname', but how can I find out the IP of >'hostname' from the command line? Hello, Would not grep 'hostname' /etc/hosts do this? HTH, stheg __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Userland "dig/host" for lookups against /etc/hosts?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 2005-03-28, Emanuel Strobl scribbled these curious markings: > Is there one? Unfortunately I can't write one myself, at least not > in a reasonable amount of time - --cut-- #!/usr/bin/perl -w use strict; use Socket; my $host = shift or die "usage: hostshost hostname\n"; my $addr = gethostbyname($host); die "Cannot resolve host '$host'.\n" unless defined $addr; my $ip = inet_ntoa($addr); print "$host has address $ip\n"; - --cut-- Needs some 5.x version of Perl. Works with 5.005_03 as shipped in FreeBSD 4.x. Also works with more recent perls. Best Regards, Christopher Nehren -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFCR6Rpk/lo7zvzJioRAg8pAJ4s69gjARzlc/ZL5sNKT2vSYa9XFwCbBILr ehnDiO3MuDC3b3nryMUx+Ws= =Z9c9 -END PGP SIGNATURE- -- I abhor a system designed for the "user", if that word is a coded pejorative meaning "stupid and unsophisticated". -- Ken Thompson If you ask the wrong questions, you get answers like "42" and "God". Unix is user friendly. However, it isn't idiot friendly. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Userland "dig/host" for lookups against /etc/hosts?
Am Montag, 28. März 2005 08:23 schrieb Alexander Chamandy: > On Mon, 28 Mar 2005 07:17:31 +0200, Emanuel Strobl > > <[EMAIL PROTECTED]> wrote: > > Dear all, > > > > my testbed lacks of Ethernet Ports so one machine has no connection to my > > DNS, no problem, there is something called /etc/hosts I thought. > > It works if I ping 'hostname', but how can I find out the IP of > > 'hostname' from the command line? dig and host want to contact the DNS > > server, also nslookup does, so I think I need a utility which uses the > > gethostbyname(3) function. Is there one? Unfortunately I can't write one > > myself, at least not in a reasonable amount of time > > May I ask what you're trying to do with the machine? If you just want > local DNS resolution for experimentation you may try running BIND 9 or > TinyDNS. No DNS experiments, I'm very well equiped (authoritative DNS). It's just that my local subnet (productive) has not enough ethernet ports so one test-machine (in another subnet) cannot be connected to the local net and the two other subnets are for testing only, so none routes to my productive net Everything is working fine, just curiosity.. -Harry > > > Thanks, > > > > -Harry pgpaEOOjtheY9.pgp Description: PGP signature
Re: Userland "dig/host" for lookups against /etc/hosts?
On Mon, 28 Mar 2005 07:17:31 +0200, Emanuel Strobl <[EMAIL PROTECTED]> wrote: > Dear all, > > my testbed lacks of Ethernet Ports so one machine has no connection to my DNS, > no problem, there is something called /etc/hosts I thought. > It works if I ping 'hostname', but how can I find out the IP of 'hostname' > from the command line? dig and host want to contact the DNS server, also > nslookup does, so I think I need a utility which uses the gethostbyname(3) > function. Is there one? Unfortunately I can't write one myself, at least not > in a reasonable amount of time May I ask what you're trying to do with the machine? If you just want local DNS resolution for experimentation you may try running BIND 9 or TinyDNS. > Thanks, > > -Harry > > > -- Best wishes, Alexander G. Chamandy Webmaster www.bsdfreak.org Your Source For BSD News! ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Userland "dig/host" for lookups against /etc/hosts?
Dear all, my testbed lacks of Ethernet Ports so one machine has no connection to my DNS, no problem, there is something called /etc/hosts I thought. It works if I ping 'hostname', but how can I find out the IP of 'hostname' from the command line? dig and host want to contact the DNS server, also nslookup does, so I think I need a utility which uses the gethostbyname(3) function. Is there one? Unfortunately I can't write one myself, at least not in a reasonable amount of time Thanks, -Harry pgpql7mmH14RD.pgp Description: PGP signature