Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd, 2017 please sign up again. Thanks!

Store IP adress in database

Discussion in 'Database' started by Bugzilla, Jun 3, 2015.

  1. Bugzilla

    Bugzilla Guest

    Hello everyone,

    I have a quick question about Linux databases.


    (Log in to hide this advertisement)


    So I have many servers called “TestServer1” – “TestServer99”.

    I want to store the server IP adresses in an extra database (“Database1”) with a script.

    So question 1: How can I display the IP addresses of
    1.1 one specific server (e.g. TestServer12)
    1.2 of all servers in the command line?

    Question 2: How can I store the IP addresses of these servers automatically in a database (preferably with a script) ?

    Any help is appreciated. Thank you. :)
     
  2. VitalkaDrug

    VitalkaDrug Guest

    It depends from an used database and an used script language.
    You didn't specify neither the first nor the second.
    Some databases have support for specialized data types to store IP addresses.
    In others you have to prepare data (conversion to int) or can just use character fields.
    The final decision depends from your goal (just store or fast seek).

    Do you really need a DBMS?
    An ordinary DNS server is a special database server which used to store names and of corresponding IP-addresses.
    Why do you not use a DNS?
     
  3. Bugzilla

    Bugzilla Guest

    And how can I do it with a DNS?
     
  4. VitalkaDrug

    VitalkaDrug Guest

    Could you clarify what do you intend to do exactly?

    To resolve DNS names (to search in a DNS database in other words) you can use host, nslookup or dig utilities (http://unix.stackexchange.com/quest...-a-hostname-to-an-ip-address-in-a-bash-script).

    In case of using of Bind as a DNS server a zone file is a simple text file in specific format.
    To update it you can use sed for example.
     
  5. Bugzilla

    Bugzilla Guest

    Ok, thank you very much :)
    I think I solved it now.
     

Share This Page