CentOS 5 Networking :: Change A Systems Hostname And IP Address Via Script?
Dec 14, 2010I am looking for a way via script to change a systems hostname and IP address!
View 1 RepliesI am looking for a way via script to change a systems hostname and IP address!
View 1 RepliesNew CentOS 5.4 system working fine. Sys admins came in and copied the hosts file from one of the servers down to my desktop and ever sincethen machine has been slow (progs take 10-20seconds to load). RunningGnome. Luckily I saved the old hosts file and copied it back and all is now well. But I'd like to understand why, particularly as I will need to change myhostname in the future.
As configured:
/etc/hosts (yes my hostname is "dummyName" that I will need to change later)
127.0.0.1 dummyName localhost.localdomain localhost
[code]....
ok so when i sudo apt-get update i get a bunch of crap that says no address associated with hostname
ive googled this and changed my /etc/hosts to all sorts of things and no luck apache wont even work now either. this server is for a few websites the company i work for hosts. currently i swaped it over to another windows based comp but we want it on ubuntu.
ive heard this is dns related? and that a FQDN is needed? if so im not sure how to re write my /hosts file but as of not it looks like this:
Code:
127.0.0.1localhost
63.119.120.135speed
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
[Code].....
I have changed my hostname to - ns1.searchdns.net by
1) editing the files /etc/sysconfig/network
2) then run the command - echo "ns1.searchdns.net" > /proc/sys/kernel/hostname
3) then restarted the service /etc/init.d/network restart
I run the command hostname and it returns ns1.searchdns.net. But I am also supposed to modify the /etc/hosts file. I am not sure about this. The content looks like this at the moment
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.0.20 abc.com
What should my host file look like now? I am not sure if I should also modify the second line or delete it etc.
Right now my setup is as follows: I have an Asus Eeepc 900 running Netbook Remix named eeepc, and a media centre running 64-bit Ubuntu named media.When I try to ping or ssh into one machine from the other, for exampleCode:$ ping mediaI get an "unknown host name" error. However, pinging the device's IP address works. How do I get the computers to recognize each other's host names? Did I miss something in the setup?
View 2 Replies View RelatedI built the system with one name and now want to change it.I do the usual things. change the /etc/hosts file change the hostname with the command hostname newname changed /etc/sysconfig/network and then mail stops working. Put it back to the old name and it works fine.So I am guessing I am missing something in the configuration for sendmail. I checked the sendmail.cf file under /etc/mail and no reference back to the hostname was found.I also tried the GUI on the console to change the hostbname.
View 3 Replies View RelatedIn my working environment have 40 system .Its ip address is given manuallyto connect each for lan connection .40 are not using ubuntu while other using windows .My question is there any package to trace ips of entire system
View 9 Replies View RelatedI can reach other hosts by means of their global addresses by either the IP address or hostname (that has the global address). What I want to (also) do is have a hostname that references the IPv6 link local IP address (an AAAA record in DNS, or just the fe80::<whatever> address in /etc/hosts) and use that host name in commands to access that host. The problem is, an interface ID is needed when making such a reference.
It sure looks like the programs just pass the host name string on to the resolver library, which does not understand the significance of the '%' even though it could find and see that the name preceding the '%' is consistent with that being an IPv6 link local address (e.g. the logic could have been "split at first % and see if preceeding name is found as a link local address and accept that if so, or ignore the split otherwise" ... but it isn't). Is there a different syntax for this ... or was it overlooked in the design of programming around IPv6?I want to be able to address a host by its link local address, while still using a mnemonic instead of having to type the IPv6 address.
Yesterday, while trying on establishing mobile broadband, my hostname changed, and I can't make it yet. My /etc/hosts is
1 127.0.0.1 pc-194-101.fysik.uu.se localhost.localdomain localhost
2 127.0.0.1 pc-194-101.fysik.uu.se roddur
3 ::1 localhost.localdomain roddur
The second line I edited but after a reboot it inserted the first line all automatically and my /etc/sysconfig/network is
1 NETWORKING=yes
2 HOSTNAME=roddur
What I have to do if I have to change my hostname to "roddur"?
first time user of F14 here. Used PCLinuxOS so far. Installed F14 fine , got samba up, set the hostname of the box to fedora.linux BUT when I connect to my wireless router (Belkin) the hostname shown in the routers DHCP client list is different:
Router shows:
IP Address-----Host Name-----------------MAC Address
192.168.2.4----ralf-FK790AA-ABA-m9---00:22:5F:17:dE:98
In terminal it shows
[dagaz@fedora ~]$ hostname
fedora.linux
[dagaz@fedora ~]$
When I search the forum or google, I end up with hostsfile or samba howtos. Those settings all show the right name : fedora.linux Why does the router show ralf-FK7 etc..? and where can I change it?
This morning it would not boot; when I tried to wake up the system, it gave me a bunch of errors, the last ones being as follows: "mount error: could not resolve address for servername: No address associated with hostname mountall: mount /media/shares [1402] terminated with status 1" I am writing this in Win 7 since I lost ubuntu. I am using ubuntu 11.04.
View 2 Replies View Relatedhow to change ip address on centos 5.3 ?i could not search the file such as "interface" ,
View 3 Replies View Related1.) How do I change my root password?
2.) How do I change my SSH port number?
3.) How do I change my Local IP address?
4.) What's a good program or command to renew my MAC address?
5.) How do I install Flash Player?
I've completed the installation of a CentOS server.Running the setup utility as root, ive set up a static IP and installed apache. Now this works ok. I can type in the servers IP address from my browser/putty/winSCP and access the server within the intranet. The problem is that i would also like to access the server using its hostname, e.g. http://centos or whatever Currently i cannot do it. I've searched the forums, edited the /etc/sysconfig/network and /etc/hosts to no avail no matter what i do i cannot access it. i've disabled some services so im not sure if this is the fault.
View 1 Replies View RelatedServer has been moved to a different locations and so the IP has been changed now the hostname is changed to something other that what it was before.
Could it be the rDNS that is causing this?
Note: this is not a DHCP connection.
Givens
LAN
CentOS 5.5
Windows 7 machine (hostname/NETBIOS name: AwesomePC, LAN IP: 192.168.1.20)
Workgroup: Cake
No WINS server
No Domain
No AD
Goal
From CentOS 5.5, have
# ping AwesomePC
resolve to a ping on 192.168.1.20
Problem
# ping AwesomePC
resolves to some random public IP that seems to be coming from my WAN DNS (openDNS) servers
ATTEMPTS
Have edited /etc/nsswitch.conf, edited line: hosts: files wins dns Have edited /etc/resolv.conf, added line: search CAKE Have installed samba (# yum install samba) and run (# service smb start), with /etc/samba/smb.conf, workgroup = CAKE, name resolve order = wins host lmhosts bcast
Does # ping even care about samba? How can I get this to work?
I am having a problem logging into my remote gentoo (2.6.23) linux machine using my hostname from my Windows XP machine using cygwin. I can login using my ip address, but not the hostname.
This works:
$ ssh me@xxx.xxx.xx.xxx
This does NOT work:
$ ssh me@my_hostname
ssh: connect to host my_hostname port 22: Connection refused
I have verified that my hostname is indeed "my_hostname" on my linux machine by using the "hostname" command.
I 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.
I have a server running centos 5 located in a datacenter. I am setting it up as a web server but haven't bothered to move the domain from my current registrar to the server as there are a lot of things I need to get done before that. I am having a problem where I couldn't install httpd. So i tried some of the basic fixes i knew as far as yum clean all and checking that my /etc/resolv.conf was ok. I have the two nameservers I am using listed there but I have no hostname set because I simply dont have the domain transferred or anything like that yet. Is that the reason I am having these issues. I installed the system with a network install fine about a month ago so im not sure why I am having problems now.When i try to ping centos.org I get an unknown host www.centos.org error. I tried changing the resolv.conf to have localhost as the hostname and I still have the same issues. I havent made any changes to anything that would potentially cause this.
My etc/resolv.conf looks like this:
search
nameserver 12.34.567.8
nameserver 12.34.566.8
Also it seems the problem may have got worse after yum clean-all because before that when I would try 'yum install httpd' it would show the files and filesizes and ask to install, when I would select yes It would give an error showing it could not find the fastestmirror. Now it doesn't give any file size or files or an option to approve the install. It just responds with an error saying it could not retrieve mirrorlist
<urlopen error (-3, 'Temporary failure in name resolution' Error Cannot find a valid baseurl for repo: base
I have a machine running Slackware 13. Recently I had to modify network settings on it and now I cannot ssh into that box from my local LAN using machine's name. I can only ssh by using its IP address.I searched the forums, Google, but I cannot find the solution.
View 6 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.
OS: CentOS 5.3 Enterprise Server
Red Hat Nash Version 5.1.19.6
I need to find a command-line program to randomly change my MAC address. I know on Ubuntu there is a program called 'macchanger'. And on Windows another one called 'macshift'. I just can't find one for CentOS 5.3 Enterprise Edition.
I have a number of CentOS servers with latest 5.xI have 3 nameservers in the resolv.conf files. All 3 nameservers test out fine when checking for domain lookups.I'm having some trouble with ns1 and shut it down.l None of the CentOS machines fail over to the ns2 & ns3 entries. Basically everything stops resolving even though the other 2 nameservers are alive and well.
View 1 Replies View RelatedI installed the Centos 5.5 and after the Xen. After I put a virtual machine named VM01.Initially it worked properly, I tried everything and it worked.When rebooted, I had problems with the network.I have two network cards eth0 and eth1, but eth1 does not have any ip and I use only eth0.The error that appears is:
vif0.0: received packet with own address the source address
I have a ubuntu server 10.04 that will not boot. I saysno ip address specified and hostname not found refer to mount cifs blah blah blahmountall mount /directory/share [863] terminate with status 32I know its because I had a share mounted at boot but the server cannot mount the share for some reason. is there a way around this so I can boot the machine.I can ping the server. I just cant ssh to it. I need to get to a prompt some how so I can remove the mount from fstab.
View 1 Replies View RelatedI am having a problem getting a wireless network connection on my DELL laptop running CentOS 5. I have no problem getting a wireless connection when the laptop is booted in Windows XP. I also don't have a problem when booted under CentOS 5 and there is no authentication setup on the wireless router. I only have a problem when I setup authentication. The router wireless log shows the PC connectinng, authenticating, and succeeding authentication.I am using the Broadcom Hybrid-wl wireless driver.
View 19 Replies View RelatedI am a developer, not a network admin - sorry if this ia dumb question. I need to test an application on CentOS 55 64 bit. The instalation went fine and initially I let DHCP work its magic. The router IP address ia 192.168.0.1 and all other VM's I have are granted dynamic ip address on this range (i.e. 192.168.0.x). However, the CentOS vm got an IP address that looks like it belongs on a different subnet :192.168.1.1
The VM (vmware desktop) network setting for this VM uses "Bridged: Connected directly to the physical network". I can ping the host (Windows 7 64 bit) and the host can ping it (it been the VM) - but no other computer on the network can see it. To make things easier, I changed the network configuration to use a static IP address. Here are my configuration files:
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0C:29:83:4B:A4
ONBOOT=yes
TYPE=Ethernet
[Code]...
Some people may need to change the mac address of their ethernet network cards. This can be easily done with fedora with command line. Just follow the steps below:
1. Log as root on a textual console (ctrl+F2) or through "su -" command in your console
2. Print your network configuration with ifconfig
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:23:8B:6A:7E:9E
inet addr:10.1.128.244 Bcast:10.1.255.255 Mask:255.255.0.0
inet6 addr: fe80::218:8bff:fedb:7e9e/64 Scope:Link
[code].....
Here, eth0 is the ethernet interface of your system. The mac address is put in red.
3. Change your mac address using the following syntax
ifconfig eth0 hw ether 00:18:8BA:7E:90
The new value (in green) must be hexadecimal
4. if you have a dhcp server that distributes the adresses automatically, then request a new adress for your eth0 interface
[root@localhost ~]# dhclient eth0
5. Now, your interface is up and have a new mac and IP addresses. This feature may be useful if the network administrator ban you according to the mac adress, for example .........
[URL]