Tag Info

Hot answers tagged

29

The hosts file is for DNS resolution. DNS resolve names to IP addresses, and has nothing to do with ports I am afraid. You will need to use something else in conjunction with the hosts file to redirect the port (Mangle the TCP header by altering the destination port). With iptables: Does MAC OS use iptables / netfilter (I didn't think it did)..? If OS X ...


27

Based on my own experience and what I encountered while Googling, here are some things to try: 1. Did you check that it works correctly? Changes to hosts should take effect immediately, but Windows caches name resolution data so for some time the old records may be used. Open a command line (Windows+R, cmd, Enter) and type: ipconfig /flushdns To drop ...


23

There's no 100% reliable way for you to detect that you're in a VM, just like there's no way to detect whether you're actually in the Matrix, or if you're actually a computer simulation. However, if the provider is an idiot, you can tell that you're in a VM from the following handy list: Xen: /proc/sys/xen exists OpenVZ/Virtuozzo: /proc/vz exists VMWare: ...


21

First of all, physical machines tend to have more memory than VPSs. Question 512MB or less. Secondly you can check several things to find a VPS. You'll commonly find virtual machines have surprisingly basic looking hardware in them. Like KVM has a "Cirrus Logic GD 5446" graphics card. VMWare used to have an RTL8129 network card in. This is so most OS ...


18

No, the hosts file is simply a way to statically resolve names when no DNS server is present.


16

I don't understand why you have more than 1 line in the file for this IP. Assuming the 4 hostnames you want to access the IP via are nerto, nerto.it, eventlog.in, and eventlog.it, this should work: 81.174.66.48 nerto.it eventlog.in eventlog.it nerto


14

Any chance you are using a proxy server for browsing? If so it might be that the proxy server is resolving the dns name for you. And thats why you get different results in a commandline with ping as opposed to the browser. Off chance traffic is intercepted and changed. Very off chance...


14

Generally the hosts file will be used for both forward and reverse lookups. The preference on a Unix system this will depend on the order of entries in you nsswitch.conf file. e.g. the line below will make the hosts file override DNS. Reversing the entries will make DNS override the hosts file. hosts: files dns I am not sure if you can tune to ...


14

You could set your network card to have 253 static IP addresses - but that's really not a good way to do this. If you just want to host multiple sites on one IP address, use name-based virtual host instead of IP virtual hosts (the apache equivalent of Host Headers in Windows/IIS). More info... http://httpd.apache.org/docs/2.0/vhosts/name-based.html


14

The windows hosts file supports only ip->name mappings, it does not support any other standard DNS record types. See here: http://technet.microsoft.com/en-us/library/bb727005.aspx#EDAA I would recommend running a simple dns server in order to do the redirect you are talking about. Try powerdns http://www.powerdns.com/


13

Why don't you install a local caching DNS server (e.g. bind) - configuring it is very simple. This way you only ever ask your local DNS server, and it asks (and caches) from your ISP's nameserver. You simply need to add in the forwarders directive to named.conf... forwarders { xxx.xxx.xxx.xxx; //. 1st DNS Server xxx.xxx.xxx.xxx; //. 2nd DNS Server }; ...


13

Your tld .local could be the problem, zeroconf uses this. There is no real standard, but the suggested tld for an internal tld is .site or .internal. See http://en.wikipedia.org/wiki/Top-level_domain#Pseudo-domains for this.


12

Hosts file on Linux/Unix: /etc/hosts ip.nu.mb.er name1 name2 Hosts file on Windows: %WINDOWS%\System32\Drivers\etc\hosts (e.g. C:\Windows\System32\Drivers\etc\hosts) ip.nu.mb.er name1 name2


12

I believe nslookup is used to test a DNS server itself, as opposed to utilizing your HOSTS file. http://support.microsoft.com/kb/200525 seems to indicate as much. Try just a simple ping. Does ping myMachine.MyDnsSuffix resolve to the loopback address you have specified in your HOSTS file?


12

The way to manage hosts file centrally is so important that it was solved long ago. It's called DNS. Once you get DNS working, you can set it up on several of your servers fairly quickly. Set each one to have another server as it's master, and have each server referencing several servers in /etc/resolv.conf. That way if one goes down, you don't have much ...


11

Simply changed: 127.0.0.1 localhost localhost.localdomain 127.0.0.1 foo.bar To this 127.0.0.1 localhost localhost.localdomain foo.bar Sendmail looks for a fully qualified domain (FQDN) name and will use the localhost.localdomain in the single line version.


10

With this configuration, most applications will happily work with your entry from /etc/hosts. However host doesn't look at /etc/nsswitch.conf. That is by design, not by accident, since host is specifically a DNS lookup program. /etc/hosts is not DNS, it's (mostly) what we used before we had DNS. The same is also true for dig and nslookup - they're DNS ...


10

DNS resolvers can be added in OS X via the networksetup command: sudo networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4 Insert name of network connection as appropriate. These resolvers will appear in resolv.conf as it is automatically generated, but direct edits to resolv.conf will not result in those resolvers being used. I assume the resolvers are ...


9

Change the ^HOSTNAME line in /etc/sysconfig/network Change the hostname (FQDN and alias) in /etc/hosts Run /bin/hostname new_hostname for the hostname change to take effect immediately. Run /sbin/service syslog restart for syslog to log using the new hostname. A reboot is not required to change the system hostname, of course you should reboot in order ...


9

The hosts file does not provide such mechanism. If you list two IPs for the same name, only the first one will be used. So, there is no such thing primary and secondary. Also, the hosts file does not handle URLs. It just handles names like the oncs provided in the question. A URL contains complete path and protocol such as http//host/path/to/resource.


8

A better solution would be to install Avahi and libnss-mdns, and then use HOSTNAME.local addresses. These names would not be per-user, but would solve your stated objective of having common names for all machines across a LAN.


8

DNS is the solution here. That's what it was set up to do.


8

/etc/sysconfig/network file is source from which the startup scripts take the arguments for 'hostname' command. And this should be just the machine name, not fully qualified. The domain part is usually defined in the /etc/resolv.conf file. Assuming the fully qualified host name is 'lemon.example.com' ('www' doesn't look like a good host name to me), then: ...


7

I found a reference to changing registry entries to alter the name resolution order on Windows: http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=963485 Quoting from there: By default, Windows checks name resolution providers in the following order: Local, (NetBT local name cache), Hosts, DNS, NetBT (WINS). You want the order to be ...


7

Neither the HOSTS file nor DNS have any type of service availability checking capability. They resolve DNS names to ip addresses. Furthermore, the HOSTS file works on a first come first served basis, meaning the first match is the one that's used and all others are ignored. So, neither DNS or the HOSTS file can do what you need. It's also generally assumed ...


6

Log into the godaddy.com portal and edit the domain you want to change the DNS settings for (You are looking for the domain Manager). In the host summary (bottom left) is where you need to add the entries to ns1 and ns2 along with their IP addresses. It'll then take a little bit for everything to replicate so that you can point other domains to those ...


6

cat /etc/hosts | ssh otherhost "sudo sh -c 'cat >/etc/hosts'" will do the trick.


6

The host command (along with dig and nslookup) is part of the bind DNS utilities. As a DNS resolver utility, it does DNS resolution alone. If you're interested in fetching an entry from any libnss-driven data store, you can use the getent program. To get a hosts entry, for example, use it like this: getent hosts google.com This follows follows the ...


6

Well, I'm not a microsoft insider, but here is my logic: %WINDIR% - All windows files are here system32 - these are for 32 bit system binaries drivers - well ... drivers etc\hosts - you need to understand that the Windows TCP/IP stack is an implementation of the BSD TCP/IP stack, in *nix systems the host file is at /etc/hosts This is my best guess as to ...


6

You are mistaken. The windows hosts file can not forward ports. It is a DNS lookup service only and will never do anything with ports, only map between host names and IP addresses.



Only top voted, non community-wiki answers of a minimum length are eligible