Programming :: Script To Find Local IP - Output Unknown Host

Nov 24, 2010

I want to find out my IP and I test this code from beej tutorial:

Code:
char hostname[128];
int i;
struct hostent *he;
struct in_addr **addr_list;
struct in_addr addr;

gethostname(hostname, sizeof hostname);
printf("My hostname: %s
", hostname);
he = gethostbyname(hostname);
if (he == NULL) { // do some error checking
herror("gethostbyname"); // herror(), NOT perror()
return 1;
} // print information about this host:
printf("Official name is: %s
", he->h_name);
printf("IP address: %s
", inet_ntoa(*(struct in_addr*)he->h_addr));
printf("All addresses: ");
addr_list = (struct in_addr **)he->h_addr_list;

for(i = 0; addr_list[i] != NULL; i++) {
printf("%s ", inet_ntoa(*addr_list[i]));
}
printf("
");
return 0;

But my output is this:
Code:
My hostname: vBx
gethostbyname: Unknown host

I heard that it works in windows, why isn't working in linux?

View 1 Replies


ADVERTISEMENT

Server :: Host Unknown Error:Sendmail / Stat=Host Unknown (Name Server: Def-fgh.com.: Host Not Found)?

Sep 8, 2009

Many of mails sent from my mail server that are in Queue;The main reason is deffered by domains like yahoo,aol,etc.but there is one more error that i keep getting and that is Host Unknown,Below is an example from mail log,The catch is,test mail sent on the same email id sent from my personal mail from the same server i.e. url was deliveredHowever,another mail containing client information sent from customercare@mycompanysdomain ended up in queue.

There are more examples of the same,around 20 domain have the same problem.

Sep 7 14:33:46 server2 sendmail[24591]: n8793jiC024589: to=<abc@xyz.fi>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=163672, relay=xyz.fi., dsn=5.1.2, stat=Host unknown (Name server: xyz.fi.: host not found)

Sep 7 22:09:42 server2 sendmail[6407]: n87Gdffa006403: to=<abc@def-fgh.com>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=152474, relay=def-fgh.com., dsn=5.1.2, stat=Host unknown (Name server: def-fgh.com.: host not found)

View 2 Replies View Related

Programming :: Xargs With Output Of Find

Jul 15, 2011

I'm testing some multi-plat java code and I'm getting a bit frustrated with the Linux tests. I need to run the command:
Code:
$ java -jar /home/developer/TCO/TabletComicOptimizer.jar <file> <args[]>
against all the files that match a specific criteria. I've tried various find syntax and I can't seem to get it right.

Normally I would just create a bash script and populate the results of find into an array and then just enumerate the collection but in this specific case I want to demonstrate this operation at the bash terminal.

I've tried things like:
Code:
~/TCO $ find . -type f -iname "*.cb[rz]" | xargs java -jar TabletComicOptimizer.jar {} 1200x1800 ;
Thinking that the {} is the substitution for each file returned by find but it's not working. How do I execute my java program against each result in the find operation?

View 6 Replies View Related

Programming :: Direct Standard Output From Find Command?

Mar 26, 2010

I'm trying to pull out sections from a bunch of files. For one file, I use:

Code:
sed '/string1/,/string2/ !d' <filename.ext >newfilename.ext
to pull out everything between two strings in the original file and put them in a new file.

[code]....

View 3 Replies View Related

Networking :: How To Find Least Busy Host Given Hardcoded Host List?

Oct 12, 2010

I got a bunch of machines (~10) that I share with my co-workers. I have appropriate .ssh file(s) set up so I don't get prompt for password when I try to ssh.Currently I ssh into these hosts and then do a top to check the load before I start using the machine. Because I don't want to be on a busy host.Can someone show me how to write a script that find a least-busy host given a list of hosts to check? (hardcoded is fine)

View 1 Replies View Related

General :: Hostname: Unknown Host

Jan 15, 2010

I am installing ISPconfig on a Ubuntu server 9.10. When i write hostname -f i get the unknown host message.

View 4 Replies View Related

CentOS 5 Server :: Using ISP With DCP - Unknown Host

Mar 24, 2010

I am using comcast ISP with DHCP.

When I type in hostname -f it says unknown host
in /etc/sysconfig/network
hostname=servix.example.com
in /etc/hosts
127.0.0.1 servix.mydomain.com localhost localhost.localdomain
192.168.1.101 example.com www.example.com
in /etc/resolv.conf
search servix.mydomain.com
COMCAST SNS SERVERS
nameserver 192.168.1.1

In linksys router I have host as servix and domain as example.com. So why is it returning unknown host?

View 3 Replies View Related

Fedora :: Konqueror Unknown Host Error

Jul 25, 2011

When I open Konqueror, on Fedora 15 KDE, it opens to the default Start Page just fine. When I try to visit any other website, it gives me an Unknown Host Error. The documentation I found for KDE just said that if I get that error, it means that either the website does not exist or I am not connected to the internet, but I'm quite sure I'm connected to the internet.

View 6 Replies View Related

OpenSUSE Network :: Name Lookup DNS - Unknown Host

Jan 8, 2010

I can lookup DNS hostnames with dig and nslookup, but nothing else seems to be able to resolve anything. ping, telnet, Firefox, everything gets "unknown host".

For example:
> dig yahoo.com
; <<>> DiG 9.6.1-P2 <<>> yahoo.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20438
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 13, ADDITIONAL: 0

;; QUESTION SECTION:
;yahoo.com.INA
;; ANSWER SECTION:
yahoo.com.17579INA209.131.36.159
yahoo.com.17579INA209.191.93.53
yahoo.com.17579INA69.147.114.224

;; AUTHORITY SECTION:
.10071INNSL.ROOT-SERVERS.NET.
.10071INNSI.ROOT-SERVERS.NET.
.10071INNSH.ROOT-SERVERS.NET.
.10071INNSF.ROOT-SERVERS.NET .....

> ping yahoo.com
ping: unknown host yahoo.com
> ping 209.131.36.159
PING 209.131.36.159 (209.131.36.159) 56(84) bytes of data.
64 bytes from 209.131.36.159: icmp_seq=1 ttl=55 time=97.2 ms
64 bytes from 209.131.36.159: icmp_seq=2 ttl=55 time=98.9 ms

View 4 Replies View Related

Ubuntu Networking :: Can't Ping URL - Unknown Host

Apr 5, 2010

I am using ubuntu 9.10 and I still cannot figure out this thing. I work behind a proxy managed by my university. Now, I cannot ping the other users on my network although they can ping me. Not to mention, I also cannot ping [URL]... It says : ping: unknown host [URL]... But I can ping the proxy server.

View 4 Replies View Related

Ubuntu :: Unable To Configure Ip Address - Unknown Host.

Aug 10, 2010

this issue which has suddenly occurred on both my Desktop and my Laptop. When I try to configure an IP address to any interface I get the following error....

uadmin@Ubuntu:~$ ifconfig br0 addr 192.168.10.1/24
addr: Unknown host
ifconfig: `--help' gives usage information.
uadmin@Ubuntu:~$

I get this for ethernet interfaces as well. I do not understand what is different as I was able to configure the ip address only the day before yesterday on the laptop..? The Desktop has had this issue for about 3 weeks now.

br0 Link encap:Ethernet HWaddr 32:70:40:91:06:25
inet6 addr: fe80::3070:40ff:fe91:625/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0

[Code]....

View 2 Replies View Related

Programming :: Find Command With Standard Error Output And Mail Error File

Nov 11, 2010

We make everyday a DB Mysql backup on Linux redhat Enterprise. We are using a bash shell script (and putting it in the crontab) to execute it automatically everyday. We added a line to this script telling, once the backup has completed, to find old backup files (stored on hard disk after each backup) older than x days to remove them. We use the find command (search for file type) with the mtime option and in combination with rm command. Everything runs ok but we also want to add some new code to the same line: If find command cannot find anything or fails, for example if it cannot delete file or fails, send the error message (standard error output) to an error file (like error000001 and increasing) and mail the errorxxxx file to an email address for example to admin@companyname.com. What would be the code for this issue to add it to our find command in the same bash shell script??

View 2 Replies View Related

Ubuntu Networking :: IE: Unknown: For Iwscan Output On 10.10?

Jan 15, 2011

I installed a wireless card and it does see the card but when i do a iwscan I get this.I get a lot of IE: Unknown:This is on Ubuntu 10.10 server with no GUI. I setup scripts to take down and change the interface then put it back up but for this card it does not work.I have two other wireless devices that do work but i would like to remove then and replace them with this one.The other two are USB Wifi Sticks.I am setting this PC to replace a Wifi Router.

sudo iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: C0:3F:0E:28:B7:28

[code]....

View 2 Replies View Related

Fedora Servers :: Gnome Error - Hostname: Unknown Host

Mar 23, 2009

I installed Gnome on my server by when I run

Code:

[root@F026 ~]# startx

Code:

hostname: Unknown host
xauth: creating new authority file /root/.serverauth.2915
X.Org X Server 1.5.3
Release Date: 5 November 2008
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.18-128.1.1.el5 i686

[code]...

I don;t have physical access to the system and it is a server located in Europe. Fedora release 10 (Cambridge) is installed in it.

View 2 Replies View Related

Ubuntu Networking :: Dig Works But Ping Shows 'unknown Host'?

Dec 4, 2010

I've encountered a problem after doing a fresh install with xubuntu 10.10 (2.6.35-23-generic).some sites are blocked like [url]....if I do dig [url]....- I receive the A, CNAME records and the IP address and everything.when ping[url].... - I receive 'unknown host'.when ping <theipaddress> - I receive responses

View 2 Replies View Related

Ubuntu Security :: NMap Lists Unknown Local IP Address

Jul 18, 2010

I wouldn't call myself paranoid, but I do try to keep reasonably secure on my home network (WPA encryption, router firewall, etc.). I also occasionally use nmap to make sure I don't see any unknown computers logged into my network. The problem is I have five computers that all use DHCP on the network and they are not all up all of the time. At most, there are two to three online at any one time.

So, my question is: Do any of the IP addresses remain in the router's database for a computer that has gone offline (shutdown)?

The reason for my question is that today I ran nmap on my home network and noted an IP address that was not currently up on the network. It is, however, an address that is frequently assigned to one of the computers when it is online, but that address was not up at the time I ran nmap. Just trying to make sure my network is not being used by some nearby computer.

View 5 Replies View Related

Networking :: Unknown Host - Placing Eth0 In Dhcp Through The GUI And Bash But Always Get A 169 Address Or 127

Jan 22, 2010

I'm having an issue configuring eth0. I'm using ubuntu 8.10 in a virtual machine (VirtualBox). The correct adapter is being used and it has worked in the past. I've tried placing eth0 in dhcp through the GUI and bash, but always get a 169 address or 127.

When I run the following command:

Code:

The output is:

Code:

View 1 Replies View Related

Ubuntu :: Error : Unknown Timezones Are Treated As The 'floating' Local Timezone

Sep 28, 2010

On Karmic, every once in a while this error pops up near the notification area at the top right (also see attachment):

Timezone Errors See Error Console: Unknown timezones are treated as the 'floating' local timezone.

But the 'date' command shows the correct date/time and timezone. /etc/timezone is also set correctly. The machine is running ntpd and is connected to the net 24/7 via ethernet. I also don't see any 'timezone' errors in /var/log/* Which software is complaining? What is the "Error Console" it is referring to?

View 5 Replies View Related

Fedora :: Mounting Local Filesystems: Mount: Unknown Filesystem Type 'LVM2_member'

Mar 28, 2011

I just updated Fedora 14 with the updates it downloaded and I am now stuck with the error.

View 10 Replies View Related

General :: Why Can't 'scp' From Remote To Local Host

May 31, 2011

I am having difficulty sending files from a remote machine to local one using

Code:
scp
. It is working the other way however. local > remote. I am using the verbose options

[code]....

View 3 Replies View Related

Software :: Compiling A 32-bit, Local Gcc, 64-bit Host

Feb 7, 2011

I've successfully compiled a local gcc(s), but now I want to have multiple versions (which is easy enough), but one in particular, I want to be 32-bit. This one eludes me.

Can anyone suggest what to do in order to compile a 32-bit version of the gcc that I want? All the other versions, 64-bit, compiled no problem.

View 3 Replies View Related

Fedora :: Can't Mount Host On Local Network Via Nsf?

Sep 21, 2009

I have two machines on my local netowrk, one running Fedora 9 and the other Fedora 11,(64 bit version).I made one, machine A, into an NSF server and arranged to export a directory to the other machine B.I made sure the firewalls were allowing nsf traffic, and I restarted all the relevant daemons.But the mounting still doesn't work.I looked at the setup on my Linksys router, but I don't see anything obvious there that might be getting in the way.ping and ssh recognize my names for the two machines and work properly, bu t I've also tried using the numeric local ip addresses.I tried with the program showmount on B to see if there was any connectivity and I getB% showmount -e Aand I get the responseclint_create:RPC: Port mapper failure - RPC: unable to receive.I used to manage a departmental network and set up nfs mounts all the time, but things were simpler then. I am at a lost what to look at next

View 14 Replies View Related

Fedora Networking :: Set Local Host As FQDN?

Dec 11, 2010

I want to install Globus tool kit it says host name is not FQDN(fully qualified domain name) I tried by installing DNS but it doesnt works

I got the configuration. I have posted in following link. I am not able to reply your post i dont know why. [URL]

View 1 Replies View Related

General :: FTP From Remote Host To Local System?

Sep 27, 2010

I'm using Windows XP. I'm connecting to a UNIX box using putty SHH(ksh). Now I want to copy a text file present in remote host to my local system.

View 5 Replies View Related

Ubuntu Security :: Postfix - Not Critical - SMTP Server: Errors From Unknown [ip Address] In Local Recipient Table

Jan 2, 2010

This is a transcript I get emailed at least once every day, usually about 3 to 10 a day recently.

Transcript of session follows.
SMTP server: errors from unknown[ip address]
<boring stuff snipped>
In: RCPT TO: <server@my domain>
Out: 550 5.1.1 <server@my domain>: Recipient address rejected: User unknown in local recipient table

Session aborted, reason: lost connection Now I cannot seem to find anything via Google, as when I put "server@" anywhere in the string, I just get web hosting or other kroomst. The emails usually come from legit places, usually hotels. Does this mean they are sending bad emails, i.e. they have a Trojan/worm, or is this a live hack attempt?. I believe the later, as I might get upto 3 domains from the one ip address, which is always, NOT associated with the listed domain. Not causing me any issues, except I have been getting a lot recently.

View 4 Replies View Related

Ubuntu Servers :: Webpage Can't Be Viewed On Local Host?

Mar 7, 2010

I have tried to set up the desktop version of the server . In my apache2.conf file I have changed the following lines-

Code:
# Include the virtual host configurations:
#Include /etc/apache2/sites-enabled/
Include /home/www/websites/
Yes I do keep the default values commented out

In my virtual host file I have made the following changes to the DocumentRoot, and to one of the <Directory>; the rest of the file doesn't appear here as nothing was changed.

Code:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
# DocumentRoot /var/www

[Code]....

View 7 Replies View Related

Ubuntu Servers :: Exim4 Forwarding To Local Host

Jun 9, 2010

I've recently had to rebuild our mail server - after the old one over heated - and I've realised I never backed up the config files for exim... so now tyring to work out how the hell to configure what I had....

The setup isn't the most straight forward, so I'll try and explain what happens...

- all emails @longdomain.com are received by an hosted server on the internet
- they are then forwarded to @shortdomain.com, the IP for which is our internet connection which fowards port 25 traffic to the exim server
- the exim server then spam and virus checks the emails and forwards them to an exchange server (sorry but it works well for us)....

I've installed exim4/spamassassin/clamav successfully, and it's setup to receive emails for the relevant domains and relay from the hosted server on the internet (and some local addresses).

how I then setup exim4 to foward all emails on the relevant domains to the exchange server?

View 6 Replies View Related

Software :: Monitoring Local Host MySQL In Nagios?

Jan 6, 2010

I am using nagios to monitor a local host and a remote host in a vmware, where both the machines working in CentOS. Now i need to monitor MySQL in my local host so that i should know whether MySQL is up and running. I came across some plugins like

check_MySQL_health
check_MySQL_status
check_MySQL_stat.

While i was trying to install check_MySQL_health, i cant get clear description about the installation and i got stuck with that.

View 2 Replies View Related

Debian Configuration :: IPTables - Local Host Cannot Get Returning Traffic

Sep 20, 2010

I have a strange iptables issues. I have just built a new Debian install and starting adding some real basic rules (see below) the problem seems to be that the localhost itself can't get any returning traffic. That is, it seems to be allowed outgoing traffic but not the connected, returning traffic. Ordinarily allowing Established Connections would resolve this, see the rule below, but it hasn't. Why this doesn't work. Removing the last DROP in the INPUT chains obviously makes the traffic work!

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -j ACCEPT -p tcp --dport 22
iptables -A INPUT -j ACCEPT -s x.x.x.x
iptables -A INPUT -j ACCEPT -s x.x.x.x
iptables -A INPUT -j ACCEPT -s x.x.x.x -p tcp --dport 80
iptables -A INPUT -j ACCEPT -s x.x.x.x -p tcp --dport 8080
iptables -I INPUT 1 -i lo -j ACCEPT
iptables -A INPUT -j DROP

View 3 Replies View Related

Fedora Networking :: Local Host Names Without Domain Using Bind?

May 10, 2009

I want to use single label host names on my local LAN, without using any domain (at least no registered one). My machines should be named in a fashion similar to 'myserver', 'mydesktop' etc. so that i from a browser on any LAN machine may write 'http://myserver', and get the webserver on 'myserver' (so NO domain part, e.g. myserver.domain).

Do i need to create a DNS zone for each host or is there a way to put all host in a single zone, if so; which? Would such a name be considered a root domain?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved