SlideShare une entreprise Scribd logo
1  sur  54
Building a Linux IPv6 DNS Server


                             /*Loading .sh (Shell Script) */
putChar()
{
i=1
while [ $i -le $3 ]
do
    echo -n quot;$1quot;
    sleep $2
    i=`expr $i + 1`
done
}


    clear
    echo
    putChar _ 0 80
    echo -e quot;nquot;
    echo quot; !!! Loading System Detailsquot;
    echo -ne quot;nttit may take few seconds quot;
    sleep 1
    putChar '.' 0.25 20
    putChar '.' 0 20
    putChar _ 0 80
    sleep 1


    echo -ne quot;nnnt--> Checking system details quot;
    putChar '.' 0.5 8
    echo -e quot;nntt-- Machine (hardware) type   : `uname -m`quot;

                                      Page 54
Building a Linux IPv6 DNS Server
 sleep 2
 echo -e quot;tt-- Machine's network hostname : `uname -n`quot;
 sleep 1
 echo -e quot;tt-- Operating system release        : `uname -r`quot;
 sleep 0.5
 echo -e quot;tt-- Operating system name           : `uname -s`quot;
 sleep 0.5
 echo -e quot;tt-- Host processor type        : `uname -p`quot;
 sleep 0.25
 echo -e quot;tt-- Operating system version        : `uname -v`quot;


 sleep 1
 echo -ne quot;nnt--> Checking for root user privilege quot;
 putChar '.' 0.5 6
 sleep 1
 if [ quot;`whoami`quot; != quot;rootquot; ]
 then
  echo -e quot;nntt-- Sorry this software has to be run by root user....nnquot;
  sleep 2
  echo -e quot;nttAborting.......quot;;
  sleep 5
  exit
 else
  sh run.sh
  echo -e quot;nntt-- found root user privileges !quot;
  sleep 1
  echo -ne quot;nntttttttt   quot;
  putChar '->' 0.25 5

                                       Page 55
Building a Linux IPv6 DNS Server
  sleep 1
  echo -e quot;nquot;
 fi


                              /* Builder.c [C source File] */


#include <unistd.h>
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <sys/stat.h>
#include <stdlib.h>
void printChar(char c, int count) {
 int i;
 for(i=0; i<count; i++)
  printf(quot;%cquot;, c);
 printf(quot;nquot;);
} // end printChar


 void bu()
          {
  system(quot;sh built.shquot;);
      }
void Builder() {
 char ans, dirName[260];
 char dir,command[260];
 FILE *fp = fopen(quot;SourceDirquot;, quot;rquot;);
 fscanf(fp, quot;%squot;, dirName);

                                       Page 56
Building a Linux IPv6 DNS Server
 fclose(fp);
 printf(quot;Enter the Dir. Name Default is '%s' is it o.k (y/n): quot;, dirName);
 scanf(quot; %cquot;, &dir);
 if(dir == 'y') {
  printf(quot;Ensure that U have copied the source files..quot;);
  printf(quot;Shall I Proceed...(y/n): quot;);
  scanf(quot; %cquot;, &ans);
  if(ans == 'y') {
      chdir(dirName);
 //     system(quot;cp -rf /usr/src/linux-2.4.21-4.EL/arch/i386/defconfig /usr/src/linux-
2.4.21-4.EL/arch/i386/defconfig.orgquot;);
      printChar('/',79);
      printChar('/',79);
      printf(quot;nquot;);
      printf(quot;Press Any key to proceed with cleaning...quot;);
      getchar();
      getchar();
      printChar('/',79);
      printChar('/',79);
      system(quot;sleep 40quot;);
      printf(quot;nquot;);
      printf(quot;Press Any key to proceed with kernel image creation...quot;);
      getchar();
      /* system(quot;make bzImage &> /dev/zeroquot;);*/
      bu();
      system(quot;sleep 60quot;);
      printChar('*', 79);
      printChar('*', 79);

                                      Page 57
Building a Linux IPv6 DNS Server
   printChar('*', 79);
   //strcpy(command,quot;cp /Project/ntfssupportedkernel arch/i386/boot/bzImagequot;);
   //system(command);
      printf(quot;nProcess Completed Successfully!!!nnquot;);
  }
 } else {
  printf(quot;Enter the directory Name: quot;);
  scanf(quot;%squot;, dirName);
  printf(quot;Ensure that U have copied the source files..quot;);
  printf(quot;Shall I Proceed...(y/n): quot;);
  scanf(quot; %cquot;, &ans);
  printf(quot;ans is %cnquot;, ans);
  if(ans == 'y') {
      chdir(dirName);
      system(quot;make dep &> /dev/zeroquot;);
   // system(quot;make dep | tee .o; ./.squot;);
      printChar('/',79);
      printChar('/',79);
      printf(quot;nquot;);
      printf(quot;Press Any key to proceed with cleaning...quot;);
      getchar();
      getchar();
      system(quot;sleep 60quot;);
      printChar('/',79);
      printChar('/',79);
      printf(quot;nquot;);
      printf(quot;Press Any key to proceed with kernel image creation...quot;);
      getchar();

                                     Page 58
Building a Linux IPv6 DNS Server
      printChar('/',79);
      printChar('/',79);
      printf(quot;nquot;);
      //system(quot;sleep 60quot;);
      printChar('*', 79);
      system(command);
      printChar('*', 79);
      printf(quot;Process Completed Successfully!!!nnquot;);
     }
 }
} // end Builder
int main() {
 Builder();
} // end main

/* Dir Handler.c [C source File] */
#include <unistd.h>
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <sys/stat.h>
#include <stdlib.h>
void PrintDir(char *dirName, int depth) {
 DIR *dp;
 struct dirent *entry;
 struct stat statbuf;
     if((dp = opendir(dirName)) == NULL) {
     fprintf(stderr, quot;Cann't open Directory: %snquot;, dirName);
     return;

                                      Page 59
Building a Linux IPv6 DNS Server
 }
     chdir(dirName);
     while((entry = readdir(dp)) != NULL) {
     lstat(entry->d_name, &statbuf);
     if(S_ISDIR(statbuf.st_mode)) {
      /* ignore . and .. */
  if(strcmp(quot;.quot;, entry->d_name) == 0 || strcmp(quot;..quot;, entry->d_name)==0)
       continue;
      printf(quot;%s/nquot;, entry->d_name);
     } // end if
 } // end while
} // end PrintDir
void DirHandler() {
 FILE *fp = fopen(quot;SourceDirquot;, quot;wquot;);
 char dirName[81];
 char command[200];
 char cmd[250];
 char srcName[260], destName[260];
 char pro;
 char defDir[] = quot;/usr/src/quot;;
 char srcRel[50], destRel[50];
 printf(quot;Enter the Dir To be scanned: quot;);
 scanf(quot;%squot;, dirName);
 PrintDir(dirName, 0);
 printf(quot;nn... That's all folks...nquot;);
 printf(quot;The default dir is '%s' Shall I proceed? (y/n): quot;, defDir);
 scanf(quot; %cquot;, &pro);
 if(pro == 'n') {

                                       Page 60
Building a Linux IPv6 DNS Server
  printf(quot;Enter the Directory U want to be backed up: quot;);
  scanf(quot;%squot;, srcName);
  printf(quot;Now Enter the Directory name U want the sources to be in: quot;);
  scanf(quot;%squot;, destName);
  command[0]='0';
  strcat(command, quot;cp -r quot;);
  strcat(command, srcName);
  strcat(command, quot; quot;);
  strcat(command, destName);
  cmd[0] = '0';
  strcat(cmd, command);
  printf(quot;n Command %squot;,cmd);
  printf(quot;nPress any key to go ahead with backup....quot;);
  printf(quot;This process may take several minutes... pls. wait....quot;);
  /* getchar();
  getchar();
  printf(quot;n Command %s quot;, command);*/
  getchar();
  system(command);
  printf(quot;nProcess Completed Successfully!!!nnquot;);
 } else {
  printf(quot;Enter the Directory U want to be backed up: quot;);
  scanf(quot;%squot;, srcRel);
  srcName[0]='0';
  strcpy(srcName, defDir);
  strcat(srcName, srcRel);
  printf(quot;Now Enter the Directory name U want the sources to be in: quot;);
  scanf(quot;%squot;, destRel);

                                    Page 61
Building a Linux IPv6 DNS Server
        strcpy(destName, defDir);
        strcat(destName, destRel);
        command[0]='0';


        strcat(command, quot;cp -r quot;);
        strcat(command, srcName);
        strcat(command, quot; quot;);
        strcat(command, destName);
        printf(quot;nPress any key to go ahead with backup....quot;);
        printf(quot;This process may take several minutes... pls. wait....quot;);
        getchar();
        getchar();
        system(command);
        printf(quot;nProcess Completed Successfully!!!nnquot;);
    }
    fprintf(fp, quot;%squot;, destName);
    fclose(fp);
    } // end DirHandler


int main() {
    DirHandler();
}

                           /* MemberAdderGUI (Server Side) */


import java.net.*;
import java.awt.*;
import java.util.*;
import javax.swing.*;

                                          Page 62
Building a Linux IPv6 DNS Server
import java.awt.event.*;


public class MemberAdderGUI extends JFrame
{
    ServerSocket serverSocket;
    int DEFAULT_PORT=111;
    int port;
    Vector membersList;
    JFrame frame;
    TextField tfStatus;
    Container c;
    JPanel pnlPortInfo;
    JTextField jtfPort;
    JButton btnAction;
    java.awt.List lstMembers;
    String strBtnCaption = quot;quot;;
    Thread memberAdder;


public MemberAdderGUI(String title)
{
     super(title);
     membersList = new Vector();
     frame = this;
     c = getContentPane();
     strBtnCaption = quot;Startquot;;
     pnlPortInfo = new JPanel();
     pnlPortInfo.setLayout(new BorderLayout());
     pnlPortInfo.add(quot;Westquot;, new JLabel(quot;Port: quot;));

                                    Page 63
Building a Linux IPv6 DNS Server
     pnlPortInfo.add(quot;Centerquot;, jtfPort = new JTextField(7));
     pnlPortInfo.add(quot;Eastquot;, btnAction = new JButton(strBtnCaption));
     btnAction.addActionListener(new Axn());
     c.add(quot;Northquot;, pnlPortInfo);
     c.add(quot;Centerquot;, lstMembers = new java.awt.List(7));
     c.add(quot;Southquot;, tfStatus = new TextField());
     setDefaultCloseOperation(DISPOSE_ON_CLOSE);
     setSize(300, 300);
     setLocation(70, 70);
     setVisible(true);
 }


 public MemberAdderGUI(int port)
{
     this.port = port;
     membersList = new Vector();
 }
class MemberAdder implements Runnable
{
    public void run()
 {
     try
     {
         serverSocket = new ServerSocket(port);
         System.out.println(quot;Member Adder started and waiting...at 'quot; + port + quot;'..!!quot;);
         Socket clientSocket = null;


         while(true)

                                         Page 64
Building a Linux IPv6 DNS Server
         {
             clientSocket = serverSocket.accept();
             System.out.println(quot;Connected to machine: quot; + clientSocket);
             String ipAddress = clientSocket.getInetAddress().getHostAddress();
             clientSocket.close();
             addMember(ipAddress);
             printMembers();
         }
     }
     catch(Exception e)
     {
     }
    } // end run
 } // end MemberAdder
 public void addMember(String ipAddress)
{
     if(!membersList.contains(ipAddress))
    {
         membersList.add(ipAddress);
         lstMembers.add(ipAddress);
         tfStatus.setText(quot;Added 'quot; + ipAddress + quot;' Successfully!!quot;);
     }
    else
 {
         System.out.println(quot;quot;quot; + ipAddress + quot;quot; has been added already!!!quot;);
         tfStatus.setText(quot;quot;quot; + ipAddress + quot;quot; has been added already!!!quot;);
     }
 }

                                           Page 65
Building a Linux IPv6 DNS Server
 public void printMembers()
 {
     System.out.println(quot;nnList of Available members is..nquot;);
     Enumeration list = membersList.elements();
     while(list.hasMoreElements())
     {
         System.out.println((String)list.nextElement());
     }
     System.out.println(quot;-----------------------that's all-----------------------quot;);
 }


 class Axn implements ActionListener
 {
     public void actionPerformed(ActionEvent ae)
     {
         String strCommand = ae.getActionCommand();
         try
         {
             if(strCommand.equals(quot;Startquot;))
             {
                 strBtnCaption = quot;Stopquot;;
                 btnAction.setText(strBtnCaption);
                 if(jtfPort.getText().equals(quot;quot;))
                 {
                     port = DEFAULT_PORT;
                 }


             else

                                               Page 66
Building a Linux IPv6 DNS Server
        {
            port = Integer.parseInt(jtfPort.getText());
        }
        if(memberAdder == null)
        {
            memberAdder = new Thread(new MemberAdder());
            memberAdder.start();
        }
        else
        {
            memberAdder = null;
            System.gc();
        }
    }


    else if(strCommand.equals(quot;Stopquot;))
    {
        strBtnCaption = quot;Startquot;;
        btnAction.setText(strBtnCaption);
        serverSocket.close();
        serverSocket = null;
        System.gc();
    }
   }
   catch(Exception e)
   {
       System.out.println(quot;MemberAdderGUI: Axn: quot; + e);
   } // end try-catch

                                         Page 67
Building a Linux IPv6 DNS Server
        } // end action
    } // end Axn


public static void main(String [] args)
{
        new MemberAdderGUI(quot;Member Listquot;);
    }
} // end MemberAdderGUI


                           /* AddMeAsMemberGUI (Client Side)*/


import java.io.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class AddMeAsMemberGUI extends JFrame
{
            String host;
            int port;
            JTextField jtfHost, jtfPort;
            JPanel pnlHostInfo, pnl1, pnl2, pnlActions;
            JFrame frame;
            Container c;
            JButton btnRegister, btnClose;
            public AddMeAsMemberGUI(String title)
            {

                                           Page 68
Building a Linux IPv6 DNS Server
               c = getContentPane();
               setTitle(title);
               frame = this;
               pnlHostInfo = new JPanel();
               pnlHostInfo.setLayout(new BorderLayout());
               pnl1 = new JPanel();
               pnl1.setLayout(new GridLayout(2, 1));
               pnl1.add(jtfHost = new JTextField(15));
               pnl1.add(jtfPort = new JTextField(15));
               pnl2 = new JPanel();
               pnl2.setLayout(new GridLayout(2, 1));
               pnl2.add(new JLabel(quot;Host: quot;));
               pnl2.add(new JLabel(quot;Port: quot;));
               pnlActions = new JPanel();
               pnlActions.setLayout(new GridLayout(1, 2));
               pnlActions.add(btnRegister = new JButton(quot;Registerquot;));
               btnRegister.addActionListener(new Axn());
               pnlActions.add(btnClose = new JButton(quot;Closequot;));
               btnClose.addActionListener(new Axn());
               pnlHostInfo.add(quot;Centerquot;, pnl1);
               pnlHostInfo.add(quot;Westquot;, pnl2);
               pnlHostInfo.add(quot;Southquot;, pnlActions);
               c.add(quot;Centerquot;, pnlHostInfo);
               setDefaultCloseOperation(DISPOSE_ON_CLOSE);
               setSize(200, 110);
               setLocation(80, 80);
               setVisible(true);
         } // end cons

                                       Page 69
Building a Linux IPv6 DNS Server


 class AddMe implements Runnable
 {
             public void run() {
             try
         {
                        Socket clientSocket = new Socket(host, port);
             }
         catch(Exception e)
         {
                        System.out.println(quot;AddMe: Axn: quot; + e);
         }
     } // end run
 } // end AddMe


 public class Axn implements ActionListener
 {
             public void actionPerformed(ActionEvent ae)
             {
                   String strCmd = ae.getActionCommand();
                   if(strCmd.equals(quot;Registerquot;))
                   {
                          host = jtfHost.getText();
                          port = Integer.parseInt(jtfPort.getText());
                          new Thread(new AddMe()).start();
                    }
                       else if(strCmd.equals(quot;Closequot;))
                    {

                                            Page 70
Building a Linux IPv6 DNS Server
                       frame.dispose();
                   }
          }
        } // end Axn


    public static void main(String [] args)
    {
          new AddMeAsMemberGUI(quot;Add Me As MEMBERquot;);
    }
} // end AddMeAsMemberGUI


                          /* LookUp Server GUI (Server Side) */


import java.io.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class LookUpServerGUI extends JFrame
{
    ServerSocket serverSok;
    JButton btnStart, btnStop;
    JTextField jtfPort;
    JPanel pnlActions, pnlPortInfo;
    boolean stopServer;
    Thread lookupSvr;
    Container c;

                                          Page 71
Building a Linux IPv6 DNS Server


 public LookUpServerGUI(String title)
 {
     super(title);
     c = getContentPane();
     pnlPortInfo = new JPanel();
     pnlPortInfo.setLayout(new GridLayout(1, 2));
     pnlPortInfo.add(new JLabel(quot;Port: quot;));
     pnlPortInfo.add(jtfPort = new JTextField(4));
     pnlActions = new JPanel();
     pnlActions.setLayout(new GridLayout(2, 1));
     pnlActions.add(btnStart = new JButton(quot;Startquot;));
     pnlActions.add(btnStop = new JButton(quot;Stopquot;));
     btnStart.addActionListener(new Axn());
     btnStop.addActionListener(new Axn());
     c.add(quot;Northquot;, pnlPortInfo);
     c.add(quot;Centerquot;, pnlActions);
     setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
     setSize(100, 100);
     setLocation(70, 70);
     setVisible(true);
 } // end cons


 class LookupServer implements Runnable
{
     public void run()
     {
         try

                                     Page 72
Building a Linux IPv6 DNS Server
       {
               int port;
            stopServer = false;
            String strPort = jtfPort.getText();
            if(!strPort.equals(quot;quot;))
           {
                port = Integer.parseInt(strPort);
            }
           else
           {
                port = 1234;
           }


    If (serverSok == null)
   {
           serverSok = new ServerSocket(port);
    }
    else
    {
        ; // do NOTHING
    }
    while(stopServer == false)
    {
        System.out.println(quot;Waiting....at 'quot; + port + quot;'quot;);
        Socket clientSok = serverSok.accept();
        System.out.println(quot;Connected to: quot; + clientSok);
        PrintWriter toClient = new PrintWriter(clientSok.getOutputStream(), true);
        toClient.println(quot;Activequot;);

                                           Page 73
Building a Linux IPv6 DNS Server
            toClient.flush();
            clientSok.close();
         } // end while
        }
        catch(Exception e)
     {
            System.out.println(quot;LookupServer: quot; + e);
     }
    } // end run
}


    public class Axn implements ActionListener
{
     public void actionPerformed(ActionEvent ae)
    {
         String strCmd = ae.getActionCommand();
         try
        {
            if(strCmd.equals(quot;Startquot;))
            {
                if(lookupSvr == null)
                {
                    lookupSvr = new Thread(new LookupServer());
                    lookupSvr.start();
                }
                else
                {
                    System.out.println(quot;Already Running!!!!quot;);

                                              Page 74
Building a Linux IPv6 DNS Server
             }
         }


         else if(strCmd.equals(quot;Stopquot;))
        {
             stopServer = true;
             serverSok.close();
             serverSok = null;
             lookupSvr = null;
             System.gc();
             System.out.println(quot;Stopped!!quot;);
         } // end if
     }
     catch(Exception e)
    {
         System.out.println(e);
     } // end try-catch
    } // end action
 } // end Axn


 public static void main(String [] args)
{
    new LookUpServerGUI(quot;Lookup Serverquot;);
}
} // end LookUpServerGUI


                                   /* LookUpClientGUI */



                                         Page 75
Building a Linux IPv6 DNS Server
import java.io.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class LookUpClientGUI extends JFrame
{
    String host;
    int port;
    JTextField jtfHost, jtfPort;
    JPanel pnlHostInfo, pnl1, pnlActions;
    JFrame frame;
    Container c;
    TextField tfStatus;
    JButton btnLookup, btnClose;


    public LookUpClientGUI(String title)
    {
        c = getContentPane();
        setTitle(title);
        frame = this;
        pnlHostInfo = new JPanel();
        pnlHostInfo.setLayout(new BorderLayout());
        pnl1 = new JPanel();
        pnl1.setLayout(new GridLayout(2, 2));
        pnl1.add(new JLabel(quot;Host: quot;));
        pnl1.add(jtfHost = new JTextField(15));

                                          Page 76
Building a Linux IPv6 DNS Server
     pnl1.add(new JLabel(quot;Port: quot;));
     pnl1.add(jtfPort = new JTextField(15));


     pnlActions = new JPanel();
     pnlActions.setLayout(new GridLayout(1, 2));
     pnlActions.add(btnLookup = new JButton(quot;Lookupquot;));
     btnLookup.addActionListener(new Axn());
     pnlActions.add(btnClose = new JButton(quot;Closequot;));
     btnClose.addActionListener(new Axn());
     pnlHostInfo.add(quot;Centerquot;, pnl1);
     pnlHostInfo.add(quot;Southquot;, pnlActions);
     c.add(quot;Centerquot;, pnlHostInfo);
     c.add(quot;Southquot;, tfStatus = new TextField());
     setDefaultCloseOperation(DISPOSE_ON_CLOSE);
     setSize(200, 135);
     setLocation(70, 70);
     setVisible(true);
 } // end cons


 public class Axn implements ActionListener
 {
     public void actionPerformed(ActionEvent ae)
     {
         String strCmd = ae.getActionCommand();
         if(strCmd.equals(quot;Lookupquot;))
         {
             host = jtfHost.getText();
             port = Integer.parseInt(jtfPort.getText());

                                           Page 77
Building a Linux IPv6 DNS Server
              new Thread(new LookupClient()).start();
          }
          else if(strCmd.equals(quot;Closequot;))
          {
               frame.dispose();
           }
  }
 } // end Axn
  public void run()
  {
      try
      {
           Socket clientSok = new Socket(host, port);
           BufferedReader fromServer = new BufferedReader(new
                              InputStreamReader(clientSok.getInputStream()));
           String answer = fromServer.readLine();
           if(answer.equals(quot;Activequot;))
          {
           System.out.println(quot;The Server is active...quot;);
           tfStatus.setText(quot;The Server is ACTIVE...quot;);
          }
  }
  catch(Exception e)
  {
          System.out.println(quot;Exception has come the server seems to be NOT
ACTIVE..quot;);
          tfStatus.setText(quot;server seems to be NOT ACTIVE..quot;);
  } // end try-catch

                                         Page 78
Building a Linux IPv6 DNS Server
    } // end run
    } // end LookupClient


public static void main(String [] args)
    {
        new LookUpClientGUI(quot;Lookup Clientquot;);
    }
} // end LookUpClientGUI


                                   /* DNSmain (Server Side) */


import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class DNSmain extends JFrame
{
               JMenuBar mbar;
               JMenu mnuDNS, mnuHelp;
               JMenuItem jmi;
               JFrame frame;
               Container c;
               JDesktopPane jdp;


           public DNSmain(String title)
           {
                              super(title);
                              frame = this;

                                              Page 79
Building a Linux IPv6 DNS Server
                         c = getContentPane();
                         jdp = new JDesktopPane();
                         c.add(jdp);
                         mbar = new JMenuBar();
                         mnuDNS = new JMenu(quot;DNSquot;);
                         jmi = new JMenuItem(quot;Control Panelquot;, 'C');
                         jmi.setAccelerator(KeyStroke.getKeyStroke('C',
                         java.awt.event.InputEvent.ALT_MASK));
                         jmi.addActionListener(new Axn());
                         mnuDNS.add(jmi);
                         mnuDNS.addSeparator();
                         jmi = new JMenuItem(quot;IPv6 Addressquot;, 'I');
                         jmi.setAccelerator(KeyStroke.getKeyStroke('I',
                         java.awt.event.InputEvent.ALT_MASK));
                         jmi.addActionListener(new Axn());
                         mnuDNS.add(jmi);
                         jmi = new JMenuItem(quot;IPv4 Addressquot;, 'A');
                         jmi.setAccelerator(KeyStroke.getKeyStroke('A',
                         java.awt.event.InputEvent.ALT_MASK));
                         jmi.addActionListener(new Axn());
                         mnuDNS.add(jmi);
                         mnuDNS.addSeparator();
                         jmi = new JMenuItem(quot;Exitquot;, 'X');
                         jmi.setAccelerator(KeyStroke.getKeyStroke('X',
                         java.awt.event.InputEvent.ALT_MASK));
                         jmi.addActionListener(new Axn());
                         mnuDNS.add(jmi);
                         mnuHelp = new JMenu(quot;Helpquot;);

                                       Page 80
Building a Linux IPv6 DNS Server
                           jmi = new JMenuItem(quot;Contentsquot;, 'C');
                           jmi.setAccelerator(KeyStroke.getKeyStroke('C',
                           java.awt.event.InputEvent.ALT_MASK));
                           jmi.addActionListener(new Axn());
                           mnuHelp.add(jmi);
                           jmi = new JMenuItem(quot;Search...quot;, 'S');
                           jmi.setAccelerator(KeyStroke.getKeyStroke('S',
                           java.awt.event.InputEvent.ALT_MASK));
                           jmi.addActionListener(new Axn());
                           mnuHelp.add(jmi);
                            mnuHelp.addSeparator();
                            jmi = new JMenuItem(quot;Aboutquot;, 'A');
                            jmi.setAccelerator(KeyStroke.getKeyStroke('A',
                            java.awt.event.InputEvent.ALT_MASK));
                            jmi.addActionListener(new Axn());
                            mnuHelp.add(jmi);
                            mbar.add(mnuDNS);
                            mbar.add(mnuHelp);
                            setJMenuBar(mbar);
                            setDefaultCloseOperation(0);
                            addWindowListener(new WinLstner());
                            setLocation(50, 50);
                            setSize(600, 500);
                            setVisible(true);
       } // end cons


 class Axn implements ActionListener
{

                                        Page 81
Building a Linux IPv6 DNS Server
  public void actionPerformed(ActionEvent ae)
  {
      String cmdString = ae.getActionCommand();
      if(cmdString.equals(quot;Exitquot;))
   {
          int result = JOptionPane.showConfirmDialog(frame, quot;Do you Really want
to quit?quot;,
                      quot;Quitting?quot;, JOptionPane.YES_NO_CANCEL_OPTION,
                      JOptionPane.QUESTION_MESSAGE);
          if(result == JOptionPane.YES_OPTION)
                frame.dispose();
      }
   else if(cmdString.equals(quot;Control Panelquot;))
   {
            JInternalFrame jif = new DNSpanelIF(quot;DNS panelquot;);
           jdp.add(jif);
      }
   else if(cmdString.equals(quot;IPv6 Addressquot;))
   {
           JInternalFrame jif = new Ipv6RecordAdderIF(quot;IPv6 DNS Recordsquot;);
          jdp.add(jif);
      }
      else if(cmdString.equals(quot;IPv4 Addressquot;))
      {
           JInternalFrame jif = new Ipv4RecordAdderIF(quot;IPv4 DNS Recordsquot;);
          jdp.add(jif);
      }
  } // end action

                                     Page 82
Building a Linux IPv6 DNS Server
    } // end Axn


    class WinLstner extends WindowAdapter
{
         public void windowClosing(WindowEvent we)
     {
           int result = JOptionPane.showConfirmDialog(frame, quot;Do you Really want
to quit?quot;,
                      quot;Quitting?quot;, JOptionPane.YES_NO_CANCEL_OPTION,
                      JOptionPane.QUESTION_MESSAGE);
           if(result == JOptionPane.YES_OPTION)
                       frame.dispose();
     }
    } // end WinLstner


    public static void main(String [] args)
{
     new DNSmain(quot;IPv6 ready DNSquot;);
} // end main
} // end DNSmain


                                     /* DNShandler */


import java.io.*;
public class DNShandler
{
            public void startDNS()
                {

                                        Page 83
Building a Linux IPv6 DNS Server
                   try
                         {
                               Runtime r = Runtime.getRuntime();
                               Process p = r.exec(quot;service named startquot;);
                               BufferedReader br = new BufferedReader(new
                                     InputStreamReader(p.getInputStream()));
                               String line = quot;quot;;
                               while((line = br.readLine()) != null)
                                   System.out.println(line);
                         }
                         catch(Exception e)
                         {
                               System.out.println(quot;startDNS:: quot; + e);
                         }
               }


         public void stopDNS()
         {
               try
                         {
                               Runtime r = Runtime.getRuntime();
                               Process p = r.exec(quot;service named stopquot;);
                               BufferedReader br = new BufferedReader(new
                                     InputStreamReader(p.getInputStream()));
                               String line = quot;quot;;
                               while((line = br.readLine()) != null)
                                          System.out.println(line);
                         }

                                        Page 84
Building a Linux IPv6 DNS Server
                         catch(Exception e)
                         {
                               System.out.println(quot;stopDNS:: quot; + e);
                         }
       }


           public void reloadDNS()
           {
                   try
                         {
                               Runtime r = Runtime.getRuntime();
                               Process p = r.exec(quot;service named reloadquot;);
                               BufferedReader br = new BufferedReader(new
                                     InputStreamReader(p.getInputStream()));
                               String line = quot;quot;;
                               while((line = br.readLine()) != null)
                                           System.out.println(line);
                         }
                         catch(Exception e)
                         {
                               System.out.println(quot;reloadDNS:: quot; + e);
                         }
       }



public static void main(String [] args)
{
               new DNShandler().reloadDNS();

                                         Page 85
Building a Linux IPv6 DNS Server
    } // end main
} // end DNShandler


                              /* DNS Panel (Server side) */


import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class DNSpanel extends JFrame
{
    JPanel pnlActions;
    JButton btnStart, btnStop, btnRestart, btnClose;
    JFrame frame;
    Container c;
    public DNSpanel(String title)
    {
        super(title);
        c = getContentPane();
        frame = this;
        pnlActions = new JPanel();
        pnlActions.setLayout(new GridLayout(2, 2));
        pnlActions.add(btnStart = new JButton(quot;Startquot;));
        pnlActions.add(btnStop = new JButton(quot;Stopquot;));
        pnlActions.add(btnRestart = new JButton(quot;Restartquot;));
        pnlActions.add(btnClose = new JButton(quot;Closequot;));
        btnStart.addActionListener(new Axn());
        btnStop.addActionListener(new Axn());

                                       Page 86
Building a Linux IPv6 DNS Server
    btnRestart.addActionListener(new Axn());
    btnClose.addActionListener(new Axn());
    c.add(pnlActions);
    setLocation(70, 70);
    setSize(200, 100);
    setVisible(true);
 } // end DNspanel


 class Axn implements ActionListener
{
     public void actionPerformed(ActionEvent ae)
    {
        String strCommand = ae.getActionCommand();
        if(strCommand.equals(quot;Startquot;))
        {
                new DNShandler().startDNS();
        }
        else if(strCommand.equals(quot;Stopquot;))
        {
                new DNShandler().stopDNS();
            }
            else if(strCommand.equals(quot;Restartquot;))
            {
                 new DNShandler().reloadDNS();
            }
            else if(strCommand.equals(quot;Closequot;))
            {
                  frame.dispose();

                                       Page 87
Building a Linux IPv6 DNS Server
              }
        } // end action
    } // end Axn


    public static void main(String [] args)
    {
         new DNSpanel(quot;DNS panelquot;);
    } // end main
} // end DNSpanel


                          /* DNS panel IF (Internal Frame) */


import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class DNSpanelIF extends JInternalFrame
{
    JPanel pnlActions;
    JButton btnStart, btnStop, btnRestart, btnClose;
    JInternalFrame frame;
    Container c;
    public DNSpanelIF(String title)
    {
         super(title);
         c = getContentPane();
         frame = this;
         pnlActions = new JPanel();

                                       Page 88
Building a Linux IPv6 DNS Server
     pnlActions.setLayout(new GridLayout(2, 2));
     pnlActions.add(btnStart = new JButton(quot;Startquot;));
     pnlActions.add(btnStop = new JButton(quot;Stopquot;));
     pnlActions.add(btnRestart = new JButton(quot;Restartquot;));
     pnlActions.add(btnClose = new JButton(quot;Closequot;));
     btnStart.addActionListener(new Axn());
     btnStop.addActionListener(new Axn());
     btnRestart.addActionListener(new Axn());
     btnClose.addActionListener(new Axn());
     c.add(pnlActions);
     setClosable(true);
     setResizable(true);
     setMaximizable(true);
     setIconifiable(true);
     setLocation(70, 70);
     setSize(200, 100);
     setVisible(true);
 } // end DNspanel


 class Axn implements ActionListener
 {
      public void actionPerformed(ActionEvent ae)
     {
         String strCommand = ae.getActionCommand();
         if(strCommand.equals(quot;Startquot;))
         {
             new DNShandler().startDNS();
         }

                                   Page 89
Building a Linux IPv6 DNS Server
         else if(strCommand.equals(quot;Stopquot;))
         {
                 new DNShandler().stopDNS();
         }
             else if(strCommand.equals(quot;Restartquot;))
         {
                 new DNShandler().reloadDNS();
             }
       else if(strCommand.equals(quot;Closequot;))
         {
                 frame.dispose();
             }
    } // end action
 } // end Axn


 public static void main(String [] args)
{
      new DNSpanelIF(quot;DNS panelquot;);
 } // end main
} // end DNSpanelIF


                                    /* Ipv4RecordAdder */


import java.io.*;
import java.net.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

                                         Page 90
Building a Linux IPv6 DNS Server


public class Ipv4RecordAdder extends JFrame
{
    String zoneFileName;
    String dnsDirectory = quot;/var/named/quot;; // DEFAULT DIRECTORY
    JTextField jtfDomainName, jtfHostName, jtfAddress;
    JButton btnAdd, btnClose;
    JPanel pnlActions, pnlCenter;
    JFrame frame;
    Container c;
    public Ipv4RecordAdder(String title)
{
     super(title);
     frame = this;
     c = getContentPane();
     pnlCenter = new JPanel();
     pnlCenter.setLayout(new GridLayout(3, 2));
     pnlCenter.add(new JLabel(quot;Domain Name : quot;));
     pnlCenter.add(jtfDomainName = new JTextField());
     pnlCenter.add(new JLabel(quot;Host Name : quot;));
     pnlCenter.add(jtfHostName = new JTextField());
     pnlCenter.add(new JLabel(quot;IPv4 Address: quot;));
     pnlCenter.add(jtfAddress = new JTextField());
     pnlActions = new JPanel();
     pnlActions.setLayout(new GridLayout(1, 2));
     pnlActions.add(btnAdd = new JButton(quot;Addquot;));
     pnlActions.add(btnClose = new JButton(quot;Closequot;));
     btnAdd.addActionListener(new Axn());

                                    Page 91
Building a Linux IPv6 DNS Server
    btnClose.addActionListener(new Axn());
    c.add(quot;Centerquot;, pnlCenter);
    c.add(quot;Southquot;, pnlActions);
    setDefaultCloseOperation(1);
    setLocation(70, 70);
    setSize(280, 150);
    setVisible(true);
 } // end cons


 class Axn implements ActionListener
{
    public void actionPerformed(ActionEvent ae)
    {
        String cmdString = ae.getActionCommand();
        try
        {
            if(cmdString.equals(quot;Addquot;))
            {
                String domainName = jtfDomainName.getText();
              String zoneFileName = dnsDirectory + domainName + quot;.zonequot;;
              String hostName = jtfHostName.getText();
              String ipAddress = jtfAddress.getText();
              PrintWriter zoneFile = new PrintWriter(new
              FileOutputStream(zoneFileName, true));
              zoneFile.println(hostName + quot;tINtAtquot; + ipAddress);
              System.out.println(quot;Record Added Successfully!!!!quot;);


              // Clear the TextFields

                                          Page 92
Building a Linux IPv6 DNS Server
       jtfDomainName.setText(quot;quot;);
       jtfHostName.setText(quot;quot;);
       jtfAddress.setText(quot;quot;);
       zoneFile.close();
        }
            else if(cmdString.equals(quot;Closequot;))
            {
                  frame.dispose();
            }
       }
       catch(Exception e)
       {
                System.out.println(quot;Ipv4 Add: quot; + e);
        } // end try-catch
      } // end action
 } // end Axn


 public static void main(String [] args)
{
    new Ipv4RecordAdder(quot;IPv4 Record Adder..quot;);
 } // end main
} // end Ipv4RecordAdder


                        /* Ipv4RecordAdderIF (Internal Frame) */


import java.io.*;
import java.net.*;
import java.awt.*;

                                         Page 93
Building a Linux IPv6 DNS Server
import javax.swing.*;
import java.awt.event.*;


public class Ipv4RecordAdderIF extends JInternalFrame
{
    String zoneFileName;
    String dnsDirectory = quot;/var/named/quot;; // DEFAULT DIRECTORY
    JTextField jtfDomainName, jtfHostName, jtfAddress;
    JButton btnAdd, btnClose;
    JPanel pnlActions, pnlCenter;
    JInternalFrame frame;
    Container c;


    public Ipv4RecordAdderIF(String title)
    {
        super(title);
        frame = this;
        c = getContentPane();
        pnlCenter = new JPanel();
        pnlCenter.setLayout(new GridLayout(3, 2));
        pnlCenter.add(new JLabel(quot;Domain Name : quot;));
        pnlCenter.add(jtfDomainName = new JTextField());
        pnlCenter.add(new JLabel(quot;Host Name : quot;));
        pnlCenter.add(jtfHostName = new JTextField());
        pnlCenter.add(new JLabel(quot;IPv4 Address: quot;));
        pnlCenter.add(jtfAddress = new JTextField());
        pnlActions = new JPanel();
        pnlActions.setLayout(new GridLayout(1, 2));

                                       Page 94
Building a Linux IPv6 DNS Server
        pnlActions.add(btnAdd = new JButton(quot;Addquot;));
        pnlActions.add(btnClose = new JButton(quot;Closequot;));
        btnAdd.addActionListener(new Axn());
        btnClose.addActionListener(new Axn());
        c.add(quot;Centerquot;, pnlCenter);
        c.add(quot;Southquot;, pnlActions);
        setDefaultCloseOperation(1);
        setClosable(true);
        setResizable(true);
        setMaximizable(true);
        setIconifiable(true);
        setLocation(70, 70);
        setSize(280, 150);
        setVisible(true);
    } // end cons


class Axn implements ActionListener
{
    public void actionPerformed(ActionEvent ae)
    {
         String cmdString = ae.getActionCommand();
         try
          {
               if(cmdString.equals(quot;Addquot;))
              {
              String domainName = jtfDomainName.getText();
              String zoneFileName = dnsDirectory + domainName + quot;.zonequot;;
              String hostName = jtfHostName.getText();

                                         Page 95
Building a Linux IPv6 DNS Server
             String ipAddress = jtfAddress.getText();
             PrintWriter zoneFile = new PrintWriter(new
             FileOutputStream(zoneFileName, true));
             zoneFile.println(hostName + quot;tINtAtquot; + ipAddress);
             System.out.println(quot;Record Added Successfully!!!!quot;);


             // Clear the TextFields
             jtfDomainName.setText(quot;quot;);
             jtfHostName.setText(quot;quot;);
             jtfAddress.setText(quot;quot;);
             zoneFile.close();
         }
         else if(cmdString.equals(quot;Closequot;))
         {
             frame.dispose();
         }
     }
     catch(Exception e)
     {
             System.out.println(quot;Ipv4 Add: quot; + e);
      } // end try-catch
     } // end action
 } // end Axn
 public static void main(String [] args)
 {
             new Ipv4RecordAdderIF(quot;IPv4 Record Adder..quot;);
 } // end main
} // end Ipv4RecordAdderIF

                                          Page 96
Building a Linux IPv6 DNS Server


                                   /* Ipv6RecordAdder */


import java.io.*;
import java.net.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class Ipv6RecordAdder extends JFrame
{
    String zoneFileName;
    String dnsDirectory = quot;/var/named/quot;; // DEFAULT DIRECTORY
    JTextField jtfDomainName, jtfHostName, jtfAddress;
    J Button btnAdd, btnClose;
    JPanel pnlActions, pnlCenter;
    JFrame frame;
    Container c;


    public Ipv6RecordAdder(String title)
{
     super(title);
     frame = this;
     c = getContentPane();
     pnlCenter = new JPanel();
     pnlCenter.setLayout(new GridLayout(3, 2));
     pnlCenter.add(new JLabel(quot;Domain Name : quot;));
     pnlCenter.add(jtfDomainName = new JTextField());

                                        Page 97
Building a Linux IPv6 DNS Server
     pnlCenter.add(new JLabel(quot;Host Name : quot;));
     pnlCenter.add(jtfHostName = new JTextField());
     pnlCenter.add(new JLabel(quot;IPv6 Address: quot;));
     pnlCenter.add(jtfAddress = new JTextField());
     pnlActions = new JPanel();
     pnlActions.setLayout(new GridLayout(1, 2));
     pnlActions.add(btnAdd = new JButton(quot;Addquot;));
     pnlActions.add(btnClose = new JButton(quot;Closequot;));
     btnAdd.addActionListener(new Axn());
     btnClose.addActionListener(new Axn());
     c.add(quot;Centerquot;, pnlCenter);
     c.add(quot;Southquot;, pnlActions);
     setDefaultCloseOperation(1);
     setLocation(70, 70);
     setSize(280, 150);
     setVisible(true);
 } // end cons


 class Axn implements ActionListener
 {
      public void actionPerformed(ActionEvent ae)
      {
          String cmdString = ae.getActionCommand();
          try
          {
              if(cmdString.equals(quot;Addquot;))
              {
                  String domainName = jtfDomainName.getText();

                                          Page 98
Building a Linux IPv6 DNS Server
              String zoneFileName = dnsDirectory + domainName + quot;.zonequot;;
              String hostName = jtfHostName.getText();
              String ipAddress = jtfAddress.getText();
              PrintWriter zoneFile = new PrintWriter(new
FileOutputStream(zoneFileName, true));
              zoneFile.println(hostName + quot;ttINtAAAAtquot; + ipAddress);
              System.out.println(quot;Record Added Successfully!!!!quot;);


             // Clear the TextFields
              jtfDomainName.setText(quot;quot;);
              jtfHostName.setText(quot;quot;);
              jtfAddress.setText(quot;quot;);
              zoneFile.close();
      }
      else if(cmdString.equals(quot;Closequot;))
      {
             frame.dispose();
         }
     }
     catch(Exception e)
     {
          System.out.println(quot;Ipv6 Add: quot; + e);
     } // end try-catch
     } // end action
 } // end Axn


 public static void main(String [] args)
 {

                                         Page 99
Building a Linux IPv6 DNS Server
     new Ipv6RecordAdder(quot;IPv6 Record Adder..quot;);
    } // end main
} // end Ipv6RecordAdder


                     /* Ipv6RecordAdderIF (Internal Frame) */
import java.io.*;
import java.net.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class Ipv6RecordAdderIF extends JInternalFrame
{
    String zoneFileName;
    String dnsDirectory = quot;/var/named/quot;; // DEFAULT DIRECTORY
    JTextField jtfDomainName, jtfHostName, jtfAddress;
    JButton btnAdd, btnClose;
    JPanel pnlActions, pnlCenter;
    JInternalFrame frame;
    Container c;


    public Ipv6RecordAdderIF(String title)
{
     super(title);
     frame = this;
     c = getContentPane();
     pnlCenter = new JPanel();
     pnlCenter.setLayout(new GridLayout(3, 2));

                                    Page 100
Building a Linux IPv6 DNS Server
     pnlCenter.add(new JLabel(quot;Domain Name : quot;));
     pnlCenter.add(jtfDomainName = new JTextField());
     pnlCenter.add(new JLabel(quot;Host Name : quot;));
     pnlCenter.add(jtfHostName = new JTextField());
     pnlCenter.add(new JLabel(quot;IPv6 Address: quot;));
     pnlCenter.add(jtfAddress = new JTextField());


     pnlActions = new JPanel();
     pnlActions.setLayout(new GridLayout(1, 2));
     pnlActions.add(btnAdd = new JButton(quot;Addquot;));
     pnlActions.add(btnClose = new JButton(quot;Closequot;));
     btnAdd.addActionListener(new Axn());
     btnClose.addActionListener(new Axn());
     c.add(quot;Centerquot;, pnlCenter);
     c.add(quot;Southquot;, pnlActions);
     setClosable(true);
     setResizable(true);
     setMaximizable(true);
     setIconifiable(true);
     setDefaultCloseOperation(1);
     setLocation(70, 70);
     setSize(280, 150);
     setVisible(true);
 } // end cons


 class Axn implements ActionListener
 {
     public void actionPerformed(ActionEvent ae)

                                    Page 101
Building a Linux IPv6 DNS Server
  {
      String cmdString = ae.getActionCommand();
      try
      {
          if(cmdString.equals(quot;Addquot;))
          {
              String domainName = jtfDomainName.getText();
              String zoneFileName = dnsDirectory + domainName + quot;.zonequot;;
              String hostName = jtfHostName.getText();
              String ipAddress = jtfAddress.getText();
              PrintWriter zoneFile = new PrintWriter(new
              FileOutputStream(zoneFileName, true));
              zoneFile.println(hostName + quot;ttINtAAAAtquot; + ipAddress);
              System.out.println(quot;Record Added Successfully!!!!quot;);


              // Clear the TextFields
              jtfDomainName.setText(quot;quot;);
              jtfHostName.setText(quot;quot;);
              jtfAddress.setText(quot;quot;);
              zoneFile.close();


      }
      else if(cmdString.equals(quot;Closequot;))
      {
          frame.dispose();
      }
      }
      catch(Exception e)

                                         Page 102
Building a Linux IPv6 DNS Server
     {
         System.out.println(quot;Ipv6 Add: quot; + e);
     } // end try-catch
     } // end action
    } // end Axn


    public static void main(String [] args)
{
     new Ipv6RecordAdderIF(quot;IPv6 Record Adder..quot;);
    } // end main
} // end Ipv6RecordAdderIF


                              /* Address Handler (Server Side) */


import java.io.*;
import java.net.*;
public class AddressHandler
{
            public AddressHandler()
            {
                    try
                          {
                                 //
                                 System.out.println(Inet6Address().numericToTextForm
                                 at());         ServerSocket sok = new
                                 ServerSocket(2995);
                                 System.out.println(quot;Server Ready!!!quot;);
                                 Socket client = sok.accept();

                                          Page 103
Building a Linux IPv6 DNS Server
                                 System.out.println(client);
                                 BufferedReader br = new BufferedReader(new
                                       InputStreamReader(client.getInputStream()));
                                 String line = br.readLine();
                                 System.out.println(quot;Client has sent...quot; + line);
                         }
                         catch(Exception e)
                         {
                                 System.out.println(e);
                         } // end try-catch
         } // end cons
    public static void main(String [] args)
    {
         new AddressHandler();
    }
}


                                    /* Client (Client Side) */


import java.io.*;
import java.net.*;
public class Client
{
         public Client(String host, int port)
               {
                   try
                         {
                             System.out.println(Inet6Address().numericToTextFormat());

                                          Page 104
Building a Linux IPv6 DNS Server
                           Socket sok = new Socket(host, port);
                           System.out.print(quot;Enter some text: quot;);
                           String line = new BufferedReader(new
                           InputStreamReader(System.in)).readLine();
                           PrintWriter out = new PrintWriter(sok.getOutputStream());
                           out.println(line);
                           out.flush();
                       }
                       catch(Exception e)
                                {
                                    System.out.println(e);
                                } // end try-catch
                } // end cons
    public static void main(String [] args)
        {
            new Client(args[0], Integer.parseInt(args[1]));
        }
}




                                          Page 105
Building a Linux IPv6 DNS Server




              /* A Typical view of Named.conf Configuration file */


## named.conf - configuration for bind
#
# Generated automatically by redhat-config-bind, alchemist et al.
# Any changes not supported by redhat-config-bind should be put
# in /etc/named.custom
#
controls {
      inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
include quot;/etc/named.customquot;;
include quot;/etc/rndc.keyquot;;
#options {
#      listen-on-v6 { any; };
#};
zone quot;localhostquot; {
       type master;
       file quot;localhost.zonequot;;
};
zone quot;mahendra.comquot; {
       type master;
       file quot;mahendra.com.zonequot;;
};



                                    Page 106
Building a Linux IPv6 DNS Server




          /* A Typical view of mahendra.com.zone Configuration file */


$TTL 86400
@       IN     SOA localhost. root.localhost (
                      5 ; serial
                      28800 ; refresh
                      7200 ; retry
                      604800 ; expire
                      86400 ; ttl
                      )


        IN     NS     localhost.
sky     IN     MX 1           192.168.5.1
sky     IN     A      192.168.5.1


mahendra.com          IN      CNAME         admin.mahendra.com.
host1                 IN      AAAA          fe80::200:1cff:fe81:e1d0
redhat1               IN      AAAA          fe80::200:1cff:fe81:e1d0
penguin               IN      AAAA          fe80::200:1cff:fe81:e1d0
node 2                IN      A             192.168.5.4
node 1                IN      A             192.168.5.3




                                        Page 107

Contenu connexe

Tendances

Continuous testing In PHP
Continuous testing In PHPContinuous testing In PHP
Continuous testing In PHPEric Hogue
 
Guarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous TestingGuarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous TestingEric Hogue
 
こわくないよ❤️ Playframeworkソースコードリーディング入門
こわくないよ❤️ Playframeworkソースコードリーディング入門こわくないよ❤️ Playframeworkソースコードリーディング入門
こわくないよ❤️ Playframeworkソースコードリーディング入門tanacasino
 
Feb14 successful development
Feb14 successful developmentFeb14 successful development
Feb14 successful developmentConnor McDonald
 
Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014Eric Hogue
 
Publishing a Perl6 Module
Publishing a Perl6 ModulePublishing a Perl6 Module
Publishing a Perl6 Moduleast_j
 
コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜
コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜
コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜Retrieva inc.
 
Pf: the OpenBSD packet filter
Pf: the OpenBSD packet filterPf: the OpenBSD packet filter
Pf: the OpenBSD packet filterGiovanni Bechis
 
2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits 2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits Raleigh ISSA
 
Killing any security product … using a Mimikatz undocumented feature
Killing any security product … using a Mimikatz undocumented featureKilling any security product … using a Mimikatz undocumented feature
Killing any security product … using a Mimikatz undocumented featureCyber Security Alliance
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)CODE BLUE
 
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...Tzung-Bi Shih
 
Nko workshop - node js crud & deploy
Nko workshop - node js crud & deployNko workshop - node js crud & deploy
Nko workshop - node js crud & deploySimon Su
 
Alexander Reelsen - Seccomp for Developers
Alexander Reelsen - Seccomp for DevelopersAlexander Reelsen - Seccomp for Developers
Alexander Reelsen - Seccomp for DevelopersDevDay Dresden
 
32 shell-programming
32 shell-programming32 shell-programming
32 shell-programmingkayalkarnan
 

Tendances (20)

Continuous testing In PHP
Continuous testing In PHPContinuous testing In PHP
Continuous testing In PHP
 
Guarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous TestingGuarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous Testing
 
こわくないよ❤️ Playframeworkソースコードリーディング入門
こわくないよ❤️ Playframeworkソースコードリーディング入門こわくないよ❤️ Playframeworkソースコードリーディング入門
こわくないよ❤️ Playframeworkソースコードリーディング入門
 
Feb14 successful development
Feb14 successful developmentFeb14 successful development
Feb14 successful development
 
Linuxserver harden
Linuxserver hardenLinuxserver harden
Linuxserver harden
 
Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014
 
Ssh cookbook
Ssh cookbookSsh cookbook
Ssh cookbook
 
Publishing a Perl6 Module
Publishing a Perl6 ModulePublishing a Perl6 Module
Publishing a Perl6 Module
 
System Calls
System CallsSystem Calls
System Calls
 
コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜
コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜
コンテナ仮想、その裏側 〜user namespaceとrootlessコンテナ〜
 
Pf: the OpenBSD packet filter
Pf: the OpenBSD packet filterPf: the OpenBSD packet filter
Pf: the OpenBSD packet filter
 
Da APK al Golden Ticket
Da APK al Golden TicketDa APK al Golden Ticket
Da APK al Golden Ticket
 
2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits 2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits
 
Killing any security product … using a Mimikatz undocumented feature
Killing any security product … using a Mimikatz undocumented featureKilling any security product … using a Mimikatz undocumented feature
Killing any security product … using a Mimikatz undocumented feature
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
 
Ethical hacking with Python tools
Ethical hacking with Python toolsEthical hacking with Python tools
Ethical hacking with Python tools
 
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
 
Nko workshop - node js crud & deploy
Nko workshop - node js crud & deployNko workshop - node js crud & deploy
Nko workshop - node js crud & deploy
 
Alexander Reelsen - Seccomp for Developers
Alexander Reelsen - Seccomp for DevelopersAlexander Reelsen - Seccomp for Developers
Alexander Reelsen - Seccomp for Developers
 
32 shell-programming
32 shell-programming32 shell-programming
32 shell-programming
 

En vedette

Cajamarca tania citasapa
Cajamarca tania citasapaCajamarca tania citasapa
Cajamarca tania citasapa1984KKK
 
6. Sexo, Genero Y Feminismo Tres Categorias En Pugna
6. Sexo, Genero Y Feminismo Tres Categorias En Pugna6. Sexo, Genero Y Feminismo Tres Categorias En Pugna
6. Sexo, Genero Y Feminismo Tres Categorias En Pugnaanonimas
 
Fundamentos de Teste de Software - Dev in PF. por Aline Zanin
Fundamentos de Teste de Software - Dev in PF. por Aline ZaninFundamentos de Teste de Software - Dev in PF. por Aline Zanin
Fundamentos de Teste de Software - Dev in PF. por Aline ZaninDevInPF
 
Modelo gesti n_por_competencias
Modelo gesti n_por_competenciasModelo gesti n_por_competencias
Modelo gesti n_por_competenciaslvive
 
Resultados prueba ortográfica
Resultados prueba ortográficaResultados prueba ortográfica
Resultados prueba ortográficaCentrofusagasuga
 
Simplifiez votre activité grâce au traitement documentaire intelligent
Simplifiez votre activité grâce au traitement documentaire intelligentSimplifiez votre activité grâce au traitement documentaire intelligent
Simplifiez votre activité grâce au traitement documentaire intelligentXerox Global
 
La prueba confesional proc mecantil mexico
La prueba confesional proc mecantil mexicoLa prueba confesional proc mecantil mexico
La prueba confesional proc mecantil mexicoOrozco Jorge
 
Matriz competencias Talento Humano
Matriz competencias Talento HumanoMatriz competencias Talento Humano
Matriz competencias Talento HumanoYessenia Aya
 
Bienes expo 1[1]
Bienes expo 1[1]Bienes expo 1[1]
Bienes expo 1[1]Omar Vidal
 
The Chinese Educational System and its Affect on Student’s Behavior in the Wo...
The Chinese Educational System and its Affect on Student’s Behavior in the Wo...The Chinese Educational System and its Affect on Student’s Behavior in the Wo...
The Chinese Educational System and its Affect on Student’s Behavior in the Wo...Patrick Huang
 
32 ways to make your blog suck less
32 ways to make your blog suck less32 ways to make your blog suck less
32 ways to make your blog suck lessScott Hanselman
 
Estrategias competitivas básicas
Estrategias competitivas básicasEstrategias competitivas básicas
Estrategias competitivas básicasLarryJimenez
 

En vedette (17)

Trabajo de investigación
Trabajo de investigaciónTrabajo de investigación
Trabajo de investigación
 
Cajamarca tania citasapa
Cajamarca tania citasapaCajamarca tania citasapa
Cajamarca tania citasapa
 
Suprimentos
SuprimentosSuprimentos
Suprimentos
 
6. Sexo, Genero Y Feminismo Tres Categorias En Pugna
6. Sexo, Genero Y Feminismo Tres Categorias En Pugna6. Sexo, Genero Y Feminismo Tres Categorias En Pugna
6. Sexo, Genero Y Feminismo Tres Categorias En Pugna
 
Fundamentos de Teste de Software - Dev in PF. por Aline Zanin
Fundamentos de Teste de Software - Dev in PF. por Aline ZaninFundamentos de Teste de Software - Dev in PF. por Aline Zanin
Fundamentos de Teste de Software - Dev in PF. por Aline Zanin
 
Modelo gesti n_por_competencias
Modelo gesti n_por_competenciasModelo gesti n_por_competencias
Modelo gesti n_por_competencias
 
Resultados prueba ortográfica
Resultados prueba ortográficaResultados prueba ortográfica
Resultados prueba ortográfica
 
Simplifiez votre activité grâce au traitement documentaire intelligent
Simplifiez votre activité grâce au traitement documentaire intelligentSimplifiez votre activité grâce au traitement documentaire intelligent
Simplifiez votre activité grâce au traitement documentaire intelligent
 
La prueba confesional proc mecantil mexico
La prueba confesional proc mecantil mexicoLa prueba confesional proc mecantil mexico
La prueba confesional proc mecantil mexico
 
Matriz competencias Talento Humano
Matriz competencias Talento HumanoMatriz competencias Talento Humano
Matriz competencias Talento Humano
 
Bienes expo 1[1]
Bienes expo 1[1]Bienes expo 1[1]
Bienes expo 1[1]
 
Gestão de marketing
Gestão de marketingGestão de marketing
Gestão de marketing
 
The Chinese Educational System and its Affect on Student’s Behavior in the Wo...
The Chinese Educational System and its Affect on Student’s Behavior in the Wo...The Chinese Educational System and its Affect on Student’s Behavior in the Wo...
The Chinese Educational System and its Affect on Student’s Behavior in the Wo...
 
32 ways to make your blog suck less
32 ways to make your blog suck less32 ways to make your blog suck less
32 ways to make your blog suck less
 
Gestão da Cadeia de Suprimentos
Gestão da Cadeia de SuprimentosGestão da Cadeia de Suprimentos
Gestão da Cadeia de Suprimentos
 
04 cadeia de suprimentos
04 cadeia de suprimentos04 cadeia de suprimentos
04 cadeia de suprimentos
 
Estrategias competitivas básicas
Estrategias competitivas básicasEstrategias competitivas básicas
Estrategias competitivas básicas
 

Similaire à Build a Linux IPv6 DNS Server

Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slidesharetomcopeland
 
Really useful linux commands
Really useful linux commandsReally useful linux commands
Really useful linux commandsMichael J Geiser
 
All I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkAll I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkBen Scofield
 
NUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialNUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialGagah Arifianto
 
Dynamic Tracing of your AMP web site
Dynamic Tracing of your AMP web siteDynamic Tracing of your AMP web site
Dynamic Tracing of your AMP web siteSriram Natarajan
 
StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce
StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce
StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce StackIQ
 
Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort webhostingguy
 
Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort webhostingguy
 
Systems Automation with Puppet
Systems Automation with PuppetSystems Automation with Puppet
Systems Automation with Puppetelliando dias
 

Similaire à Build a Linux IPv6 DNS Server (20)

Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Capistrano2
Capistrano2Capistrano2
Capistrano2
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
Yg byev2e
Yg byev2eYg byev2e
Yg byev2e
 
Sinatra
SinatraSinatra
Sinatra
 
Puppet Camp 2012
Puppet Camp 2012Puppet Camp 2012
Puppet Camp 2012
 
Osol Pgsql
Osol PgsqlOsol Pgsql
Osol Pgsql
 
Really useful linux commands
Really useful linux commandsReally useful linux commands
Really useful linux commands
 
All I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkAll I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web Framework
 
Linux Command Line
Linux Command LineLinux Command Line
Linux Command Line
 
NUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialNUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline Tutorial
 
Dynamic Tracing of your AMP web site
Dynamic Tracing of your AMP web siteDynamic Tracing of your AMP web site
Dynamic Tracing of your AMP web site
 
Puppet @ Seat
Puppet @ SeatPuppet @ Seat
Puppet @ Seat
 
StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce
StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce
StackiFest16: Stacki 1600+ Server Journey - Dave Peterson, Salesforce
 
Stacki - The1600+ Server Journey
Stacki - The1600+ Server JourneyStacki - The1600+ Server Journey
Stacki - The1600+ Server Journey
 
Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort
 
Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort
 
Ubic
UbicUbic
Ubic
 
Ubic-public
Ubic-publicUbic-public
Ubic-public
 
Systems Automation with Puppet
Systems Automation with PuppetSystems Automation with Puppet
Systems Automation with Puppet
 

Plus de Hari

Abstract and List of Charts for Vehicle Tracking and Ticketing System Using ...
Abstract  and List of Charts for Vehicle Tracking and Ticketing System Using ...Abstract  and List of Charts for Vehicle Tracking and Ticketing System Using ...
Abstract and List of Charts for Vehicle Tracking and Ticketing System Using ...Hari
 
Table of Contents Vehicle Tracking and Ticketing System Using RFID Project (S...
Table of Contents Vehicle Tracking and Ticketing System Using RFID Project (S...Table of Contents Vehicle Tracking and Ticketing System Using RFID Project (S...
Table of Contents Vehicle Tracking and Ticketing System Using RFID Project (S...Hari
 
Vehicle Tracking and Ticketing System Using RFID Project (Complete Softcopy)
Vehicle Tracking and Ticketing System Using RFID Project (Complete Softcopy)Vehicle Tracking and Ticketing System Using RFID Project (Complete Softcopy)
Vehicle Tracking and Ticketing System Using RFID Project (Complete Softcopy)Hari
 
Vehicle Tracking and Ticketing System Using RFID Project - Circuit Block Diagram
Vehicle Tracking and Ticketing System Using RFID Project - Circuit Block DiagramVehicle Tracking and Ticketing System Using RFID Project - Circuit Block Diagram
Vehicle Tracking and Ticketing System Using RFID Project - Circuit Block DiagramHari
 
Keywords Explanation To Rfid Project Annexure
Keywords Explanation To Rfid Project  AnnexureKeywords Explanation To Rfid Project  Annexure
Keywords Explanation To Rfid Project AnnexureHari
 
Abstract Of The Rfid Project I
Abstract Of The Rfid Project IAbstract Of The Rfid Project I
Abstract Of The Rfid Project IHari
 
Building a Linux IPv6 DNS Server Anims (Promo)
Building a Linux IPv6 DNS Server Anims (Promo)Building a Linux IPv6 DNS Server Anims (Promo)
Building a Linux IPv6 DNS Server Anims (Promo)Hari
 
List Of Figures and Diagrams for Building Linux IPv6 DNS Server
List Of Figures and Diagrams for Building Linux IPv6 DNS ServerList Of Figures and Diagrams for Building Linux IPv6 DNS Server
List Of Figures and Diagrams for Building Linux IPv6 DNS ServerHari
 
Table Of Contents for Building Linux IPV6 DNS Server
Table Of Contents for Building Linux IPV6 DNS ServerTable Of Contents for Building Linux IPV6 DNS Server
Table Of Contents for Building Linux IPV6 DNS ServerHari
 
Screen Shots of Building IPv6 DNS Server (Screen shots)
Screen Shots of Building IPv6 DNS Server (Screen shots)Screen Shots of Building IPv6 DNS Server (Screen shots)
Screen Shots of Building IPv6 DNS Server (Screen shots)Hari
 
List Of Acronym in Building Linux IPV6 DNS Server
List Of Acronym in Building Linux IPV6 DNS ServerList Of Acronym in Building Linux IPV6 DNS Server
List Of Acronym in Building Linux IPV6 DNS ServerHari
 
Building Linux IPv6 DNS Server (Complete Soft Copy)
Building Linux IPv6 DNS Server (Complete Soft Copy)Building Linux IPv6 DNS Server (Complete Soft Copy)
Building Linux IPv6 DNS Server (Complete Soft Copy)Hari
 
Abstract of the Vehicle Tracking and Ticketing System (VTTS) using RFID
Abstract of the Vehicle Tracking and Ticketing System (VTTS) using RFIDAbstract of the Vehicle Tracking and Ticketing System (VTTS) using RFID
Abstract of the Vehicle Tracking and Ticketing System (VTTS) using RFIDHari
 
Bottom Line of Building Linux IPv6 DNS Server Project
Bottom Line of Building Linux IPv6 DNS Server ProjectBottom Line of Building Linux IPv6 DNS Server Project
Bottom Line of Building Linux IPv6 DNS Server ProjectHari
 
Software Design Specification For Smart Internet Cafe
Software Design Specification For Smart Internet CafeSoftware Design Specification For Smart Internet Cafe
Software Design Specification For Smart Internet CafeHari
 
Software Requirement Specification For Smart Internet Cafe
Software Requirement Specification For Smart Internet CafeSoftware Requirement Specification For Smart Internet Cafe
Software Requirement Specification For Smart Internet CafeHari
 
Building Linux IPv6 DNS Server (Draft Copy)
Building Linux IPv6 DNS Server (Draft Copy)Building Linux IPv6 DNS Server (Draft Copy)
Building Linux IPv6 DNS Server (Draft Copy)Hari
 
Building Linux IPv6 DNS Server (Complete Presentation)
Building Linux IPv6 DNS Server (Complete Presentation)Building Linux IPv6 DNS Server (Complete Presentation)
Building Linux IPv6 DNS Server (Complete Presentation)Hari
 
Screen Shots of Building Linux IPv6 DNS Server
Screen Shots of Building Linux IPv6 DNS Server Screen Shots of Building Linux IPv6 DNS Server
Screen Shots of Building Linux IPv6 DNS Server Hari
 
Building Linux IPv6 DNS Server (Third Review)
Building Linux IPv6 DNS Server (Third Review)Building Linux IPv6 DNS Server (Third Review)
Building Linux IPv6 DNS Server (Third Review)Hari
 

Plus de Hari (20)

Abstract and List of Charts for Vehicle Tracking and Ticketing System Using ...
Abstract  and List of Charts for Vehicle Tracking and Ticketing System Using ...Abstract  and List of Charts for Vehicle Tracking and Ticketing System Using ...
Abstract and List of Charts for Vehicle Tracking and Ticketing System Using ...
 
Table of Contents Vehicle Tracking and Ticketing System Using RFID Project (S...
Table of Contents Vehicle Tracking and Ticketing System Using RFID Project (S...Table of Contents Vehicle Tracking and Ticketing System Using RFID Project (S...
Table of Contents Vehicle Tracking and Ticketing System Using RFID Project (S...
 
Vehicle Tracking and Ticketing System Using RFID Project (Complete Softcopy)
Vehicle Tracking and Ticketing System Using RFID Project (Complete Softcopy)Vehicle Tracking and Ticketing System Using RFID Project (Complete Softcopy)
Vehicle Tracking and Ticketing System Using RFID Project (Complete Softcopy)
 
Vehicle Tracking and Ticketing System Using RFID Project - Circuit Block Diagram
Vehicle Tracking and Ticketing System Using RFID Project - Circuit Block DiagramVehicle Tracking and Ticketing System Using RFID Project - Circuit Block Diagram
Vehicle Tracking and Ticketing System Using RFID Project - Circuit Block Diagram
 
Keywords Explanation To Rfid Project Annexure
Keywords Explanation To Rfid Project  AnnexureKeywords Explanation To Rfid Project  Annexure
Keywords Explanation To Rfid Project Annexure
 
Abstract Of The Rfid Project I
Abstract Of The Rfid Project IAbstract Of The Rfid Project I
Abstract Of The Rfid Project I
 
Building a Linux IPv6 DNS Server Anims (Promo)
Building a Linux IPv6 DNS Server Anims (Promo)Building a Linux IPv6 DNS Server Anims (Promo)
Building a Linux IPv6 DNS Server Anims (Promo)
 
List Of Figures and Diagrams for Building Linux IPv6 DNS Server
List Of Figures and Diagrams for Building Linux IPv6 DNS ServerList Of Figures and Diagrams for Building Linux IPv6 DNS Server
List Of Figures and Diagrams for Building Linux IPv6 DNS Server
 
Table Of Contents for Building Linux IPV6 DNS Server
Table Of Contents for Building Linux IPV6 DNS ServerTable Of Contents for Building Linux IPV6 DNS Server
Table Of Contents for Building Linux IPV6 DNS Server
 
Screen Shots of Building IPv6 DNS Server (Screen shots)
Screen Shots of Building IPv6 DNS Server (Screen shots)Screen Shots of Building IPv6 DNS Server (Screen shots)
Screen Shots of Building IPv6 DNS Server (Screen shots)
 
List Of Acronym in Building Linux IPV6 DNS Server
List Of Acronym in Building Linux IPV6 DNS ServerList Of Acronym in Building Linux IPV6 DNS Server
List Of Acronym in Building Linux IPV6 DNS Server
 
Building Linux IPv6 DNS Server (Complete Soft Copy)
Building Linux IPv6 DNS Server (Complete Soft Copy)Building Linux IPv6 DNS Server (Complete Soft Copy)
Building Linux IPv6 DNS Server (Complete Soft Copy)
 
Abstract of the Vehicle Tracking and Ticketing System (VTTS) using RFID
Abstract of the Vehicle Tracking and Ticketing System (VTTS) using RFIDAbstract of the Vehicle Tracking and Ticketing System (VTTS) using RFID
Abstract of the Vehicle Tracking and Ticketing System (VTTS) using RFID
 
Bottom Line of Building Linux IPv6 DNS Server Project
Bottom Line of Building Linux IPv6 DNS Server ProjectBottom Line of Building Linux IPv6 DNS Server Project
Bottom Line of Building Linux IPv6 DNS Server Project
 
Software Design Specification For Smart Internet Cafe
Software Design Specification For Smart Internet CafeSoftware Design Specification For Smart Internet Cafe
Software Design Specification For Smart Internet Cafe
 
Software Requirement Specification For Smart Internet Cafe
Software Requirement Specification For Smart Internet CafeSoftware Requirement Specification For Smart Internet Cafe
Software Requirement Specification For Smart Internet Cafe
 
Building Linux IPv6 DNS Server (Draft Copy)
Building Linux IPv6 DNS Server (Draft Copy)Building Linux IPv6 DNS Server (Draft Copy)
Building Linux IPv6 DNS Server (Draft Copy)
 
Building Linux IPv6 DNS Server (Complete Presentation)
Building Linux IPv6 DNS Server (Complete Presentation)Building Linux IPv6 DNS Server (Complete Presentation)
Building Linux IPv6 DNS Server (Complete Presentation)
 
Screen Shots of Building Linux IPv6 DNS Server
Screen Shots of Building Linux IPv6 DNS Server Screen Shots of Building Linux IPv6 DNS Server
Screen Shots of Building Linux IPv6 DNS Server
 
Building Linux IPv6 DNS Server (Third Review)
Building Linux IPv6 DNS Server (Third Review)Building Linux IPv6 DNS Server (Third Review)
Building Linux IPv6 DNS Server (Third Review)
 

Dernier

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Dernier (20)

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

Build a Linux IPv6 DNS Server

  • 1. Building a Linux IPv6 DNS Server /*Loading .sh (Shell Script) */ putChar() { i=1 while [ $i -le $3 ] do echo -n quot;$1quot; sleep $2 i=`expr $i + 1` done } clear echo putChar _ 0 80 echo -e quot;nquot; echo quot; !!! Loading System Detailsquot; echo -ne quot;nttit may take few seconds quot; sleep 1 putChar '.' 0.25 20 putChar '.' 0 20 putChar _ 0 80 sleep 1 echo -ne quot;nnnt--> Checking system details quot; putChar '.' 0.5 8 echo -e quot;nntt-- Machine (hardware) type : `uname -m`quot; Page 54
  • 2. Building a Linux IPv6 DNS Server sleep 2 echo -e quot;tt-- Machine's network hostname : `uname -n`quot; sleep 1 echo -e quot;tt-- Operating system release : `uname -r`quot; sleep 0.5 echo -e quot;tt-- Operating system name : `uname -s`quot; sleep 0.5 echo -e quot;tt-- Host processor type : `uname -p`quot; sleep 0.25 echo -e quot;tt-- Operating system version : `uname -v`quot; sleep 1 echo -ne quot;nnt--> Checking for root user privilege quot; putChar '.' 0.5 6 sleep 1 if [ quot;`whoami`quot; != quot;rootquot; ] then echo -e quot;nntt-- Sorry this software has to be run by root user....nnquot; sleep 2 echo -e quot;nttAborting.......quot;; sleep 5 exit else sh run.sh echo -e quot;nntt-- found root user privileges !quot; sleep 1 echo -ne quot;nntttttttt quot; putChar '->' 0.25 5 Page 55
  • 3. Building a Linux IPv6 DNS Server sleep 1 echo -e quot;nquot; fi /* Builder.c [C source File] */ #include <unistd.h> #include <stdio.h> #include <dirent.h> #include <string.h> #include <sys/stat.h> #include <stdlib.h> void printChar(char c, int count) { int i; for(i=0; i<count; i++) printf(quot;%cquot;, c); printf(quot;nquot;); } // end printChar void bu() { system(quot;sh built.shquot;); } void Builder() { char ans, dirName[260]; char dir,command[260]; FILE *fp = fopen(quot;SourceDirquot;, quot;rquot;); fscanf(fp, quot;%squot;, dirName); Page 56
  • 4. Building a Linux IPv6 DNS Server fclose(fp); printf(quot;Enter the Dir. Name Default is '%s' is it o.k (y/n): quot;, dirName); scanf(quot; %cquot;, &dir); if(dir == 'y') { printf(quot;Ensure that U have copied the source files..quot;); printf(quot;Shall I Proceed...(y/n): quot;); scanf(quot; %cquot;, &ans); if(ans == 'y') { chdir(dirName); // system(quot;cp -rf /usr/src/linux-2.4.21-4.EL/arch/i386/defconfig /usr/src/linux- 2.4.21-4.EL/arch/i386/defconfig.orgquot;); printChar('/',79); printChar('/',79); printf(quot;nquot;); printf(quot;Press Any key to proceed with cleaning...quot;); getchar(); getchar(); printChar('/',79); printChar('/',79); system(quot;sleep 40quot;); printf(quot;nquot;); printf(quot;Press Any key to proceed with kernel image creation...quot;); getchar(); /* system(quot;make bzImage &> /dev/zeroquot;);*/ bu(); system(quot;sleep 60quot;); printChar('*', 79); printChar('*', 79); Page 57
  • 5. Building a Linux IPv6 DNS Server printChar('*', 79); //strcpy(command,quot;cp /Project/ntfssupportedkernel arch/i386/boot/bzImagequot;); //system(command); printf(quot;nProcess Completed Successfully!!!nnquot;); } } else { printf(quot;Enter the directory Name: quot;); scanf(quot;%squot;, dirName); printf(quot;Ensure that U have copied the source files..quot;); printf(quot;Shall I Proceed...(y/n): quot;); scanf(quot; %cquot;, &ans); printf(quot;ans is %cnquot;, ans); if(ans == 'y') { chdir(dirName); system(quot;make dep &> /dev/zeroquot;); // system(quot;make dep | tee .o; ./.squot;); printChar('/',79); printChar('/',79); printf(quot;nquot;); printf(quot;Press Any key to proceed with cleaning...quot;); getchar(); getchar(); system(quot;sleep 60quot;); printChar('/',79); printChar('/',79); printf(quot;nquot;); printf(quot;Press Any key to proceed with kernel image creation...quot;); getchar(); Page 58
  • 6. Building a Linux IPv6 DNS Server printChar('/',79); printChar('/',79); printf(quot;nquot;); //system(quot;sleep 60quot;); printChar('*', 79); system(command); printChar('*', 79); printf(quot;Process Completed Successfully!!!nnquot;); } } } // end Builder int main() { Builder(); } // end main /* Dir Handler.c [C source File] */ #include <unistd.h> #include <stdio.h> #include <dirent.h> #include <string.h> #include <sys/stat.h> #include <stdlib.h> void PrintDir(char *dirName, int depth) { DIR *dp; struct dirent *entry; struct stat statbuf; if((dp = opendir(dirName)) == NULL) { fprintf(stderr, quot;Cann't open Directory: %snquot;, dirName); return; Page 59
  • 7. Building a Linux IPv6 DNS Server } chdir(dirName); while((entry = readdir(dp)) != NULL) { lstat(entry->d_name, &statbuf); if(S_ISDIR(statbuf.st_mode)) { /* ignore . and .. */ if(strcmp(quot;.quot;, entry->d_name) == 0 || strcmp(quot;..quot;, entry->d_name)==0) continue; printf(quot;%s/nquot;, entry->d_name); } // end if } // end while } // end PrintDir void DirHandler() { FILE *fp = fopen(quot;SourceDirquot;, quot;wquot;); char dirName[81]; char command[200]; char cmd[250]; char srcName[260], destName[260]; char pro; char defDir[] = quot;/usr/src/quot;; char srcRel[50], destRel[50]; printf(quot;Enter the Dir To be scanned: quot;); scanf(quot;%squot;, dirName); PrintDir(dirName, 0); printf(quot;nn... That's all folks...nquot;); printf(quot;The default dir is '%s' Shall I proceed? (y/n): quot;, defDir); scanf(quot; %cquot;, &pro); if(pro == 'n') { Page 60
  • 8. Building a Linux IPv6 DNS Server printf(quot;Enter the Directory U want to be backed up: quot;); scanf(quot;%squot;, srcName); printf(quot;Now Enter the Directory name U want the sources to be in: quot;); scanf(quot;%squot;, destName); command[0]='0'; strcat(command, quot;cp -r quot;); strcat(command, srcName); strcat(command, quot; quot;); strcat(command, destName); cmd[0] = '0'; strcat(cmd, command); printf(quot;n Command %squot;,cmd); printf(quot;nPress any key to go ahead with backup....quot;); printf(quot;This process may take several minutes... pls. wait....quot;); /* getchar(); getchar(); printf(quot;n Command %s quot;, command);*/ getchar(); system(command); printf(quot;nProcess Completed Successfully!!!nnquot;); } else { printf(quot;Enter the Directory U want to be backed up: quot;); scanf(quot;%squot;, srcRel); srcName[0]='0'; strcpy(srcName, defDir); strcat(srcName, srcRel); printf(quot;Now Enter the Directory name U want the sources to be in: quot;); scanf(quot;%squot;, destRel); Page 61
  • 9. Building a Linux IPv6 DNS Server strcpy(destName, defDir); strcat(destName, destRel); command[0]='0'; strcat(command, quot;cp -r quot;); strcat(command, srcName); strcat(command, quot; quot;); strcat(command, destName); printf(quot;nPress any key to go ahead with backup....quot;); printf(quot;This process may take several minutes... pls. wait....quot;); getchar(); getchar(); system(command); printf(quot;nProcess Completed Successfully!!!nnquot;); } fprintf(fp, quot;%squot;, destName); fclose(fp); } // end DirHandler int main() { DirHandler(); } /* MemberAdderGUI (Server Side) */ import java.net.*; import java.awt.*; import java.util.*; import javax.swing.*; Page 62
  • 10. Building a Linux IPv6 DNS Server import java.awt.event.*; public class MemberAdderGUI extends JFrame { ServerSocket serverSocket; int DEFAULT_PORT=111; int port; Vector membersList; JFrame frame; TextField tfStatus; Container c; JPanel pnlPortInfo; JTextField jtfPort; JButton btnAction; java.awt.List lstMembers; String strBtnCaption = quot;quot;; Thread memberAdder; public MemberAdderGUI(String title) { super(title); membersList = new Vector(); frame = this; c = getContentPane(); strBtnCaption = quot;Startquot;; pnlPortInfo = new JPanel(); pnlPortInfo.setLayout(new BorderLayout()); pnlPortInfo.add(quot;Westquot;, new JLabel(quot;Port: quot;)); Page 63
  • 11. Building a Linux IPv6 DNS Server pnlPortInfo.add(quot;Centerquot;, jtfPort = new JTextField(7)); pnlPortInfo.add(quot;Eastquot;, btnAction = new JButton(strBtnCaption)); btnAction.addActionListener(new Axn()); c.add(quot;Northquot;, pnlPortInfo); c.add(quot;Centerquot;, lstMembers = new java.awt.List(7)); c.add(quot;Southquot;, tfStatus = new TextField()); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setSize(300, 300); setLocation(70, 70); setVisible(true); } public MemberAdderGUI(int port) { this.port = port; membersList = new Vector(); } class MemberAdder implements Runnable { public void run() { try { serverSocket = new ServerSocket(port); System.out.println(quot;Member Adder started and waiting...at 'quot; + port + quot;'..!!quot;); Socket clientSocket = null; while(true) Page 64
  • 12. Building a Linux IPv6 DNS Server { clientSocket = serverSocket.accept(); System.out.println(quot;Connected to machine: quot; + clientSocket); String ipAddress = clientSocket.getInetAddress().getHostAddress(); clientSocket.close(); addMember(ipAddress); printMembers(); } } catch(Exception e) { } } // end run } // end MemberAdder public void addMember(String ipAddress) { if(!membersList.contains(ipAddress)) { membersList.add(ipAddress); lstMembers.add(ipAddress); tfStatus.setText(quot;Added 'quot; + ipAddress + quot;' Successfully!!quot;); } else { System.out.println(quot;quot;quot; + ipAddress + quot;quot; has been added already!!!quot;); tfStatus.setText(quot;quot;quot; + ipAddress + quot;quot; has been added already!!!quot;); } } Page 65
  • 13. Building a Linux IPv6 DNS Server public void printMembers() { System.out.println(quot;nnList of Available members is..nquot;); Enumeration list = membersList.elements(); while(list.hasMoreElements()) { System.out.println((String)list.nextElement()); } System.out.println(quot;-----------------------that's all-----------------------quot;); } class Axn implements ActionListener { public void actionPerformed(ActionEvent ae) { String strCommand = ae.getActionCommand(); try { if(strCommand.equals(quot;Startquot;)) { strBtnCaption = quot;Stopquot;; btnAction.setText(strBtnCaption); if(jtfPort.getText().equals(quot;quot;)) { port = DEFAULT_PORT; } else Page 66
  • 14. Building a Linux IPv6 DNS Server { port = Integer.parseInt(jtfPort.getText()); } if(memberAdder == null) { memberAdder = new Thread(new MemberAdder()); memberAdder.start(); } else { memberAdder = null; System.gc(); } } else if(strCommand.equals(quot;Stopquot;)) { strBtnCaption = quot;Startquot;; btnAction.setText(strBtnCaption); serverSocket.close(); serverSocket = null; System.gc(); } } catch(Exception e) { System.out.println(quot;MemberAdderGUI: Axn: quot; + e); } // end try-catch Page 67
  • 15. Building a Linux IPv6 DNS Server } // end action } // end Axn public static void main(String [] args) { new MemberAdderGUI(quot;Member Listquot;); } } // end MemberAdderGUI /* AddMeAsMemberGUI (Client Side)*/ import java.io.*; import java.net.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class AddMeAsMemberGUI extends JFrame { String host; int port; JTextField jtfHost, jtfPort; JPanel pnlHostInfo, pnl1, pnl2, pnlActions; JFrame frame; Container c; JButton btnRegister, btnClose; public AddMeAsMemberGUI(String title) { Page 68
  • 16. Building a Linux IPv6 DNS Server c = getContentPane(); setTitle(title); frame = this; pnlHostInfo = new JPanel(); pnlHostInfo.setLayout(new BorderLayout()); pnl1 = new JPanel(); pnl1.setLayout(new GridLayout(2, 1)); pnl1.add(jtfHost = new JTextField(15)); pnl1.add(jtfPort = new JTextField(15)); pnl2 = new JPanel(); pnl2.setLayout(new GridLayout(2, 1)); pnl2.add(new JLabel(quot;Host: quot;)); pnl2.add(new JLabel(quot;Port: quot;)); pnlActions = new JPanel(); pnlActions.setLayout(new GridLayout(1, 2)); pnlActions.add(btnRegister = new JButton(quot;Registerquot;)); btnRegister.addActionListener(new Axn()); pnlActions.add(btnClose = new JButton(quot;Closequot;)); btnClose.addActionListener(new Axn()); pnlHostInfo.add(quot;Centerquot;, pnl1); pnlHostInfo.add(quot;Westquot;, pnl2); pnlHostInfo.add(quot;Southquot;, pnlActions); c.add(quot;Centerquot;, pnlHostInfo); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setSize(200, 110); setLocation(80, 80); setVisible(true); } // end cons Page 69
  • 17. Building a Linux IPv6 DNS Server class AddMe implements Runnable { public void run() { try { Socket clientSocket = new Socket(host, port); } catch(Exception e) { System.out.println(quot;AddMe: Axn: quot; + e); } } // end run } // end AddMe public class Axn implements ActionListener { public void actionPerformed(ActionEvent ae) { String strCmd = ae.getActionCommand(); if(strCmd.equals(quot;Registerquot;)) { host = jtfHost.getText(); port = Integer.parseInt(jtfPort.getText()); new Thread(new AddMe()).start(); } else if(strCmd.equals(quot;Closequot;)) { Page 70
  • 18. Building a Linux IPv6 DNS Server frame.dispose(); } } } // end Axn public static void main(String [] args) { new AddMeAsMemberGUI(quot;Add Me As MEMBERquot;); } } // end AddMeAsMemberGUI /* LookUp Server GUI (Server Side) */ import java.io.*; import java.net.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class LookUpServerGUI extends JFrame { ServerSocket serverSok; JButton btnStart, btnStop; JTextField jtfPort; JPanel pnlActions, pnlPortInfo; boolean stopServer; Thread lookupSvr; Container c; Page 71
  • 19. Building a Linux IPv6 DNS Server public LookUpServerGUI(String title) { super(title); c = getContentPane(); pnlPortInfo = new JPanel(); pnlPortInfo.setLayout(new GridLayout(1, 2)); pnlPortInfo.add(new JLabel(quot;Port: quot;)); pnlPortInfo.add(jtfPort = new JTextField(4)); pnlActions = new JPanel(); pnlActions.setLayout(new GridLayout(2, 1)); pnlActions.add(btnStart = new JButton(quot;Startquot;)); pnlActions.add(btnStop = new JButton(quot;Stopquot;)); btnStart.addActionListener(new Axn()); btnStop.addActionListener(new Axn()); c.add(quot;Northquot;, pnlPortInfo); c.add(quot;Centerquot;, pnlActions); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setSize(100, 100); setLocation(70, 70); setVisible(true); } // end cons class LookupServer implements Runnable { public void run() { try Page 72
  • 20. Building a Linux IPv6 DNS Server { int port; stopServer = false; String strPort = jtfPort.getText(); if(!strPort.equals(quot;quot;)) { port = Integer.parseInt(strPort); } else { port = 1234; } If (serverSok == null) { serverSok = new ServerSocket(port); } else { ; // do NOTHING } while(stopServer == false) { System.out.println(quot;Waiting....at 'quot; + port + quot;'quot;); Socket clientSok = serverSok.accept(); System.out.println(quot;Connected to: quot; + clientSok); PrintWriter toClient = new PrintWriter(clientSok.getOutputStream(), true); toClient.println(quot;Activequot;); Page 73
  • 21. Building a Linux IPv6 DNS Server toClient.flush(); clientSok.close(); } // end while } catch(Exception e) { System.out.println(quot;LookupServer: quot; + e); } } // end run } public class Axn implements ActionListener { public void actionPerformed(ActionEvent ae) { String strCmd = ae.getActionCommand(); try { if(strCmd.equals(quot;Startquot;)) { if(lookupSvr == null) { lookupSvr = new Thread(new LookupServer()); lookupSvr.start(); } else { System.out.println(quot;Already Running!!!!quot;); Page 74
  • 22. Building a Linux IPv6 DNS Server } } else if(strCmd.equals(quot;Stopquot;)) { stopServer = true; serverSok.close(); serverSok = null; lookupSvr = null; System.gc(); System.out.println(quot;Stopped!!quot;); } // end if } catch(Exception e) { System.out.println(e); } // end try-catch } // end action } // end Axn public static void main(String [] args) { new LookUpServerGUI(quot;Lookup Serverquot;); } } // end LookUpServerGUI /* LookUpClientGUI */ Page 75
  • 23. Building a Linux IPv6 DNS Server import java.io.*; import java.net.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class LookUpClientGUI extends JFrame { String host; int port; JTextField jtfHost, jtfPort; JPanel pnlHostInfo, pnl1, pnlActions; JFrame frame; Container c; TextField tfStatus; JButton btnLookup, btnClose; public LookUpClientGUI(String title) { c = getContentPane(); setTitle(title); frame = this; pnlHostInfo = new JPanel(); pnlHostInfo.setLayout(new BorderLayout()); pnl1 = new JPanel(); pnl1.setLayout(new GridLayout(2, 2)); pnl1.add(new JLabel(quot;Host: quot;)); pnl1.add(jtfHost = new JTextField(15)); Page 76
  • 24. Building a Linux IPv6 DNS Server pnl1.add(new JLabel(quot;Port: quot;)); pnl1.add(jtfPort = new JTextField(15)); pnlActions = new JPanel(); pnlActions.setLayout(new GridLayout(1, 2)); pnlActions.add(btnLookup = new JButton(quot;Lookupquot;)); btnLookup.addActionListener(new Axn()); pnlActions.add(btnClose = new JButton(quot;Closequot;)); btnClose.addActionListener(new Axn()); pnlHostInfo.add(quot;Centerquot;, pnl1); pnlHostInfo.add(quot;Southquot;, pnlActions); c.add(quot;Centerquot;, pnlHostInfo); c.add(quot;Southquot;, tfStatus = new TextField()); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setSize(200, 135); setLocation(70, 70); setVisible(true); } // end cons public class Axn implements ActionListener { public void actionPerformed(ActionEvent ae) { String strCmd = ae.getActionCommand(); if(strCmd.equals(quot;Lookupquot;)) { host = jtfHost.getText(); port = Integer.parseInt(jtfPort.getText()); Page 77
  • 25. Building a Linux IPv6 DNS Server new Thread(new LookupClient()).start(); } else if(strCmd.equals(quot;Closequot;)) { frame.dispose(); } } } // end Axn public void run() { try { Socket clientSok = new Socket(host, port); BufferedReader fromServer = new BufferedReader(new InputStreamReader(clientSok.getInputStream())); String answer = fromServer.readLine(); if(answer.equals(quot;Activequot;)) { System.out.println(quot;The Server is active...quot;); tfStatus.setText(quot;The Server is ACTIVE...quot;); } } catch(Exception e) { System.out.println(quot;Exception has come the server seems to be NOT ACTIVE..quot;); tfStatus.setText(quot;server seems to be NOT ACTIVE..quot;); } // end try-catch Page 78
  • 26. Building a Linux IPv6 DNS Server } // end run } // end LookupClient public static void main(String [] args) { new LookUpClientGUI(quot;Lookup Clientquot;); } } // end LookUpClientGUI /* DNSmain (Server Side) */ import java.awt.*; import javax.swing.*; import java.awt.event.*; public class DNSmain extends JFrame { JMenuBar mbar; JMenu mnuDNS, mnuHelp; JMenuItem jmi; JFrame frame; Container c; JDesktopPane jdp; public DNSmain(String title) { super(title); frame = this; Page 79
  • 27. Building a Linux IPv6 DNS Server c = getContentPane(); jdp = new JDesktopPane(); c.add(jdp); mbar = new JMenuBar(); mnuDNS = new JMenu(quot;DNSquot;); jmi = new JMenuItem(quot;Control Panelquot;, 'C'); jmi.setAccelerator(KeyStroke.getKeyStroke('C', java.awt.event.InputEvent.ALT_MASK)); jmi.addActionListener(new Axn()); mnuDNS.add(jmi); mnuDNS.addSeparator(); jmi = new JMenuItem(quot;IPv6 Addressquot;, 'I'); jmi.setAccelerator(KeyStroke.getKeyStroke('I', java.awt.event.InputEvent.ALT_MASK)); jmi.addActionListener(new Axn()); mnuDNS.add(jmi); jmi = new JMenuItem(quot;IPv4 Addressquot;, 'A'); jmi.setAccelerator(KeyStroke.getKeyStroke('A', java.awt.event.InputEvent.ALT_MASK)); jmi.addActionListener(new Axn()); mnuDNS.add(jmi); mnuDNS.addSeparator(); jmi = new JMenuItem(quot;Exitquot;, 'X'); jmi.setAccelerator(KeyStroke.getKeyStroke('X', java.awt.event.InputEvent.ALT_MASK)); jmi.addActionListener(new Axn()); mnuDNS.add(jmi); mnuHelp = new JMenu(quot;Helpquot;); Page 80
  • 28. Building a Linux IPv6 DNS Server jmi = new JMenuItem(quot;Contentsquot;, 'C'); jmi.setAccelerator(KeyStroke.getKeyStroke('C', java.awt.event.InputEvent.ALT_MASK)); jmi.addActionListener(new Axn()); mnuHelp.add(jmi); jmi = new JMenuItem(quot;Search...quot;, 'S'); jmi.setAccelerator(KeyStroke.getKeyStroke('S', java.awt.event.InputEvent.ALT_MASK)); jmi.addActionListener(new Axn()); mnuHelp.add(jmi); mnuHelp.addSeparator(); jmi = new JMenuItem(quot;Aboutquot;, 'A'); jmi.setAccelerator(KeyStroke.getKeyStroke('A', java.awt.event.InputEvent.ALT_MASK)); jmi.addActionListener(new Axn()); mnuHelp.add(jmi); mbar.add(mnuDNS); mbar.add(mnuHelp); setJMenuBar(mbar); setDefaultCloseOperation(0); addWindowListener(new WinLstner()); setLocation(50, 50); setSize(600, 500); setVisible(true); } // end cons class Axn implements ActionListener { Page 81
  • 29. Building a Linux IPv6 DNS Server public void actionPerformed(ActionEvent ae) { String cmdString = ae.getActionCommand(); if(cmdString.equals(quot;Exitquot;)) { int result = JOptionPane.showConfirmDialog(frame, quot;Do you Really want to quit?quot;, quot;Quitting?quot;, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if(result == JOptionPane.YES_OPTION) frame.dispose(); } else if(cmdString.equals(quot;Control Panelquot;)) { JInternalFrame jif = new DNSpanelIF(quot;DNS panelquot;); jdp.add(jif); } else if(cmdString.equals(quot;IPv6 Addressquot;)) { JInternalFrame jif = new Ipv6RecordAdderIF(quot;IPv6 DNS Recordsquot;); jdp.add(jif); } else if(cmdString.equals(quot;IPv4 Addressquot;)) { JInternalFrame jif = new Ipv4RecordAdderIF(quot;IPv4 DNS Recordsquot;); jdp.add(jif); } } // end action Page 82
  • 30. Building a Linux IPv6 DNS Server } // end Axn class WinLstner extends WindowAdapter { public void windowClosing(WindowEvent we) { int result = JOptionPane.showConfirmDialog(frame, quot;Do you Really want to quit?quot;, quot;Quitting?quot;, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if(result == JOptionPane.YES_OPTION) frame.dispose(); } } // end WinLstner public static void main(String [] args) { new DNSmain(quot;IPv6 ready DNSquot;); } // end main } // end DNSmain /* DNShandler */ import java.io.*; public class DNShandler { public void startDNS() { Page 83
  • 31. Building a Linux IPv6 DNS Server try { Runtime r = Runtime.getRuntime(); Process p = r.exec(quot;service named startquot;); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = quot;quot;; while((line = br.readLine()) != null) System.out.println(line); } catch(Exception e) { System.out.println(quot;startDNS:: quot; + e); } } public void stopDNS() { try { Runtime r = Runtime.getRuntime(); Process p = r.exec(quot;service named stopquot;); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = quot;quot;; while((line = br.readLine()) != null) System.out.println(line); } Page 84
  • 32. Building a Linux IPv6 DNS Server catch(Exception e) { System.out.println(quot;stopDNS:: quot; + e); } } public void reloadDNS() { try { Runtime r = Runtime.getRuntime(); Process p = r.exec(quot;service named reloadquot;); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = quot;quot;; while((line = br.readLine()) != null) System.out.println(line); } catch(Exception e) { System.out.println(quot;reloadDNS:: quot; + e); } } public static void main(String [] args) { new DNShandler().reloadDNS(); Page 85
  • 33. Building a Linux IPv6 DNS Server } // end main } // end DNShandler /* DNS Panel (Server side) */ import java.awt.*; import javax.swing.*; import java.awt.event.*; public class DNSpanel extends JFrame { JPanel pnlActions; JButton btnStart, btnStop, btnRestart, btnClose; JFrame frame; Container c; public DNSpanel(String title) { super(title); c = getContentPane(); frame = this; pnlActions = new JPanel(); pnlActions.setLayout(new GridLayout(2, 2)); pnlActions.add(btnStart = new JButton(quot;Startquot;)); pnlActions.add(btnStop = new JButton(quot;Stopquot;)); pnlActions.add(btnRestart = new JButton(quot;Restartquot;)); pnlActions.add(btnClose = new JButton(quot;Closequot;)); btnStart.addActionListener(new Axn()); btnStop.addActionListener(new Axn()); Page 86
  • 34. Building a Linux IPv6 DNS Server btnRestart.addActionListener(new Axn()); btnClose.addActionListener(new Axn()); c.add(pnlActions); setLocation(70, 70); setSize(200, 100); setVisible(true); } // end DNspanel class Axn implements ActionListener { public void actionPerformed(ActionEvent ae) { String strCommand = ae.getActionCommand(); if(strCommand.equals(quot;Startquot;)) { new DNShandler().startDNS(); } else if(strCommand.equals(quot;Stopquot;)) { new DNShandler().stopDNS(); } else if(strCommand.equals(quot;Restartquot;)) { new DNShandler().reloadDNS(); } else if(strCommand.equals(quot;Closequot;)) { frame.dispose(); Page 87
  • 35. Building a Linux IPv6 DNS Server } } // end action } // end Axn public static void main(String [] args) { new DNSpanel(quot;DNS panelquot;); } // end main } // end DNSpanel /* DNS panel IF (Internal Frame) */ import java.awt.*; import javax.swing.*; import java.awt.event.*; public class DNSpanelIF extends JInternalFrame { JPanel pnlActions; JButton btnStart, btnStop, btnRestart, btnClose; JInternalFrame frame; Container c; public DNSpanelIF(String title) { super(title); c = getContentPane(); frame = this; pnlActions = new JPanel(); Page 88
  • 36. Building a Linux IPv6 DNS Server pnlActions.setLayout(new GridLayout(2, 2)); pnlActions.add(btnStart = new JButton(quot;Startquot;)); pnlActions.add(btnStop = new JButton(quot;Stopquot;)); pnlActions.add(btnRestart = new JButton(quot;Restartquot;)); pnlActions.add(btnClose = new JButton(quot;Closequot;)); btnStart.addActionListener(new Axn()); btnStop.addActionListener(new Axn()); btnRestart.addActionListener(new Axn()); btnClose.addActionListener(new Axn()); c.add(pnlActions); setClosable(true); setResizable(true); setMaximizable(true); setIconifiable(true); setLocation(70, 70); setSize(200, 100); setVisible(true); } // end DNspanel class Axn implements ActionListener { public void actionPerformed(ActionEvent ae) { String strCommand = ae.getActionCommand(); if(strCommand.equals(quot;Startquot;)) { new DNShandler().startDNS(); } Page 89
  • 37. Building a Linux IPv6 DNS Server else if(strCommand.equals(quot;Stopquot;)) { new DNShandler().stopDNS(); } else if(strCommand.equals(quot;Restartquot;)) { new DNShandler().reloadDNS(); } else if(strCommand.equals(quot;Closequot;)) { frame.dispose(); } } // end action } // end Axn public static void main(String [] args) { new DNSpanelIF(quot;DNS panelquot;); } // end main } // end DNSpanelIF /* Ipv4RecordAdder */ import java.io.*; import java.net.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; Page 90
  • 38. Building a Linux IPv6 DNS Server public class Ipv4RecordAdder extends JFrame { String zoneFileName; String dnsDirectory = quot;/var/named/quot;; // DEFAULT DIRECTORY JTextField jtfDomainName, jtfHostName, jtfAddress; JButton btnAdd, btnClose; JPanel pnlActions, pnlCenter; JFrame frame; Container c; public Ipv4RecordAdder(String title) { super(title); frame = this; c = getContentPane(); pnlCenter = new JPanel(); pnlCenter.setLayout(new GridLayout(3, 2)); pnlCenter.add(new JLabel(quot;Domain Name : quot;)); pnlCenter.add(jtfDomainName = new JTextField()); pnlCenter.add(new JLabel(quot;Host Name : quot;)); pnlCenter.add(jtfHostName = new JTextField()); pnlCenter.add(new JLabel(quot;IPv4 Address: quot;)); pnlCenter.add(jtfAddress = new JTextField()); pnlActions = new JPanel(); pnlActions.setLayout(new GridLayout(1, 2)); pnlActions.add(btnAdd = new JButton(quot;Addquot;)); pnlActions.add(btnClose = new JButton(quot;Closequot;)); btnAdd.addActionListener(new Axn()); Page 91
  • 39. Building a Linux IPv6 DNS Server btnClose.addActionListener(new Axn()); c.add(quot;Centerquot;, pnlCenter); c.add(quot;Southquot;, pnlActions); setDefaultCloseOperation(1); setLocation(70, 70); setSize(280, 150); setVisible(true); } // end cons class Axn implements ActionListener { public void actionPerformed(ActionEvent ae) { String cmdString = ae.getActionCommand(); try { if(cmdString.equals(quot;Addquot;)) { String domainName = jtfDomainName.getText(); String zoneFileName = dnsDirectory + domainName + quot;.zonequot;; String hostName = jtfHostName.getText(); String ipAddress = jtfAddress.getText(); PrintWriter zoneFile = new PrintWriter(new FileOutputStream(zoneFileName, true)); zoneFile.println(hostName + quot;tINtAtquot; + ipAddress); System.out.println(quot;Record Added Successfully!!!!quot;); // Clear the TextFields Page 92
  • 40. Building a Linux IPv6 DNS Server jtfDomainName.setText(quot;quot;); jtfHostName.setText(quot;quot;); jtfAddress.setText(quot;quot;); zoneFile.close(); } else if(cmdString.equals(quot;Closequot;)) { frame.dispose(); } } catch(Exception e) { System.out.println(quot;Ipv4 Add: quot; + e); } // end try-catch } // end action } // end Axn public static void main(String [] args) { new Ipv4RecordAdder(quot;IPv4 Record Adder..quot;); } // end main } // end Ipv4RecordAdder /* Ipv4RecordAdderIF (Internal Frame) */ import java.io.*; import java.net.*; import java.awt.*; Page 93
  • 41. Building a Linux IPv6 DNS Server import javax.swing.*; import java.awt.event.*; public class Ipv4RecordAdderIF extends JInternalFrame { String zoneFileName; String dnsDirectory = quot;/var/named/quot;; // DEFAULT DIRECTORY JTextField jtfDomainName, jtfHostName, jtfAddress; JButton btnAdd, btnClose; JPanel pnlActions, pnlCenter; JInternalFrame frame; Container c; public Ipv4RecordAdderIF(String title) { super(title); frame = this; c = getContentPane(); pnlCenter = new JPanel(); pnlCenter.setLayout(new GridLayout(3, 2)); pnlCenter.add(new JLabel(quot;Domain Name : quot;)); pnlCenter.add(jtfDomainName = new JTextField()); pnlCenter.add(new JLabel(quot;Host Name : quot;)); pnlCenter.add(jtfHostName = new JTextField()); pnlCenter.add(new JLabel(quot;IPv4 Address: quot;)); pnlCenter.add(jtfAddress = new JTextField()); pnlActions = new JPanel(); pnlActions.setLayout(new GridLayout(1, 2)); Page 94
  • 42. Building a Linux IPv6 DNS Server pnlActions.add(btnAdd = new JButton(quot;Addquot;)); pnlActions.add(btnClose = new JButton(quot;Closequot;)); btnAdd.addActionListener(new Axn()); btnClose.addActionListener(new Axn()); c.add(quot;Centerquot;, pnlCenter); c.add(quot;Southquot;, pnlActions); setDefaultCloseOperation(1); setClosable(true); setResizable(true); setMaximizable(true); setIconifiable(true); setLocation(70, 70); setSize(280, 150); setVisible(true); } // end cons class Axn implements ActionListener { public void actionPerformed(ActionEvent ae) { String cmdString = ae.getActionCommand(); try { if(cmdString.equals(quot;Addquot;)) { String domainName = jtfDomainName.getText(); String zoneFileName = dnsDirectory + domainName + quot;.zonequot;; String hostName = jtfHostName.getText(); Page 95
  • 43. Building a Linux IPv6 DNS Server String ipAddress = jtfAddress.getText(); PrintWriter zoneFile = new PrintWriter(new FileOutputStream(zoneFileName, true)); zoneFile.println(hostName + quot;tINtAtquot; + ipAddress); System.out.println(quot;Record Added Successfully!!!!quot;); // Clear the TextFields jtfDomainName.setText(quot;quot;); jtfHostName.setText(quot;quot;); jtfAddress.setText(quot;quot;); zoneFile.close(); } else if(cmdString.equals(quot;Closequot;)) { frame.dispose(); } } catch(Exception e) { System.out.println(quot;Ipv4 Add: quot; + e); } // end try-catch } // end action } // end Axn public static void main(String [] args) { new Ipv4RecordAdderIF(quot;IPv4 Record Adder..quot;); } // end main } // end Ipv4RecordAdderIF Page 96
  • 44. Building a Linux IPv6 DNS Server /* Ipv6RecordAdder */ import java.io.*; import java.net.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class Ipv6RecordAdder extends JFrame { String zoneFileName; String dnsDirectory = quot;/var/named/quot;; // DEFAULT DIRECTORY JTextField jtfDomainName, jtfHostName, jtfAddress; J Button btnAdd, btnClose; JPanel pnlActions, pnlCenter; JFrame frame; Container c; public Ipv6RecordAdder(String title) { super(title); frame = this; c = getContentPane(); pnlCenter = new JPanel(); pnlCenter.setLayout(new GridLayout(3, 2)); pnlCenter.add(new JLabel(quot;Domain Name : quot;)); pnlCenter.add(jtfDomainName = new JTextField()); Page 97
  • 45. Building a Linux IPv6 DNS Server pnlCenter.add(new JLabel(quot;Host Name : quot;)); pnlCenter.add(jtfHostName = new JTextField()); pnlCenter.add(new JLabel(quot;IPv6 Address: quot;)); pnlCenter.add(jtfAddress = new JTextField()); pnlActions = new JPanel(); pnlActions.setLayout(new GridLayout(1, 2)); pnlActions.add(btnAdd = new JButton(quot;Addquot;)); pnlActions.add(btnClose = new JButton(quot;Closequot;)); btnAdd.addActionListener(new Axn()); btnClose.addActionListener(new Axn()); c.add(quot;Centerquot;, pnlCenter); c.add(quot;Southquot;, pnlActions); setDefaultCloseOperation(1); setLocation(70, 70); setSize(280, 150); setVisible(true); } // end cons class Axn implements ActionListener { public void actionPerformed(ActionEvent ae) { String cmdString = ae.getActionCommand(); try { if(cmdString.equals(quot;Addquot;)) { String domainName = jtfDomainName.getText(); Page 98
  • 46. Building a Linux IPv6 DNS Server String zoneFileName = dnsDirectory + domainName + quot;.zonequot;; String hostName = jtfHostName.getText(); String ipAddress = jtfAddress.getText(); PrintWriter zoneFile = new PrintWriter(new FileOutputStream(zoneFileName, true)); zoneFile.println(hostName + quot;ttINtAAAAtquot; + ipAddress); System.out.println(quot;Record Added Successfully!!!!quot;); // Clear the TextFields jtfDomainName.setText(quot;quot;); jtfHostName.setText(quot;quot;); jtfAddress.setText(quot;quot;); zoneFile.close(); } else if(cmdString.equals(quot;Closequot;)) { frame.dispose(); } } catch(Exception e) { System.out.println(quot;Ipv6 Add: quot; + e); } // end try-catch } // end action } // end Axn public static void main(String [] args) { Page 99
  • 47. Building a Linux IPv6 DNS Server new Ipv6RecordAdder(quot;IPv6 Record Adder..quot;); } // end main } // end Ipv6RecordAdder /* Ipv6RecordAdderIF (Internal Frame) */ import java.io.*; import java.net.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class Ipv6RecordAdderIF extends JInternalFrame { String zoneFileName; String dnsDirectory = quot;/var/named/quot;; // DEFAULT DIRECTORY JTextField jtfDomainName, jtfHostName, jtfAddress; JButton btnAdd, btnClose; JPanel pnlActions, pnlCenter; JInternalFrame frame; Container c; public Ipv6RecordAdderIF(String title) { super(title); frame = this; c = getContentPane(); pnlCenter = new JPanel(); pnlCenter.setLayout(new GridLayout(3, 2)); Page 100
  • 48. Building a Linux IPv6 DNS Server pnlCenter.add(new JLabel(quot;Domain Name : quot;)); pnlCenter.add(jtfDomainName = new JTextField()); pnlCenter.add(new JLabel(quot;Host Name : quot;)); pnlCenter.add(jtfHostName = new JTextField()); pnlCenter.add(new JLabel(quot;IPv6 Address: quot;)); pnlCenter.add(jtfAddress = new JTextField()); pnlActions = new JPanel(); pnlActions.setLayout(new GridLayout(1, 2)); pnlActions.add(btnAdd = new JButton(quot;Addquot;)); pnlActions.add(btnClose = new JButton(quot;Closequot;)); btnAdd.addActionListener(new Axn()); btnClose.addActionListener(new Axn()); c.add(quot;Centerquot;, pnlCenter); c.add(quot;Southquot;, pnlActions); setClosable(true); setResizable(true); setMaximizable(true); setIconifiable(true); setDefaultCloseOperation(1); setLocation(70, 70); setSize(280, 150); setVisible(true); } // end cons class Axn implements ActionListener { public void actionPerformed(ActionEvent ae) Page 101
  • 49. Building a Linux IPv6 DNS Server { String cmdString = ae.getActionCommand(); try { if(cmdString.equals(quot;Addquot;)) { String domainName = jtfDomainName.getText(); String zoneFileName = dnsDirectory + domainName + quot;.zonequot;; String hostName = jtfHostName.getText(); String ipAddress = jtfAddress.getText(); PrintWriter zoneFile = new PrintWriter(new FileOutputStream(zoneFileName, true)); zoneFile.println(hostName + quot;ttINtAAAAtquot; + ipAddress); System.out.println(quot;Record Added Successfully!!!!quot;); // Clear the TextFields jtfDomainName.setText(quot;quot;); jtfHostName.setText(quot;quot;); jtfAddress.setText(quot;quot;); zoneFile.close(); } else if(cmdString.equals(quot;Closequot;)) { frame.dispose(); } } catch(Exception e) Page 102
  • 50. Building a Linux IPv6 DNS Server { System.out.println(quot;Ipv6 Add: quot; + e); } // end try-catch } // end action } // end Axn public static void main(String [] args) { new Ipv6RecordAdderIF(quot;IPv6 Record Adder..quot;); } // end main } // end Ipv6RecordAdderIF /* Address Handler (Server Side) */ import java.io.*; import java.net.*; public class AddressHandler { public AddressHandler() { try { // System.out.println(Inet6Address().numericToTextForm at()); ServerSocket sok = new ServerSocket(2995); System.out.println(quot;Server Ready!!!quot;); Socket client = sok.accept(); Page 103
  • 51. Building a Linux IPv6 DNS Server System.out.println(client); BufferedReader br = new BufferedReader(new InputStreamReader(client.getInputStream())); String line = br.readLine(); System.out.println(quot;Client has sent...quot; + line); } catch(Exception e) { System.out.println(e); } // end try-catch } // end cons public static void main(String [] args) { new AddressHandler(); } } /* Client (Client Side) */ import java.io.*; import java.net.*; public class Client { public Client(String host, int port) { try { System.out.println(Inet6Address().numericToTextFormat()); Page 104
  • 52. Building a Linux IPv6 DNS Server Socket sok = new Socket(host, port); System.out.print(quot;Enter some text: quot;); String line = new BufferedReader(new InputStreamReader(System.in)).readLine(); PrintWriter out = new PrintWriter(sok.getOutputStream()); out.println(line); out.flush(); } catch(Exception e) { System.out.println(e); } // end try-catch } // end cons public static void main(String [] args) { new Client(args[0], Integer.parseInt(args[1])); } } Page 105
  • 53. Building a Linux IPv6 DNS Server /* A Typical view of Named.conf Configuration file */ ## named.conf - configuration for bind # # Generated automatically by redhat-config-bind, alchemist et al. # Any changes not supported by redhat-config-bind should be put # in /etc/named.custom # controls { inet 127.0.0.1 allow { localhost; } keys { rndckey; }; }; include quot;/etc/named.customquot;; include quot;/etc/rndc.keyquot;; #options { # listen-on-v6 { any; }; #}; zone quot;localhostquot; { type master; file quot;localhost.zonequot;; }; zone quot;mahendra.comquot; { type master; file quot;mahendra.com.zonequot;; }; Page 106
  • 54. Building a Linux IPv6 DNS Server /* A Typical view of mahendra.com.zone Configuration file */ $TTL 86400 @ IN SOA localhost. root.localhost ( 5 ; serial 28800 ; refresh 7200 ; retry 604800 ; expire 86400 ; ttl ) IN NS localhost. sky IN MX 1 192.168.5.1 sky IN A 192.168.5.1 mahendra.com IN CNAME admin.mahendra.com. host1 IN AAAA fe80::200:1cff:fe81:e1d0 redhat1 IN AAAA fe80::200:1cff:fe81:e1d0 penguin IN AAAA fe80::200:1cff:fe81:e1d0 node 2 IN A 192.168.5.4 node 1 IN A 192.168.5.3 Page 107