Results 1 to 6 of 6

Thread: Hostname idea

  1. #1

    Hostname idea

    Hello all! I have a couple of ideas for something but I have NO IDEA how to even carry them out.

    1)Ok my LAN is using a router that uses dhcp to assign the local ip addresses. For my newly created "server" I would like to make some sort of script that assigns the current ip with a FQDN izan.athome. The only way I can think of to do somehting like this is to make a script that edits the /etc/hosts file. I was thinking that a command like this: ifconfig eth0 |grep "inet addr"
    will get me the address plus misc stuff. I just can't think of how to use regex to strip the address out, but that is how I figure you could get the ip address assigned to the laptop then append a line to the /etc/hosts file to something like:
    192.168.0.3 izan.athome izan

    or

    2)Can I just add a mask to the hosts file, something like:
    192.168.0.0/24 izan.athome izan
    or
    192.168.0.0-32 izan.athome izan

    Just curious, cuz I can't get to my laptop from my pc using the hostname in my browser(I'm running Apache w/PHP-MySQL support and SSH probably gonna have to use FTP at some point later on too... to get the files there) but I can finally get to it using the ip address.

  2. #2
    Senior Member
    Join Date
    May 2001
    Posts
    472

    Re:Hostname idea

    If you are using static private addresses, put the entry in /etc/hosts and in the hosts or lmhosts file (for a windows machine).

  3. #3
    Senior Member
    Join Date
    Apr 2002
    Posts
    417

    Re:Hostname idea

    Yea,

    why don't you just set your router to use static addresses? then you would add a name to hosts/lmhosts,ONCE, and be done /w it.

    Does your router support "port forwarding"? that way your any request going to your router (which has a real internet address) will get forwarded to your server. you wouldn't be able to use izan.athome address from outside your router though.

  4. #4
    Moderator
    Good Guru
    Schotty's Avatar
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,760

    Re:Hostname idea

    if you dont wanna just setup the port forwarding, you may be able to specifiy by MAC an IP in your DHCP server.

  5. #5

    Re:Hostname idea

    yeah I'm not sure if a can turn off DHCP, thats what I would do if I wanted static IPs right?

  6. #6
    Moderator
    Good Guru
    Schotty's Avatar
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,760

    Re:Hostname idea

    yeah.

    My dhcp server in my Netgear RT311 dsl.cable gateway unit has an option for that. Make sure that you set the dns, and default gateway to the hardware unit. So if you turn off dhcp and make it 192.168.0.254, your def gateway and dns servers would be that on each client.

Similar Threads

  1. hostname to IP
    By datamike in forum Linux - General Topics
    Replies: 9
    Last Post: 02-15-2013, 12:21 PM
  2. DHCP and Hostname help
    By mcdougrs in forum Linux - Hardware, Networking & Security
    Replies: 3
    Last Post: 11-07-2002, 10:00 AM
  3. hostname of a pc
    By kemu in forum Linux - Hardware, Networking & Security
    Replies: 3
    Last Post: 10-02-2002, 11:56 PM
  4. hostname in iptables?
    By tolstoy in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 01-17-2002, 10:02 PM
  5. Hostname
    By Schotty in forum Linux - Hardware, Networking & Security
    Replies: 10
    Last Post: 12-05-2001, 02:34 PM

Bookmarks

Posting Permissions

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