04 Activity Configure Nic And Dhcp Linux

  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View 04 Activity Configure Nic And Dhcp Linux as PDF for free.

More details

  • Words: 1,049
  • Pages: 9
Network Development Install and maintain a server/Build an intranet

Information Technology

Blacktown College

Basic configuration on NIC and DHCP using configuration Files

Document Information Document Owner: WSI-14-45

File Location: /home/sking1/Documents/20092/02_Classes/01_NetDev/Weeks_0109/Week_04/04_Activity_Configure-NIC-andDHCP_Linux.odt

Created: 11 Aug 2008

Modified: 10. Aug. 2009

Author: Stephen King

Page Count: 9

Version:

Revision History Revision #

Revision Date

Description of Modification

Modified by

● ● ● ● ●

Copyright Copyright © 2008, NSW Department of Education and Training (TAFE). The reproduction, photocopying, storing on a retrieval system, or transmitting of this manual is protected under a Creative Commons Attribution-NonCommerical-ShareAlike 2.5 license. You are free to share (copy, distribute, display. and perform the work) and to remix (make derivative works) under the following conditions: ●

you must attribute the work in the manner specified by the author or licensor,



you many not use this work for commercial purposes.

In addition, if you alter, transform, or build upon this work, ●

you may distribute the result work only under a license identical to this one.

http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode.

Table of Contents Document Information..............................................................................................2 Revision History.........................................................................................................2 Copyright...................................................................................................................2 Objectives........................................................................................................................................5 Prerequisites.....................................................................................................................................5 Resources.........................................................................................................................................5 VM Information....................................................................................................................................6 Virtual Machine Settings............................................................................................................6 Interface Configuration...............................................................................................................6 User Configuration......................................................................................................................6 Services Configuration................................................................................................................6 Before You Begin.......................................................................................................................6 Activities ..............................................................................................................................................7 Configuring NIC using config file...................................................................................................7 Activity start................................................................................................................................7 Configuring basic a DHCP server using config file........................................................................9 Self Guided.................................................................................................................................9

Blacktown College - Information Technology NetDev: Install & maintain a server/Build and intranet

Objectives These activites are designed to allow you to configure 2 basic services using CLI (Command Line Interface) tools.

Prerequisites NA.

Resources You will require the following: ●

Copy of SLES10-Base Virtual Machine

Copyright © Department of Education and Training, 2008

5 of 9

Blacktown College - Information Technology NetDev: Install & maintain a server/Build and intranet

VM Information The virtual machine for this exercise has the following configuration:

Virtual Machine Settings Memory:

512

CD-ROM:

Auto

Ethernet:

Host Only

USB Controller:

Present

Vmware Tools:

Installed

Interface Configuration IP Address:

192.168.10.1

Netmask:

255.255.255.0

Host Name:

svr1

Domain Name:

sample.com

Name Server:

192.168.10.1

Default Gateway:

192.168.10.254

User Configuration Two users have been created: Username

Password

root

secret

student

password

Services Configuration <What services have been configured> Nil

Before You Begin ● ●

Ensure you point the CD-ROM to the SLES ISO Copy any current configuration files and give the copy the extension .orig

Copyright © Department of Education and Training, 2008

6 of 9

Blacktown College - Information Technology Basic NIC and DHCP configuration in Linux

Activities Configuring NIC Using Config File In this activity we will use a terminal and the editor, joe, to create a configuration file for our network interface. We will then restart the network service so that the new configuration will be used. For this activity, use the following: Server IP: 10.10.10.1 Netmask: 255.255.255.224 Default Gateway: 10.10.10.30 Host Name: svr2 Domain Name: example.com Domain Name Server: 10.10.10.1

Activity Start 1. As we are logged in as a non-privilaged user, we need to switch user to the privilaged, root user. su password: secret 2. We already have a valid interface configuration file from the previous activity, so we are going to move it to a different location. a) cd /etc/sysconfig/network b) ls -l c) You should see a file with a name similar to: ifcfg-eth-id-00:0c:29:31:35:79 This is the config file for the interface. It is best to use tab completion for the next command. This symbol ---> means press the tab key. d) Use the following command to move the config file to /home/ mv ifcfg-eth-id---->

/home/

e) Use joe to create and open a new configuration file: joe ifcfg-eth0 f) You should now have a blank file open. Type in the field shown on the next page. Note the relationship to the information provided at the beginning of this activity.

7 of 9

04_Activity_Configure-NIC-and-DHCP_Linux

Blacktown College - Information Technology NetDev: Install & maintain a server/Build and intranet

STARTMODE=auto BOOTPROTO=static IPADDR= 10.10.10.1 NETMASK=255.255.255.224 USERCONTROL=no g) Now use CTRL+K+X to save the file and exit from joe. 3. We now need to change the hostname: a) From the command prompt type: echo svr2>/etc/HOSTNAME b) And then use the following command to reload hostname file /bin/hostname -F /etc/HOSTNAME The hostname will change when you shut down and re-enter the terminal 4. Once hostname has been set, we need to change the domain name server IP. Note- this command is typed on a single line. echo “nameserver 10.10.10.1”>/etc/resolv.conf 5. Now we need to restart the network service. Use the following command: service network restart 6. We need to define the default gateway. To do this we need to put the IP address of the default gateway into a file named routes that is located in /etc/sysconfig/network. To do this use the following command: echo 10.10.10.30>/etc/sysconfig/network/routes You can use the route command to check the default gateway for this device. 7. Use the ifconfig and ip address show commands from activity 1.1 to check interface configuration. End of Activity

Copyright © Department of Education and Training, 2008

8 of 9

Blacktown College - Information Technology Basic NIC and DHCP configuration in Linux

Configuring Basic A DHCP Server Using Config File First we will rename the original configuration file for DHCP: mv /etc/dhcpd.conf /etc/dhcpd.conf.old 1. Now we will use the editor, joe, to create a new dhcpd.conf file: joe /etc/dhcpd.conf 2. You will now have an empty text file open. Type the following. It is a good idea to indent sections of this file as it will make it easier to read when the configuration becomes more complex. ddns-update-style interim; ignore client-updates; subnet 10.10.10.0 netmask 255.255.255.224{ range 10.10.10.15 10.10.10.25; option domain-name “example.com”; option domain-name-servers 10.10.10.1; option routers 10.10.10.30; } 3. Now use CTRL+K+X to save the file and exit from joe. 4. You will now need to use joe to edit the file /etc/sysconfig/dhcpd 1. Locate the lne: DHCPD_INTERACE= 2. Enter eth0 after the = sign. 3. Use CTRL+K+X to save and exit from the file 5. Restart the DHCP service: service dhcpd restart 6. You may need to create a file for the leases to be written to: touch /var/lib/dhcp/db/dhcpd.leases.

Self Guided Using the command man dhcpd.conf see if you can add in some reservations and exclusions to your DHCP configuration (to exit from the man page, press the q key ). What other configurations can be made using DHCP? Try some.

9 of 9

04_Activity_Configure-NIC-and-DHCP_Linux

Related Documents