General :: Difference Between $HOSTNAME And $(hostname)
Jan 21, 2010the difference between $HOSTNAME and $(hostname)?
View 5 Repliesthe difference between $HOSTNAME and $(hostname)?
View 5 RepliesI have a network of 2 WinXP machines and one linux box. I have fiddled around with the settings as you do when learning. The network is working. The network neighbourhood on the WinXP machines recognise the linux box and vice versa, (the linux Places|Network recognises the 2 WinXP). I can Ping the linux box using its hostname from a WinXp. But I cannot do the reverse. I get an 'unknown host' response. I can ping the linux to itself using its hostname.
View 7 Replies View RelatedI'm having an issue on two Fedora Core 13 machines where I can ping others by hostname, but the hostname resolution fails whenever I use ssh/scp/vnc/etc. I can still do these things by IP address, just not by hostname. RHEL5.3 machines on the same network with the same configuration do not seem to have this problem.
Here's the not-so-quick-and-dirty description of the situation:
I know that there is a virtual router at 192.168.31.1 and another at 192.168.30.1. I also know that there is another network (let's call it 90.90.90.0) and on that network lies a number of resources. By nature of this configuration, any machine on 90.90.90.0 can be accessed by any 192.168.x.x, but not the other way around. Beyond that is out of my hands and currently out of my scope of knowledge.
I have a dnsmasq server on 90.90.90.10 that operates as a secondary nameserver, another machine out of my sphere of influence is the primary nameserver (90.90.90.31).
The secondary nameserver on 90.90.90.10 holds the hostnames of our development machines. The problem is that in some cases, while I can ping by hostname all day long, services such as ssh, scp, vncviewer, etc all fail to resolve the hostname. In other cases I can do all of these things.
Every machine has an equivalent resolv.conf:
As an example, I will show the output of a handful of my development machines:
I also included columbia as a one-way test -- even though it cannot access 30.x or 31.x, they can access it:
columbia -- physical machine, Red Hat Enterprise 5.3, IP 192.168.100.200
Okay, so here are the various outputs. Remember, nibbler, discovery, and atlantis can ALL:
- Ping by IP address
- Ping by hostname
- ssh, scp, vnc, etc by IP addess
Additionally, the SERVFAIL reply from 90.90.90.31 is expected since my dnsmasq server is on the secondary server.
Note that the only machine that can both ping and ssh/scp/etc by hostname is nibbler, which also happens to be the only one of the three running RHEL5.3 instead of FC13. Other virtual and physical machines running on the 192.168.31.0 and 192.168.30.0 networks (all running RHEL5.3) work just like nibbler does. So the problem seems to only affect machines running FC13.
Final note: selinux is disabled, iptables is disabled, ip6tables is disabled.
Other than that, discovery is a brand-spanking-new install straight off of the FC13 DVD. atlantis has been around longer, but its just a file server so I haven't done anything too crazy to it.
How do I set $HOSTNAME to dynamically update with the hostname that is specified for the ip in DNS?
View 3 Replies View RelatedI'm trying to ping another Ubuntu computer on my local network. If I try doing,ping <hostname>then I get the messageping: unknown host <hostname>however, if I doping <hostname>.localthen I get a response back. I was wondering how I can change it so that I can ping without having to append .localI've installed winbind and modified my /etc/nsswitch.conf file but this has made no difference.
View 2 Replies View RelatedI have an ubuntu 10.04 server with hostname "abc.domain.com". However, due to migration, we had to change to hostname to something else, "xyz".
I have done changing /etc/hosts and /etc/hostname and run /etc/init.d/hostname start.
Checking the hostname and all shows it is now using hostsname of xyz. However, email sending out is still using old hostname. We have some scripts that will send out alerts like failed rsync or hdd space full to my email account. But I see the sender is still "root@abc.domain.com".
How do change that to xyz? I am using postfix. I have edited main.cf and restarted postfix but no go.
What is the difference between /etc/hosts and /etc/hostname?
I think the /etc/hosts file stores all ip address associated with this computer, but what about /etc/hostname?
It sounds almost like the computer name, but what is it used for?
I installed a new instance of Ubuntu server (10.04) and set the hostname equal to "ubuntu-10.04-server-i386". However when I type the command hostname I get that the hostname is equal to "ubuntu-10". I then realised that the command hostname --long gives me the full name (as defined when doing the linux installation) while hostname --short gives me the name as displayed in terminal. My question is; what is the difference between these two? Are both valid?
View 4 Replies View RelatedI'm using Ubuntu 10.04 LTS
By typing the command:
hostname --fqdn
I get the following
hostname: Name or service not known
As requested by Raphaƫl Hertzog
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
[Code].....
I have some problem some one changed hostname on my system. If I do following I see
Code:
knoppix:~# cat /etc/hostname
debian
knoppix which is coming in left side in above output is not my hostname.
The hostname is debian.
How do I get that name back so that when I do cat /etc/hostname output is like following.
Code:
debian:~# cat /etc/hostname
debian
I've installed a new copy of Ubuntu 10.10.Now the big question for me is how do we assign hostname to a given ip? I've given the hostname during the server installation and "cat hosts" says "ebox" hostname I'm trying to put on.Also,I modified the network/interfaces to static and assigned proper values.
#hostname returns ipaddr not the hostname. Also nslookup hostname/ipaddr says server can't find ....
So,is installing dns through bind and setting-up the only way to do that?
I am having problem resolving hostname. i had 1 server and its hostname is resolving fine. i purchased 1 vps and its hostname isnt resolving. for server 1 say hostname is server1.domain.com. and for vps i add server2.domain.com. and when i ping my server2.domain.com i get Host Unknown error. do i add Hostname and make it resolve in VPS. i want to use hostname like server2.domain.com.
View 1 Replies View RelatedI just upgraded to Ubuntu 11.0.4 (from 10). In my /etc/hostname file, I defined my machine's name, "my-machine". From the server, I'm able to SSH to myself,
ssh dave@my-machine
However, from another machine in the same network, I'm not able to SSH
Code:
davea-mbp2:systems davea$ ssh dave@my-machine
ssh: Could not resolve hostname my-machine: nodename nor servname provided, or not known
However, I'm able to SSH in using the machine's IP address. how I get my machine name recognized on the network?
i have a variable called hostname which contains hostname of my machine. How would i add the hostname to output of other command . For eg. if a output of command is . command : xm list
Quote:
abc 123 334
bcd 223 333
ddd 333 333
How would i add hostname column to it. My output should look like
Quote:
abc 123 334 hostname
bcd 223 333 hostname
ddd 333 333 hostname
I admit I am a little green with the "Bourne Again Shell" (Bash), even though I was always not as proficient with the Bourne or Korn shell as with C Shell. From recent research the public sway is to Bash over tcsh. I can see I have been away from Linux/UNIX way to long. Running a network of workstations (upto 6) and servers (2) running RH Enterprise Linux 5.4 plus in the same network is an old DEC Alpha running Tru64 UNIX (don't know which version): I looking for a method to get the hostname I am logged in on to use in a Bash (or if necessary sh) script. This is to be added to an auto_start shell script start up our application on Linux workstation and servers.
View 7 Replies View RelatedI am installing ISPconfig on a Ubuntu server 9.10. When i write hostname -f i get the unknown host message.
View 4 Replies View RelatedAccidentally i have deleted my /bin/hostname file
i am using redhat centos 5.4 so me how to recover it
I have configured one samba server. its working fine. the problem is whe we connect from windows machine , through ipaddress its connected. but i am not able to connect through hostname.
View 7 Replies View RelatedI have a version of slackware installed as a virtual machine and am not able to ping hosts or otherwise receive data from any IP addresses external to the LAN. I think this problem is due to the hostname of the vm not being recognized by the gateway (ddwrt); the vm receives an IP via dhcp but the gateway does not seem to recognize its hostname (registers as *).
Will readily respond with whatever conf file is needed.
I configure a Linux Suse 10 box, added static IP, DNS (resolv), gateway (routes) but I am not able to ping other servers by name but nslookup works and the server can navigate on internet check below the problematic server is server-host20
Code:
Other server can ping that server by name just fine
All my network information by the way my server can ping DNS server by name just ok and as you see nslookup works.
Code:
When I try to connect different host by using ssh , its not working and throwing me an error "name or service not known" ssh usw3tvx@lalqau40ssh: lalqau40: Name or service not knownHowever I tried ssh with ip address, it works...
View 2 Replies View RelatedHow do I check/setup that only the server can send mail (maybe by IP or hostname)? I have a debian server that sends mail through the PHP mail() function with no problems. The server uses sendmail. My concern is how do I make sure only the server itself can send mails through that server. Because it would be bad if spammers would use it as a relay server.
System:
- Debian Lenny
- PHP5
- Apache2
- MySQL 5
- PHPmyadmin
- Sendmail
I want to change the Hostname of my Red Hat9 Linux machine using command line. By default it show me as following
[root@localhost root]#
I want to see it as
[root@pc1 root]#
Is there any way to change host name?
I am in the middle of trying to write my first script. I have created a command using sed and grep to grab a list of ftp hosts from a host file. Now I want to test the ftp connection of the hosts that have been returned after running the command.
grep host config.xml | sed 's/<//g;s/>//g;s/host//g;s/[/]//g' | sort | uniq -d | ftp ftp.hostname.com
I get the below error
Unknown AUTH type.
Unknown AUTH type.
KERBEROS_V4 rejected as an authentication type
Password:Name (ftp.hostname.com:username):
First off I should say that I am a total Linux and Networking Noob. I have used Windows all my life, but I am now trying to get into linux so I have set up an old PC with Fedora.
Currently I only have the Linux Box and a Windows 7 Box and they are both connected to my broadband router. I have set them up with static IP addresses in the router and they can both ping each other by IP address but not hostname. I would like to be able to use hostnames to access each box (e.g. for SSH access and File Sharing). My question is basically how can I do this, what are the options and which is recommended for a small home network?
So far I have been able to set up the linux box to be able to ping the Windows box by hostname by editing the hosts file. Is this the right thing to do? Should I just do this on the Windows box too?
I'm trying to write a script to change the hostname of the computer at the first boot. The reason why I need this script is because I manage a number of training computer and I use Ghost to re-image it every 2 months. The script will read the mac address and the hostname from a csv file and compare it with the mac address on the current machine. I have stuck and don't know what is wrong as I'm new with script.
csv format:
Code:
00:11:22:33:44:55 host01
00:11:22:33:44:56 host02
script:
Code:
#!/bin/bash
# Description
# Change HOSTNAME for each machine from CSV file
#
# CSV File Format
# Each line contains two columns - mac address & hostname
# Description End .....
My colleague changed the hostname using "system-config-network", but now I want to change it using any how (either system-config-network or /etc/sysconfig/network). Even I changed it from /etc/sysconfig/network. But when I reboot the system its getting old hostname. Is there some other place to change hostname?
View 5 Replies View RelatedI am looking an neat trick / elegant solution to manipulate / modify hostname and set a variable to the value inside a script.I have figured what I want to do.I just want to know how to set the variable correctly ?
View 1 Replies View RelatedI am looking for a clue in shell or ant script, where I excecute a binay file on linux. For example ./myfile.bin which ask me few questions.
./myfile.bin ...........................100%
I would like to automate this process where I want to pass the hostname as a variable or read from a file is it possible? If yes any sample`s on this. I can do if this was a shell script ($1) but not sure when its binary.
I'm writing a bash script that executes a few perl scripts. One of the perl scripts that I need to execute requires two arguments with it. The arguments are stored in a txt file, each line contains a hostname and its corresponding IP address separated by a ":" (colon), the txt file looks like this below:
[Code]...
I'm not sure if it's the best way to accomplish this but here it goes. In the bash file, let's call it getHosts.sh, I create an array and assign each line of the file to an element in that array. I then think I need to create a new array where I take the hostname (which is before the ":") separate it from its IP address and place the IP address on a new line just below the hostname (this way I can reference to it like $hostNames[$x] would be the hostname, and $hostNames[$x+1] would be its IP address). So the new array would now look like this below:
[Code]...