Find the answer to your Linux question:
Results 1 to 6 of 6
Hi all sorry for the silly question but i know very little about networking and i want to ask a simple question about hosts in Code: /etc/hosts file.I with 2 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Apr 2004
    Location
    Greece
    Posts
    187

    /etc/hosts question


    Hi all sorry for the silly question but i know very little about networking and i want to ask a simple question about hosts in
    Code:
    /etc/hosts
    file.I with 2 friends of mine are sharing an adsl connection(I ran gentoo one friend fedora and the other slackware and windows) with a dhcp modem and a network switch where we connect the modem and the 3 PCs of ours.So we have a dynamic ip which have the modem from our isp and then a subnet where we get 3 dynamics ips (Am i right?).I have setup samba in my pc and i share one directory.Then when i test to connect to the share throw my pc or one from my friends PCs i use the ip that ifconfind is showing for my eth0 device but i wonder if that ip change i will have to change it also from /etc/hosts and replace the old one with the new one?Is there a way to setup a hostname for my pc that will not be affected from my ip's change?Also can anyone point me a good site with tutorials for networking newbies?
    Q: what\'s tiny and yellow and very, very, dangerous?
    A: a canary with the super-user password.

  2. #2
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    The /etc/hosts file basically allows you to alias IPs. This is for ease of use/remembering. It's also useful if you don't want to worry about using BIND to do your own DNS in your private LAN. If your IP is dynamic, don't put that IP in /etc/hosts. It doesn't have any bearing unless you try to resolve your hostname.

    For additional info, check out 'man hosts'
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  3. #3
    Linux Newbie
    Join Date
    Apr 2004
    Location
    Greece
    Posts
    187
    Well and how can i then or my friends access my samba share without caring about the changes of mine ip?Is there any way?
    Q: what\'s tiny and yellow and very, very, dangerous?
    A: a canary with the super-user password.

  4. #4
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,127
    I believe you can configure one of your machines as a samba server in which case, it can function as a Domain Controller. In this case all servers will be controlled by this server, possibly with users authenticating to this server though this will depend on your configuration. The server would then be in a good position to act as a DNS server also.

  5. #5
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    Quote Originally Posted by paulmedic555
    Well and how can i then or my friends access my samba share without caring about the changes of mine ip?Is there any way?
    You could also use dyndns to get a DNS name for free. There are scripts to update your IP with their service, so you can throw one of these in your crontab and not have to worry about it.
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  6. #6
    Linux Newbie
    Join Date
    Jun 2005
    Posts
    181
    Why use a cronjob for it, mine just starts with the system and checks every half hour for an IP change :P

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •