Gethostbyname returns h_errno 2, when /etc/hosts has no info on solaris x86

Hello,
I am calling gethostbyname(native_machine_name) in our code, and we do not want this to be dependent on /etc/hosts file. So when we remove all entries from /etc/hosts file, it works well on sparc machine, but the same doesnt work on solaris x86 machine. gethostbyname returns null with errno 2.
Also "ping hostname" doesnt work on solaris x86 when there is no entry in /etc/hosts, but the same works on sparc machine.
Is there any such dependency on x86 machine? If there is any then how to achieve this functionality (to get host info without /etc/hosts)?
Any help would be appreciated.
Thanks
Ankur Gupta

Sounds like your name resolution isnt working.
Check you have host: files dns in /etc/nsswitch.conf
and working name servers specified in /etc/resolv.conf

Similar Messages

  • /etc/hosts vs DNS & sendmail

    Hi All,
    I have a question about how /etc/hosts & DNS work on a solaris 9 box.
    When I have entries in /etc/hosts that are not in DNS and I run say nslookup the utility will not find the ip. Put if I ping the entry in /etc/hosts it will find it. Basically I have a box with default sendmail and in /etc/hosts I have a entry with mailhost added to it at the end. nslookup does not find the box ping does and sendmail can't send mail to it and I can not verify that it ever worked correctly.
    1) what is up with nslookup no seeing /etc/hosts?
    2) can sendmail send to hosts per FQDN listed in /etc/hosts & use a DNS server at the same time?
    thanks
    -im

    When I have entries in /etc/hosts that are not in DNS
    and I run say nslookup the utility will not find the
    ip. Correct. nslookup and /etc/hosts are controlled by /etc/nsswitch.conf.
    Files says to search /etc/hosts.
    Anything else says to use that name service.
    Put if I ping the entry in /etc/hosts it will
    find it.If it is in /etc/hosts and /etc/nsswitch.conf says to search /etc/hosts.
    and in /etc/hosts I have a entry with mailhost added
    to it at the end. nslookup does not find the box ping
    does and sendmail can't send mail to it and I can not
    verify that it ever worked correctly. Sendmail can be compiled to use or disregard name server lookups in addition to the /etc/nsswitch.conf file.
    sendmail -v e-mail_addr, should show you some basic diagnostics.
    1) what is up with nslookup no seeing /etc/hosts?That's the way it works.
    2) can sendmail send to hosts per FQDN listed in
    /etc/hosts & use a DNS server at the same time?sure, see /etc/nsswitch.conf and the sendmail compile time options.
    http://www.ilkda.com/sendmail/
    alan

  • Adding the /etc/host.deny file like linux in solaris 10.

    Dears,
    I need to add a file which will works like the file of /etc/hosts.deny of Linux in Solaris.
    If it is possible in the same manner please let me know that, and if it need some other trick to deny a specific host to access the system please tell me the way to do that.
    Eagerly waiting to hear from you.
    BR//
    Sohel.

    IPfilter can deny a specific IP address access to the host - enable IPFilter with svcadm and edit the /etc/ipf/ipf.conf file to add the IP to block. An example could be:
    block in log quick on bnx0 proto tcp from 192.168.1.5/32 to any
    I use IPfilter to pass and block all sorts of specific IP addresses as well as block/allow specific ports (like only specific hosts can use port 22, ssh).

  • Asking for a password when trying to add an entry to /etc/hosts

    I am trying to add an entry to /etc/hosts using Terminal. When I type the command: sudo nano /etc/hosts it asks me for a password. I have never set a password so I have no idea what this would be. My admin pw is blank (I just hit enter) and this is not working. Is there a defaut password or how can I reset this? Thanks

    This would be your admin account password. You must set one.
    Forgot Your Account Password
    For Lion, Mountain Lion, or Mavericks
        Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
         When the menubar appears select Terminal from the Utilities menu.
         Enter resetpassword at the prompt and press RETURN. Follow
         instructions in the dialog window that will appear.
         Or see Reset a Mac OS X 10.7 Lion Password, OS X Mountain Lion- Reset a login password,
         and OS X Lion- Apple ID can be used to reset your user account password.
    For Snow Leopard and earlier with installer DVD
         Mac OS X 10.6- If you forget your administrator password
    For Snow Leopard and earlier without installer DVD
        How to reset your Mac OS X password without an installer disc | MacYourself

  • Regarding Mail:  When I return to my computer after it has gone to sleep, my accounts go offline, and are always asking me for the password.  THis is very annoying.  How can I prevent this?

    Regarding Mail:  When I return to my computer after it has gone to sleep, my accounts go offline, and are always asking me for the password.  THis is very annoying.  How can I prevent this?

    Back up all data.
    Launch the Keychain Access application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Keychain Access in the icon grid.
    Select the login keychain from the list on the left side of the Keychain Access window. If your default keychain has a different name, select that.
    If the lock icon in the top left corner of the window shows that the keychain is locked, click to unlock it. You'll be prompted for the keychain password, which is the same as your login password, unless you've changed it.
    Right-click or control-click the login entry in the list. From the menu that pops up, select Change Settings for Keychain "login". In the sheet that opens, uncheck both boxes, if not already unchecked.
    From the menu bar, select
    Keychain Access ▹ Preferences ▹ First Aid
    If the box marked Keep login keychain unlocked is not checked, check it.
    Select
    Keychain Access ▹ Keychain First Aid
    from the menu bar and repair the keychain. Quit Keychain Access.

  • HT6058 Hello I m using iPhone 4S , it was quite good, but now I m using ios7.0.4 but when I open any application  like, Skype, camera, viber etc it has

    Hello I m using iPhone 4S , it was quite good, but now I m using ios7.0.4 but when I open any application  like, safari , Skype, camera, viber etc it has closed automatically y?

    Hello Junaid qureshi,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    iOS: Troubleshooting apps purchased from the App Store
    http://support.apple.com/kb/ts1702
    Best of luck,
    Mario

  • My iphone has a problem, it simply does not work, the screen is all black with a few colorful scribbles and images blend, I used it only took 6 days and returned to service when operated only 7 more days and it happened again the same thing, what do I do?

    My iphone has a problem, it simply does not work, the screen is all black with a few colorful scribbles and images blend, I used it only took 6 days and returned to service when operated only 7 more days and it happened again the same thing, what do I do?

    Reset the PRAM
    Reinstall the operating system from the dvd (you will not loose your data)

  • Mpc problem: getaddrinfo not checking /etc/hosts?

    The source of this question is my attempt to get mpc to contact mpd on my localhost when the internet is down. When the internet is up it works fine, but when i'm not connected to the internet, running mpc behaves as follows:
    I seem to have tracked this down to a problem in getaddrinfo (possibly in my sytem configuration?). I created a piece of test code (below) that does a gethostbyname and then a getaddrinfo. On this computer, both work when connected to the internet, but getaddrinfo fails when disconnected. I tested the same code on an ubuntu computer and it getaddrinfo worked even when disconnected from the internet.
    My /etc/hosts and /etc/host.conf seem to be set properly. glibc is 2.8-3. I would have thought that getaddrinfo having such a problem would cause more errors than just in mpc, but I haven't noticed any.
    I'd really appreciate any help.
    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netdb.h>
    int main (void)
    struct addrinfo *addrinfo;
    int i, error;
    struct hostent *h;
    h = gethostbyname("localhost");
    if (h) {
    for (i=0; i < h->h_length - 1; i++)
    printf("%d.", h->h_addr_list[0][i]);
    printf("%d\n", h->h_addr_list[0][i]);
    } else {
    printf("no such host\n");
    error = getaddrinfo("localhost", NULL, NULL, &addrinfo);
    if (error) {
    printf("host not found: %s\n", gai_strerror(error));
    } else {
    while (addrinfo) {
    printf("%d %d %d\n",AF_INET,AF_INET6,addrinfo->ai_family);
    addrinfo = addrinfo->ai_next;
    return 0;
    $ ./hnt
    127.0.0.1
    2 10 2
    2 10 2
    2 10 2
    $ sudo dhcpcd -k wlan0
    $ ./hnt
    127.0.0.1
    host not found: Temporary failure in name resolution
    $ mpc
    MPD_HOST and/or MPD_PORT environment variables are not set
    error: host "localhost" not found: Temporary failure in name resolution
    $
    Uncommented and nonblank lines of /etc/hosts:
    127.0.0.1      localhost.localdomain  localhost heroine
    and /etc/host.conf:
    order hosts,bind
    multi on

    Alas, setting MPD_HOST does not help. If there is some way to give mpc an ip address instead of a hostname, that might help. Just putting 127.0.0.1 as MPD_HOST doesn't work.
    I also really think there is something really weird going on with getaddrinfo.
    Thanks for the idea.
    $ MPD_HOST=localhost mpc
    MPD_HOST and/or MPD_PORT environment variables are not set
    error: host "localhost" not found: Temporary failure in name resolution
    $ MPD_HOST=127.0.0.1 mpc
    MPD_HOST and/or MPD_PORT environment variables are not set
    error: host "127.0.0.1" not found: Address family for hostname not supported
    $

  • Network-profiles (1) and /etc/hosts

    Hi everyone,
    i've got a few network-profiles, especially in one network I have to use a static ip to connect to the internet. The only entry in the /etc/hosts which works correctly - without any error messages - for me, is
    192.168.0.99 localhost.localdomain myhost
    If I use something like 127.0.0.1 in front and simply add my hostname at the end, I can't connect with the Inet, unfortunately. I did not test it, but I'm pretty sure, that this host configuration won't work in any other network, where I get a dynamic IP from the DHCP. Is there a possibility to write the content of the /etc/hosts with netcfg, like the /etc/resolv.conf for example?
    MfG Skit

    Because you didn't specify what localhost was in your hosts file. It only knows of localhost.localdomain(does not imply 'localhost') and acer being the loopback.
    I think he understood that.
    'localhost' is universally understood as the loopback.
    this is some kind of 'magic' answer isn't it? the resolving doesn't come out as a miracle... and that is IMHO what needs explanation.
    his computer alone doesn't (obviously) get it because sure, it's not set. now what 'magic' makes it known when a cable is plugged in? the computer tries to reslove locally (via /etc/hosts), fails at it, and then asks the dns server about it. so I reckon the dns server is instructed on replying '127.0.0.1' for a 'localhost' hostname request. why so? because dns servers have an option to look at their local /etc/host for resolving before delegating to bigger servers, so the dns server certainly has localhost matching 127.0.0.1 in his /etc/host, and blindly replies accordingly, oblivious to the fact that he is replying about his 'own' 127.0.0.1 to someone else.
    Last edited by lloeki (2008-01-16 08:24:12)

  • Editing etc\hosts file on windows xp for apps. problem post installation.

    Hi all,
    I was able to install 11.5.10.2 apps on my win xp prof machine. During that process I had to edit the etc/hosts file in windows directory as a work around for that domain name field during installation. Also added the primary DNS suffix as 'suneel.com' . I gave the domain name as 'suneel.com' during installation. The RapidWiz is taking localhost as the system name and referring to this system as localhost.suneel.com, though the actual system name is 'websoft-xp' .
    The host file on Apps machine has the following entries:
    127.0.0.1 localhost
    127.0.0.1 localhost.suneel.com suneel.com
    127.0.0.1 websoft-xp.suneel.com
    So when I connect to apps login server from other systems in lan, I've to edit their hosts file and add an entry for localhost.suneel.com to point to its ip address or else the apps throws an error after logging in as operations/welcome using a different url say 192.168.1.4:8000 . Is there a way to get around this issue?
    More over I'm not able connect to VIS db from other systems. The oracle clients give an error 'No listner' at this address. (The original listener was listening at localhost.suneel.com:1521). So I tried to create a new listerner from Net Manager that actually listens at websoft-xp (the real system name) but it throws me an error 'A valid log file is required' while saving the network configuration and prevents me from saving the network configuration.
    Did I do something wrong with the hosts file during installation or did i miss any entries in that file thats causing this? Any solutions for the above problems will be appreciated?
    Thanks
    Suneel
    Message was edited by:
    suneelgv

    Well I tried that option but for some reason it didn't work for me. It kept giving the tns:connection closed error. Then I searched in metalink and found this note : Note:333158.1
    It suggested setting tcp.validnode_checking = no
    in sqlnet.ora. in
    F:\oracle\visdb\9.2.0\network\admin\VIS_websoft-xp
    And it works. Hope this helps someone facing a similar problem. Good luck.
    BTW how do I run autoconfig?
    Thanks,
    Suneel Gundlapalli

  • Unknown Host sidhost (see /etc/hosts)

    Hi experts,
        I'm facing a problem in maxdb please help us the issue
    Error:
    starting database instance ...
    Error! Connection failed to node devhost for database DEV:
    unknown host devhost (see /etc/hosts)
    Opening Database...
    Error! Connection failed to node devhost for database DEV:
    unknown host devhost (see /etc/hosts)
    connect to the database to verify the database is now open
    dbmcli check finished with return code: 0
    database start failed

    Hi Deepak,
                       This is the DBM.PRT log file.
    'db_warm' is being executed.
    2014-02-28 09:50:00       4993 INF          1 DBMKnl   Sending an administrative statement to the database DEV on computer localhost
                              4993 INF          8 DBMKnl   Statement:  RESTART
    2014-02-28 09:50:50       4993 INF          3 DBMKnl   Received the result of an administrative statement from the database DEV on computer localhost
                              4993 INF          9 DBMKnl   Statement:  RESTART
                              4993 INF         10 DBMKnl   Returncode: 0
    2014-02-28 09:50:59       4993 INF        419 DBMSrv   Command 'db_warm' has ended with return code 0.
    2014-02-28 09:50:59       4993 INF          2 DBMSrvCo A DBM Server client connection was released (client process has process ID 4991 on computer transids.transaltus.com).
    2014-02-28 09:59:35       7407 INF          1 DBMSrvCo A DBM Server client connection was established at 2014-02-28 09:59:35 (client process has process ID 7194 on computer transids.transaltus.com).
    2014-02-28 09:59:36       7407 INF        283 DBMSrv   Command 'dban_start ...' is being executed.
    2014-02-28 10:00:41       7407 INF        419 DBMSrv   Command 'dban_start' has ended with return code 0.
    2014-02-28 10:16:57       7407 INF          2 DBMSrvCo A DBM Server client connection was released (client process has process ID 7194 on computer transids.transaltus.com).
    2014-02-28 17:55:12      14698 INF          1 DBMSrvCo A DBM Server client connection was established at 2014-02-28 17:55:12 (client process has process ID 14696 on computer transids.transaltus.com).
    2014-02-28 17:55:12      14698 INF        283 DBMSrv   Command 'dban_stop' is being executed.
    2014-02-28 17:55:14      14698 INF        419 DBMSrv   Command 'dban_stop' has ended with return code 0.
    2014-02-28 17:55:14      14698 INF          2 DBMSrvCo A DBM Server client connection was released (client process has process ID 14696 on computer transids.transaltus.com).
    2014-02-28 17:55:15      14724 INF          1 DBMSrvCo A DBM Server client connection was established at 2014-02-28 17:55:14 (client process has process ID 14722 on computer transids.transaltus.com).
    2014-02-28 17:55:15      14724 INF        283 DBMSrv   Command 'db_cold' is being executed.
    2014-02-28 17:55:15      14724 INF          1 DBMKnl   Sending an administrative statement to the database DEV on computer localhost
                             14724 INF          8 DBMKnl   Statement:  SHUTDOWN
    2014-02-28 17:55:15      14724 INF          3 DBMKnl   Received the result of an administrative statement from the database DEV on computer localhost
                             14724 INF          9 DBMKnl   Statement:  SHUTDOWN
                             14724 INF         10 DBMKnl   Returncode: 0
    2014-02-28 17:55:30      14724 INF        419 DBMSrv   Command 'db_cold' has ended with return code 0.
    2014-02-28 17:55:30      14724 INF          2 DBMSrvCo A DBM Server client connection was released (client process has process ID 14722 on computer transids.transaltus.com).
    2014-02-28 17:55:30      14769 INF          1 DBMSrvCo A DBM Server client connection was established at 2014-02-28 17:55:30 (client process has process ID 14767 on computer transids.transaltus.com).
    2014-02-28 17:55:30      14769 INF        283 DBMSrv   Command 'db_offline' is being executed.
    2014-02-28 17:55:32      14769 INF        419 DBMSrv   Command 'db_offline' has ended with return code 0.
    2014-02-28 17:55:32      14769 INF          2 DBMSrvCo A DBM Server client connection was released (client process has process ID 14767 on computer transids.transaltus.com).
    2014-03-03 09:19:32       4829 INF          1 DBMSrvCo A DBM Server client connection was established at 2014-03-03 09:19:32 (client process has process ID 4827 on computer transids.transaltus.com).
    2014-03-03 09:19:32       4829 INF        283 DBMSrv   Command 'db_clear' is being executed.
    2014-03-03 09:19:32       4829 INF        419 DBMSrv   Command 'db_clear' has ended with return code 0.
    2014-03-03 09:19:32       4829 INF          2 DBMSrvCo A DBM Server client connection was released (client process has process ID 4827 on computer transids.transaltus.com).
    2014-03-03 09:19:32       4834 INF          1 DBMSrvCo A DBM Server client connection was established at 2014-03-03 09:19:32 (client process has process ID 4832 on computer transids.transaltus.com).
    2014-03-03 09:19:32       4834 INF        283 DBMSrv   Command 'db_start' is being executed.
    2014-03-03 09:19:47       4834 INF        419 DBMSrv   Command 'db_start' has ended with return code 0.
    2014-03-03 09:19:47       4834 INF          2 DBMSrvCo A DBM Server client connection was released (client process has process ID 4832 on computer transids.transaltus.com).
    2014-03-03 09:19:47       4879 INF          1 DBMSrvCo A DBM Server client connection was established at 2014-03-03 09:19:47 (client process has process ID 4877 on computer transids.transaltus.com).
    2014-03-03 09:19:47       4879 INF        283 DBMSrv   Command 'db_warm' is being executed.
    2014-03-03 09:19:47       4879 INF          1 DBMKnl   Sending an administrative statement to the database DEV on computer localhost
                              4879 INF          8 DBMKnl   Statement:  RESTART
    2014-03-03 09:20:41       4879 INF          3 DBMKnl   Received the result of an administrative statement from the database DEV on computer localhost
                              4879 INF          9 DBMKnl   Statement:  RESTART
                              4879 INF         10 DBMKnl   Returncode: 0
    2014-03-03 09:20:50       4879 INF        419 DBMSrv   Command 'db_warm' has ended with return code 0.
    2014-03-03 09:20:50       4879 INF          2 DBMSrvCo A DBM Server client connection was released (client process has process ID 4877 on computer transids.transaltus.com).
    2014-03-03 09:39:11       7414 INF          1 DBMSrvCo A DBM Server client connection was established at 2014-03-03 09:39:10 (client process has process ID 7098 on computer transids.transaltus.com).
    2014-03-03 09:39:11       7414 INF        283 DBMSrv   Command 'dban_start ...' is being executed.
    2014-03-03 09:40:01       7414 INF        419 DBMSrv   Command 'dban_start' has ended with return code 0.
    2014-03-03 09:41:13       7414 INF          2 DBMSrvCo A DBM Server client connection was released (client process has process ID 7098 on computer transids.transaltus.com).
    2014-03-03 17:44:38      14827 INF          1 DBMSrvCo A DBM Server client connection was established at 2014-03-03 17:44:38 (client process has process ID 14825 on computer transids.transaltus.com).
    2014-03-03 17:44:38      14827 INF        283 DBMSrv   Command 'dban_stop' is being executed.
    2014-03-03 17:44:40      14827 INF        419 DBMSrv   Command 'dban_stop' has ended with return code 0.
    2014-03-03 17:44:40      14827 INF          2 DBMSrvCo A DBM Server client connection was released (client process has process ID 14825 on computer transids.transaltus.com).
    2014-03-03 17:44:40      14853 INF          1 DBMSrvCo A DBM Server client connection was established at 2014-03-03 17:44:40 (client process has process ID 14851 on computer transids.transaltus.com).
    2014-03-03 17:44:40      14853 INF        283 DBMSrv   Command 'db_cold' is being executed.
    2014-03-03 17:44:40      14853 INF          1 DBMKnl   Sending an administrative statement to the database DEV on computer localhost
                             14853 INF          8 DBMKnl   Statement:  SHUTDOWN
    2014-03-03 17:44:44      14853 INF          3 DBMKnl   Received the result of an administrative statement from the database DEV on computer localhost
                             14853 INF          9 DBMKnl   Statement:  SHUTDOWN
                             14853 INF         10 DBMKnl   Returncode: 0
    2014-03-03 17:45:00      14853 INF        419 DBMSrv   Command 'db_cold' has ended with return code 0.
    2014-03-03 17:45:00      14853 INF          2 DBMSrvCo A DBM Server client connection was released (client process has process ID 14851 on computer transids.transaltus.com).
    2014-03-03 17:45:00      14902 INF          1 DBMSrvCo A DBM Server client connection was established at 2014-03-03 17:45:00 (client process has process ID 14900 on computer transids.transaltus.com).
    2014-03-03 17:45:00      14902 INF        283 DBMSrv   Command 'db_offline' is being executed.
    2014-03-03 17:45:01      14902 INF        419 DBMSrv   Command 'db_offline' has ended with return code 0.
    2014-03-03 17:45:01      14902 INF          2 DBMSrvCo A DBM Server client connection was released (client process has process ID 14900 on computer transids.transaltus.com).

  • /etc/hosts, /etc/hostname.bgeN configuration

    I am writing this to get help.
    I have a Solaris 10 box.
    bash-3.00$ uname -a
    SunOS soft19 5.10 Generic_125100-10 sun4u sparc SUNW,Netra-240
    I have the following stuff on this box,
    bash-3.00$ cat /etc/hosts
    # Internet host table
    127.0.0.1 localhost
    10.9.48.244 soft19-bge1 Secondary
    10.9.16.121 soft19 loghost
    #10.9.48.244 soft19 Secondary
    bash-3.00$ cat /etc/hostname.bge0
    soft19
    bash-3.00$ cat /etc/hostname.bge1
    soft19-bge1
    bash-3.00$ ifconfig -a
    lo0: flags=2001000849 mtu 8232 index 1
    inet 127.0.0.1 netmask ff000000
    bge0: flags=1000843 mtu 1500 index 2
    inet 10.9.16.121 netmask ffffff00 broadcast X.X.X.255
    bge1: flags=1000843 mtu 1500 index 3
    inet 10.9.48.244 netmask ffffff00 broadcast X.X.X.255
    In our code base, we have the following,
    struct hostent *hp;
    hp = ACE_OS::gethostbyname(myhostname); // myhostname is soft19
    hp->h_addr_list[0] will give 10.9.16.121
    Everything is correct here!!
    Now I change the configuration a bit,
    bash-3.00$ cat /etc/hosts
    # Internet host table
    127.0.0.1 localhost
    #10.9.48.244 soft19-bge1 Secondary
    10.9.16.121 soft19 loghost
    10.9.48.244 soft19 Secondary
    and now
    hp->h_addr_list[0] will give 10.9.16.121
    hp->h_addr_list[1] will give 10.9.48.244
    but when I reboot the system, I get the following,
    bash-3.00$ ifconfig -a
    lo0: flags=2001000849 mtu 8232 index 1
    inet 127.0.0.1 netmask ff000000
    bge0: flags=1000843 mtu 1500 index 2
    inet 10.9.16.121 netmask ffffff00 broadcast X.X.X.255
    bge1: flags=1000843 mtu 1500 index 3
    inet 0.0.0.0 netmask ffffff00 broadcast X.X.X.255
    And I know this is because
    bash-3.00$ cat /etc/hostname.bge1
    soft19-bge1
    Now I change /etc/hostname.bge1 to have just soft19
    and I reboot the system and what I see is this
    bash-3.00$ ifconfig -a
    lo0: flags=2001000849 mtu 8232 index 1
    inet 127.0.0.1 netmask ff000000
    bge0: flags=1000843 mtu 1500 index 2
    inet 10.9.16.121 netmask ffffff00 broadcast X.X.X.255
    bge1: flags=1000843 mtu 1500 index 3
    inet 10.9.16.121 netmask ffffff00 broadcast X.X.X.255
    Which is correct again!
    Now my question is
    With this
    struct hostent *hp;
    hp = ACE_OS::gethostbyname(myhostname); // myhostname is soft19
    I want to have the following,
    hp->h_addr_list[0] will give 10.9.16.121
    hp->h_addr_list[1] will give 10.9.48.244
    How can I get this even if the system reboots?

    Hi, Thanks, but I know this. And was expecting the same.
    But my question still remains unanswered..
    How to tweak /etc/hosts and /etc/hostname.bgeN files for....
    With this code
    struct hostent *hp;
    hp = ACE_OS::gethostbyname(myhostname); // myhostname is soft19
    I want to have the following,
    hp->h_addr_list[0] will give 10.9.16.121
    hp->h_addr_list[1] will give 10.9.48.244
    One more thing, I want to get this all the time, even my system reboots.
    I know a method to get below [by modifying /etc/hosts file]
    hp->h_addr_list[0] will give 10.9.16.121
    hp->h_addr_list[1] will give 10.9.48.244
    but this will not work when the system reboots? I am looking for a permanent solution.
    Thanks,
    Atul

  • Strange entry in the /etc/hosts file

    Hi,
    While doing some testings with my network this afternoon, I noticed that there's this strange line in my /etc/hosts file:
    ::1 localhost
    Anybody has any idea what the "::1" is for? The only thing related to network that I had recently installed is VPN Tracker. Could it be VPN Tracker that added that line to the hosts file?
    Thanks in advance for your help!
    Frank
    PowerBook G4   Mac OS X (10.4.8)  

    It's supposed to be there, here's a fresh install's complete hosts file...
    # Host Database
    # localhost is used to configure the loopback interface
    # when the system is booting. Do not change this entry.
    127.0.0.1 localhost
    255.255.255.255 broadcasthost
    ::1 localhost "
    Not sure what it means... may be a 16 bit number though! :-D

  • Appending a blocklist to /etc/hosts

    Is it possible to append a blocklist (er... redirectlist) to /etc/hosts somehow?
    For example, mvps has been supplying a very nice list of known parasite websites for years.  Basically, it just uses 127.0.0.1 to redirect known bad websites so they don't load. It's a nice system-wide method to block them.  I have been pasting their list into my /etc/hosts but am wondering if I can someone call it as I do in bash scripts.
    For example, this doesn't work, but you get idea:
    $ cat /etc/hosts
    127.0.0.1 localhost.localdomain localhost novelty
    192.168.1.1 router
    192.168.1.2 inky
    192.168.1.3 blinky
    . /etc/hostsmvps # try to load the mvps redirect list

    Wintervenom wrote:
    Copy your local machine and network hosts to "/etc/hosts.local," then:
    #!/bin/dash
    ### MVPS Hosts Updater #########
    # Version 0.3 by Scott Garrett #
    # Wintervenom [(at)] gmail.com #
    # Download the MVPS hosts file.
    wget -c -O /tmp/hosts.txt http://www.mvps.org/winhelp2002/hosts.txt
    # Be paranoid and replace every IP address with 0.0.0.0. We also get
    # only want the actual blacklist, 'cause we want to prepend the user's
    # own hosts. 0.0.0.0 is nicer than constantly knocking on localhosts' door.
    sed -r -e 's:^([0-9]{1,3}\.){3}[0-9]{1,3}:0.0.0.0:' /tmp/hosts.txt > /tmp/hosts.new.txt
    tail -n+`grep -nF 'start of lines' /tmp/hosts.new.txt | cut -d':' -f1` /tmp/hosts.new.txt > /tmp/hosts.txt
    # Write this new list over the system hosts list. MVPS' line feeds
    # are \n\r; we will be getting rid of those dirty carriage returns.
    # We'll first write the user's hosts head, then the black list.
    cat /etc/hosts.local > /etc/hosts
    cat /tmp/hosts.txt | tr -d "\r" >> /etc/hosts
    rm /tmp/hosts*.txt
    # This is the end!
    Thanks for the script, I actually wrote one very similar to yours but then thought I'd ask about sourcing it like a bash script does...
    Last edited by graysky (2010-10-10 16:04:16)

  • Pacman ignores /etc/hosts

    I use csslayer-aur-repo which is placed on googlecode.com server, however csslayer-aur-repo.googlecode.com sometimes returns IP of server which doesn't seem to have csslayer-aur-repo.db.tar.gz file. As a workaround i've put csslayer-aur-repo.googlecode.com in /etc/hosts with an IP which works just fine. I've tested it with wget and ping, and both of them seem to use this "new" IP address. However pacman seems to ignore /etc/hosts and picks that random IP which mostly leads to "404 not found" error when doing pacman -Syu/Syy/Sy.
    Here is my /etc/hosts
    # /etc/hosts: static lookup table for host names
    #<ip-address> <hostname.domain.org> <hostname>
    127.0.0.1 localhost.localdomain localhost Archie
    209.85.135.82 csslayer-aur-repo.googlecode.com
    # End of file
    and here is the repo entry from pacman.conf:
    [csslayer-aur-repo]
    Server = http://csslayer-aur-repo.googlecode.com/files

    Yup, wget fetches http://csslayer-aur-repo.googlecode.com … .db.tar.gz just fine and it uses the IP specified in /etc/hosts.
    Surely pacman does not deploy its own DNS server, but seems to ignore /etc/hosts. If i remove csslayer line from /etc/hosts then wget also will fail.
    [hash@Archie ~]$ wget http://csslayer-aur-repo.googlecode.com/files/csslayer-aur-repo.db.tar.gz
    --2010-07-26 18:54:29-- http://csslayer-aur-repo.googlecode.com/files/csslayer-aur-repo.db.tar.gz
    Translacja csslayer-aur-repo.googlecode.com... 209.85.135.82
    Łączenie się z csslayer-aur-repo.googlecode.com|209.85.135.82|:80... połączono.
    Żądanie HTTP wysłano, oczekiwanie na odpowiedź... 200 OK
    Długość: 1190 (1,2K) [application/x-gzip]
    Zapis do: `csslayer-aur-repo.db.tar.gz'
    100%[=============================================================================================================================================================================>] 1.190 --.-K/s w 0,02s
    2010-07-26 18:54:30 (72,5 KB/s) - zapisano `csslayer-aur-repo.db.tar.gz' [1190/1190]
    [hash@Archie ~]$ pacman -Syu
    :: Synchronizing package databases...
    kde-unstable is up to date
    core is up to date
    extra is up to date
    community is up to date
    error: nie udało się pobrać pliku 'csslayer-aur-repo.db.tar.gz' z csslayer-aur-repo.googlecode.com : Not Found
    error: failed to update csslayer-aur-repo (Not Found)
    Last edited by hash (2010-07-26 16:55:47)

Maybe you are looking for

  • Purpose of text element in scripts

    1. What is the purpose of text element in scripts. When do we use it ? 2. Is text element window specific or only pertaning to main window ?

  • Ipad - Security Question

    Hi, My name is Mr McGarrity and i have an apple ipad. I have forgotten the security question answeres and I have tried the reset link so that it emails a reset link to my alternate email but this is not possible for me as the email apple want to send

  • How to create a Photo Layer?

    I am using the photoshop elements free trial on 13... I have watched a video on youtube on how to make wooden frames. Well when I get the wooden frames made I then use the earse to make the back ground go away and so I can drag and add picture. Well

  • Can i use fcp7 software on 2 imac machines?

    Hey guys, i have one imac machine with FCP7 and planning to add another imac(i5 processor) for graphics and video editing purposes. I would like to know if i could install the same software(FCP7) on the second machine. Please help me out.

  • Facebook isn't communicating

    My Facebook isn't communicating.  Does anyone know what's goin on? If anyone can help i'd greatly appreciate it. thanks, Cathie