Professional Web Applications Themes

Userland "dig/host" for lookups against /etc/hosts? - FreeBSD

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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQBCR5N0Bylq0S4AzzwRAnRqAJwILrRhqKimACowkRkWTW 4a4l/wggCfcU/3 0nj8o24uS0EeBgiJp1f5WpA= ...

  1. #1

    Default 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

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.0 (FreeBSD)

    iD8DBQBCR5N0Bylq0S4AzzwRAnRqAJwILrRhqKimACowkRkWTW 4a4l/wggCfcU/3
    0nj8o24uS0EeBgiJp1f5WpA=
    =EF3U
    -----END PGP SIGNATURE-----

    Emanuel Guest

  2. #2

    Default Re: Userland "dig/host" for lookups against /etc/hosts?

    On Mon, 28 Mar 2005 07:17:31 +0200, Emanuel Strobl
    <net> wrote: 

    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.
     


    --
    Best wishes,

    Alexander G. Chamandy
    Webmaster
    www.bsdfreak.org
    Your Source For BSD News!
    Alexander Guest

  3. #3

    Default Re: Userland "dig/host" for lookups against /etc/hosts?

    Am Montag, 28. März 2005 08:23 schrieb Alexander Chamandy: 
    >
    > 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.[/ref]

    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
     [/ref]

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.0 (FreeBSD)

    iD8DBQBCR6ROBylq0S4AzzwRAprlAJ4le5hVhLrOZbKnAUH5go UD9Q1kiQCdEeBf
    rZjYDUGfFmVoXrkqKYoxQOc=
    =6bTL
    -----END PGP SIGNATURE-----

    Emanuel Guest

  4. #4

    Default 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: 

    - --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.

    Christopher Guest

  5. #5

    Default Re: Userland "dig/host" for lookups against /etc/hosts?

    it was said:
     

    Hello,

    Would not grep 'hostname' /etc/hosts do this?

    HTH,

    stheg



    __________________________________
    Do you Yahoo!?
    Yahoo! Small Business - Try our new resources site!
    http://smallbusiness./resources/
    stheg Guest

Similar Threads

  1. #26218 [Opn->Bgs]: mail() sends extra "RCPT TO: <>" to smtp host
    By iliaa@php.net in forum PHP Development
    Replies: 0
    Last Post: November 13th, 01:46 AM
  2. #26218 [NoF->Opn]: mail() sends extra "RCPT TO: <>" to smtp host
    By bzheng at us dot nomura dot com in forum PHP Development
    Replies: 0
    Last Post: November 12th, 08:26 PM
  3. [PHP] PHP "Smart Refresh" for looping server lookups
    By Jim Lucas in forum PHP Development
    Replies: 1
    Last Post: September 22nd, 10:34 AM
  4. PHP "Smart Refresh" for looping server lookups
    By J. Cox in forum PHP Development
    Replies: 0
    Last Post: September 21st, 01:25 AM
  5. Slow lookups and "My Computer" resolution
    By Joe Smith in forum Windows Networking
    Replies: 0
    Last Post: July 6th, 03:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139