Editing /etc/hosts
On OS X client I routinely edit /etc/hosts to add names for my various servers, local and remote, as well as to block some of the better known malware and virus sites and the more egregious Internet hucksters -- er, ad sites.
10.1.10.47 rama
10.1.10.48 athene
144.15.97.289 web yogurt davone
127.0.0.1 scum.sucker.com
127.0.0.1 evil.banners.net
etc.
I'm hesitant to do the same thing on Server (for example, I know better than to manually edit /etc/apache2/http.conf). My current hosts file in client is over 2500 lines, so if I have to manage this through Server Admin I'd like to get started now.
Ever since I started using OS X Server, I haven't touched /etc/hosts. I would use the DNS server to deal with the scum.suckers.com, and Workgroup Manager (and DNS again, unfortunately) to manage the actual hosts on your network. I'm curious on the efficacy of managing 2500 actual hosts with Workgroup Manager, though.
Similar Messages
-
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:
suneelgvWell 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 -
How to edit /etc/hosts?
I need to add a hostname and IP address to /etc/hosts, so that I can access server at a hosting site, after I connect via VPN. The hostname that I need to use is not in the DNS, so I need to add it manually to /etc/hosts. I can't seem to find my root pwd, but I have an account with Admin access. Isn't there some tool for editing this file? Otherwise, I'll need to enable the root account somehow.
Use a tool such as TextWrangler which allows administrators to authenticate to root, or sudo with a command line text editor.
(45358) -
Unable to edit /etc/hosts with permission denied error
[15:45:02][rabbie@sandnigga:~]# sudo cat /etc/hosts
Password:
cat: /etc/hosts: Permission denied
[15:45:09][rabbie@sandnigga:~]#
Basically that's my problem right there. I cant edit / view / change the hosts file on my macbook pro but I can delete it and create a new one. If I do delete it and create a new one, that new file then has the same problem only a few minutes later.
Does anyone have any ideas ?
I have also tried to change the ownership and permissions of the file:
[15:45:09][rabbie@sandnigga:~]# ls -la /etc/hosts
-rwxrwxrwx 1 root wheel 290 18 Sep 20:38 /etc/hosts
No luck.
Thanks in advance for any help.Hey Bob,
The hosts file is often edited and added to by network administrators as well as web developers to force your local computer to resolve DNS for sites whos DNS is not yet publicly available.
I actually found the problem and root cause behind this. I installed BitDefender Antivirus on my MacBook Pro and the uninstall script did not successfully remove all settings / files. There were still some BitDefender files locking processes and files on my Mac and so I just ended up Wiping my drive and re-installing Mountain Lion.
Thanks for your attempt to help anyway. -
Hosts-update: automatically append the mvp blocklist to /etc/hosts
This util written by wintervenom has actually been in the AUR for going on 2 years now.
What it does:
Updates /etc/hosts with the mvps blocklist to prevent thousands of parasites, hijackers and unwanted adware/spyware/privacy websites from working.
Operation is trivial:
1) Edit /etc/hosts.local to match the hostname of your system and adjust the domainname as needed. Also add any hosts that you wish to keep i.e. other PCs on your network.
2) Run /usr/bin/update_hosts as root which will append /etc/hosts.local to the mvps blocklist and apply some post processing writing the final file to /etc/hosts automatically.
3) (Optional) Add a cronjob under root crontab at some interval to keep your /etc/hosts fresh.
AUR: https://aur.archlinux.org/packages/hosts-update
Github: https://github.com/graysky2/hosts-update
Original thread: https://bbs.archlinux.org/viewtopic.php?id=106367
Enjoy!
Last edited by graysky (2013-12-11 17:09:06)Sure you can, but not in this particular tool. There is a script written by haarp designed to run on a tomato-usb powered router that does just this. I host the code here: https://github.com/graysky2/adblock
EDIT: I can't remember if it pulls from the same urls as pgl does but you can certainly modify the code to do it.
Last edited by graysky (2013-12-11 19:52:02) -
/etc/hosts works but gets overwritten every boot
On my system (10.6.8) I can edit /etc/hosts and the changes take effect immediately. The problem is that every time I reboot, my changes are overwritten. Does anyone know what could cause this? BTW this is the exact same unsolved issue found in this dead archived thread.
"servy" is a computer on my lan that uses DHCP and registers its name with my router which serves DNS. If I comment out the line for "servy" in my hosts file, it immediately takes effect and I can successfully ping it, or lookup its address with "dscacheutil -q host -a name servy", but as soon as I reboot, the /etc/hosts file no longer has the comment in that line. It's like there's a "last known good" copy of the hosts file somewhere and OSX or some service is restoring it every boot.
timac:~ tim$ cat /etc/hosts
# 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
fe80::1%lo0 localhost
192.168.2.100 servy
timac:~ tim$ ls -la ~/Library/LaunchAgents/
total 32
drwx------ 6 tim staff 204 Nov 13 19:22 .
drwx------+ 42 tim staff 1428 Dec 6 21:21 ..
-rw-r--r-- 1 tim staff 892 Nov 13 2009 [email protected]t.plist
-rw-r--r-- 1 tim staff 425 Nov 13 19:22 com.apple.FolderActions.enabled.plist
-rw-r--r-- 1 tim staff 517 Nov 13 19:22 com.apple.FolderActions.folders.plist
-rw-r--r-- 1 tim staff 677 Oct 22 17:06 org.virtualbox.vboxwebsrv.plist
timac:~ tim$ ls -la /Library/LaunchAgents/
total 16
drwxr-xr-x 4 root wheel 136 Jan 9 12:31 .
drwxrwxr-t+ 56 root admin 1904 Mar 5 2010 ..
-rw-r--r-- 1 root wheel 635 Sep 9 09:04 com.cisco.anyconnect.gui.plist
-rw-r--r-- 1 root wheel 786 Jul 10 2011 com.google.keystone.agent.plist
timac:~ tim$ ls -la /Library/LaunchDaemons/
total 24
drwxr-xr-x 6 root wheel 204 Jan 9 12:31 .
drwxrwxr-t+ 56 root admin 1904 Mar 5 2010 ..
-rw-r--r-- 1 root wheel 485 Aug 31 2009 com.DuetDaemon.plist
-rw-r--r-- 1 root wheel 669 Feb 17 2011 com.apple.third_party_32b_kext_logger.plist
-rw-r--r-- 1 root wheel 562 Sep 9 09:04 com.cisco.anyconnect.vpnagentd.plist
-rw-r--r-- 1 root wheel 790 Jul 10 2011 com.google.keystone.daemon.plist
timac:~ tim$ ls -la /Library/StartupItems/
total 0
drwxr-xr-x 4 root wheel 136 Dec 31 2010 .
drwxrwxr-t+ 56 root admin 1904 Mar 5 2010 ..
drwxr-xr-x 5 root wheel 170 Jan 10 09:23 VirtualBox
drwxr-xr-x 4 root wheel 136 Mar 7 2010 rEFItBlesser -
SCAN LISTENER runs from only one node at a time from /etc/hosts !
Dear all ,
Recently I have to configure RAC in oracle 11g(r2) in AIX 6.1 . Since in this moment it is not possible to configure DNS, so I dont use SCAN ip into the DNS/GNS, I just add the SCAN ip into the host file like :
cat /etc/hosts
SCAN 172.17.0.22
Got the info from : http://www.freeoraclehelp.com/2011/12/scan-setup-for-oracle-11g-release211gr2.html#ORACLE11GR2RACINS
After configuring all the steps of RAC , Every services are ok except SCAN_LISTENER . This listener is up only one node at a time . First time when I chek it from node1 , it shows :
srvctl status scan_listener
SCAN listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node dcdbsvr1
now when I relocate it from node 2 using
"srvctl relocate scan -i 1-n DCDBSVR2" , then the output shows :
srvctl status scan_listener
SCAN listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node dcdbsvr2
Baring these , we have to try to relocate it from the node2 by the following way, then it shows the error :
srvctl relocate scan -i 2 -n DCDBSVR2
resource ora.scan2.vip does not exists
Now my question , How can I run the SCAN and SCAN_LISTENER both of the NODES ?
Here is my listener file (which is in the GRID home location) configuration :
Listener File OF NODE1 AND NODE 2:
==================================
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON
LISTENER_SCAN1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC) (KEY = LISTENER_SCAN1)
ADR_BASE_LISTENER_SCAN1 = /U01/APP/ORACLE
2)
Another issue , when I give the command : " ifconfig -a " , then it shows the SCAN ip either node1 or node2 . suppose if the SCAN ip is in the node1 , and then if I run the "relocate" command from node2 , the ip goes to the Node 2 . is it a correct situation ? advice plz ... ...
thx in advance .. ...
Edited by: shipon_97 on Jan 10, 2012 7:22 AM
Edited by: shipon_97 on Jan 10, 2012 7:31 AMAfter configuring all the steps of RAC , Every services are ok except SCAN_LISTENER . This listener is up only one node at a time . First time when I chek it from node1 , it shows :If I am not wrong and after looking at the document you sent, you will be able to use only once scan in case you use /etc/host file and this will be up on only one node where you added this scan entry in /etc/hosts file.
Now my question , How can I run the SCAN and SCAN_LISTENER both of the NODES ?Probably you can't in your case, you might run only one i think and on one node only
srvctl status scan_listener
SCAN listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node dcdbsvr1
now when I relocate it from node 2 using
"srvctl relocate scan -i 1 -n DCDBSVR2" , then the output shows :
srvctl status scan_listener
SCAN listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node dcdbsvr2You moved scan listener from node 1 to node 2, OK
Baring these , we have to try to relocate it from the node2 by the following way, then it shows the error :
srvctl relocate scan -i 2 -n DCDBSVR2
resource ora.scan2.vip does not exists
--------------------------------------------------------------------------------Since you have only one scan, you can't relocate "2". So ise "1" instead here also
FYI
http://www.oracle.com/technetwork/database/clustering/overview/scan-129069.pdf
Salman -
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). -
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 SkitBecause 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) -
How do I edit the hosts file in Lion
I tried to edit the hosts file in Lion with: sudo nano /private/etc/hosts. Then entered Password. The window came up blank evev though I know there is data there.
Thanks BD for your response. I have looked at Youtube where they are demonstrating how to do this by using sudo nano /etc/hosts. After entering the Password it shows a screen with the text of the hosts file. On the bottom of the screen it shows the number of lines read. When I do the same thing I get a blank screen and on the bottom it says no file. I am either doing something wrong or this does not work. I even tried changing the permissions of the hosts file to R & W for system, wheel, and everyone. This also did not work. I have not tried Hostal yet but if I can't find a simple way to text edit the hosts file I will give it a try.
-
/etc/hosts Prank Gone Wrong, need help restoring files to original
Some friends were messing around on my computer and playing a joke on me
using the sudo pico /etc/hosts command they were able to send me from sites I wanted to visit, like facebook, to sites I didnt want to visit..
what they wrote was:
67.55.108.167 facebook.com
67.55.108.167 www.facebook.com
I have since deleted it but the every time I go to facebook from another sight I am still redirected. The odd part is that I can go to facebook, but only after ive been redirected. What I mean is, I try to go to facebook, get redirected, then try to go to facebook right away. If I do that it works fine. Also Safari is the only internet browser that is effected. Opera and Firefox are both un effected. I tried uninstalling and reinstalling safari as well as using the same command as they did, but in reverse. Still no luck. Any suggestion? Unfortunately they didnt back up the /etc/hosts before they edited itYou might also want to flush your DNS cache
dscacheutil -flushcache
Also make that password change.
Look in System Preferences -> Accounts to see if your friends added any new admin accounts or granted an existing account admin access.
If they know how to create ssh-keygen keys, they could have deposited a key in your /private/var/root/.ssh/authorized_keys2 file.
There are any number of additional tricks they could have done, if they had admin access. I'm just scratching the surface.
If you do trust these friends, then most likely they just played with /etc/hosts. If they are the kind of friends that get malicious, I would consider the "nuke and pave" reinstall. -
Can you edit the HOSTS file on an iphone?
Is there a way to edit the iPhone equivalent of an /etc/hosts file? This is necessary to access some internal test/dev resources on our network. Jailbreaking is NOT an option. Creating and installing configuration profiles via the iPhone Configuration Utility would be allowable.
Why? There's no way they are going to pay a licensing fee for something like that.
-
Interconnect ip is not visible in /etc/hosts !!
Hi, all.
The db is 11.2.0.3 on a linux machine. (2-node RAC)
select * from v$cluster_interconnects;
NAME IP_ADDRESS IS_PUBLIC
bond1:1 122.254.188.11 NOThe 122.254.188.11 ip address does not exists in /etc/hosts.
Does this mean mis-configuration for interconnector?
Thanks in advance.
Best Regards.
Edited by: 869578 on 2013. 2. 27 오후 9:34Hi Friend,
Please check the following :
1. IP Addresses are configured using one of the following options :
a. Oracle Grid Naming Service (GNS) Using one static address defined during your installation.
b. Static addresses that network administrators assign on a network domain name server (DNS) for each node (In your case two nodes)
2. Public IP must registered in the domain name server (DNS) or the /etc/hosts file.
Finally, the cluster must have the following :
1. Public IP for each node
2. Virtual IP for each node
3. Private IP for each node
4. Single Client Access Name (SCAN) for the cluster
Hope it Helps..
Thanks
LaserSoft -
Is there a similar file to windows\ssytem32\drivers\etc\hosts in OS X
Hi,
I am running a Windows 2003 Server with several websites. I would like to view my websites from my new Imac, however I keep getting prompted for the user name and password for the router.
In windows on my old computer I could edit the file C:\Windows\System32\Drivers\etc\hosts with the IP address and URL of the site and it would open. Is there a similar file in the Mac OS X 10.5.7 software.
Many Thanks in anticipation{quote:title=Herr Lazaro wrote: > So if /etc/hosts works reliably I'll probably switch to it}{quote}
Adding host records by editing the /etc/hosts file is not entirely reliably. Since Leopard, some people have reported issues of the added host records "mysteriously" disappearing, or Apache not being able to properly resolve the added hosts. The bigger issue is that the modifications in the /etc/hosts file can create unwanted side effects in the normal functioning of services like the mail server and others.
Since Leopard, there has been an alternate way to add host records using the dscl utility. In fact, by many, it is considered the better, more reliable, and safer method.
You can read this recent article to see how its done:
http://tomafro.net/2009/07/dscl-the-easy-way-to-add-hosts-on-osx
There are a number of additional articles on the web about using dscl for adding host records to OS X.
The choice, of course, is yours. If you are using the /etc/hosts file without issue, then it might be safe to continue doing so. But, if your system starts experiencing domain name resolution issues or problems with services such as the mail server, you should consider switching to and using the dslocal database to manage your host records. -
I guess this belongs here, if not, mods, I apologize :)
I set up a Centos server and was browsing logfiles and noticed that instead of the usual 'localhost' string that I see in my Arch logs it had my hostname in all of the log files. After a little digging I found this on the Debian forum. I've edited my /etc/hosts how the post describes and lo and behold, after restarting syslog-ng, I get my pretty hostname in my logs. My question is, this runs contrary to how the Beginners Guide directs to set up that file and contrary to how the Arch installer sets up /etc/hosts. Did I just mess something up or is this an oversight? I didn't want to go editing wiki pages not knowing for sure. It seems like everything is running just fine on my machine now.
For reference, here is how my /etc/hosts was:
127.0.0.1 localhost.localdomain localhost archdesk
This is how it is now
127.0.0.1 archdesk localhost
Thanks.The hosts file has three parts on each line. First is the ip, second the canonical (full) hostname and the third part is an optional list of aliases. In your old situation this means that the first alias (which was used for the logfile) was localhost.
With either:
127.0.0.1 localhost.localdomain archdesk localhost
or:
127.0.0.1 archdesk.localdomain archdesk localhost
I would expect you get the desired behaviour (not 100% sure though).
Read
man hosts
to learn more.
Maybe you are looking for
-
My son has locked his ipod touch and cannot remeber the passcode, it is stuck on ipod disabled. We have tried to connect it to itunes but keeps asking for passcode, have tried to log a support call, but asks for seriel number which we cannot find as
-
Can I set iWeb to automatically use my font/style/size?
Is there a way to get iWeb to automatically set the font, style and size that I want to use in my iWebpage? I want to use Optima. I went to the iWeb preferences menu but it does not mention fonts. Last night I had to first delete all the examples in
-
[JS CS3] can windows be stacked?
Hello, I have a script that calls up a window, let's name it Master. The master in turn has many buttons to run many scripts. The scripts that take a long time to run also call up a window that states "Wait a sec, I'm working." It closes once the scr
-
Good Evening, Maybe someone out there can help me out. I have been working on this rather long statement. Line 5 which has the to_char function is throwing an error and I don't know how to get around it. Without this line the query returns the desire
-
FAN event on OCI (11.2.0.2) on Win32
Hello guys, We are developing OCI 11.2.0.2 based client with FAN event handler on Win32 (in C not C++). Some how when we compile our code on windows the callback doesn't get any FAN event. The same code complied on linux gets FAN events we expect. Wh