I. Experiment Topology
Rhel6.5
-------------- Rhel6.5 server (vmnet4) ------------- rhel6.5 client (vmnet4)
Prepare the network service lab environment
1. install two rhel6.5 virtual machines
1) Memory 1 GB, hard disk 80 GB, software package (desktop, development tools)
2) disable the firewall and SELinux Mechanism
Tip: Modify/etc/SELinux/config and set SELinux = permissive.
Getenforce, setenforce
3) install vmware-Tools
Tip: C: \ Program Files (x86) \ VMware Workstation \ Linux. ISO
4) network configuration: vmnet4, svr5.tarena.com 192.168.4.5/24
Tip: Disable the NetworkManager service.
Modify the ifcfg-eth0 file, onboot = Yes, nm_controled = No
5) configure the yum repository to ensure availability
[[Email protected] ~] # Vim/etc/yum. Repos. d/rhel6.repo
[RHEL-packages]
Name = rhel6
Baseurl = file: // MISC/CD
Enabled = 1
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-GPG-key-RedHat-release
Tutorial procedure:
1. Set the IP address of the server
[[Email protected] ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth0// Set the Server IP Address
# Intel Corporation 82545em Gigabit Ethernet controller (copper)
Device = eth0
Bootproto = none
Onboot = Yes
Hwaddr = 00: 0C: 29: 5D: A8: 80
Ipaddr = 192.168.4.5
Prefix = 24
[[Email protected] ~] # Cat/etc/sysconfig/Network// Set the Server Gateway
Networking = Yes
Networking_ipv6 = Yes
Hostname‑ser5.tar ena.com// Host name
Gateway = 192.168.1.254
[[Email protected] ~] # Cat/etc/resolv. conf// Set the DNS server address
Search tarena.com
Nameserver 202.106.0.20, 8.8.8.8
[[Email protected] ~] # Service network restart// Restart the network service
[[Email protected] ~] # Chkconfig network on// Start the network
Note: In Red Hat Enterprise 5.10, changing the host name takes effect immediately. I wonder why the host name takes effect only after the host name is restarted in 6.5.
Verification:
[[Email protected] ~] # Ifconfig eth0// Check whether the IP address is correct
[[Email protected] ~] # Route-n// Check whether the gateway is enabled
[[Email protected] ~] # Hostname// Check whether the host name is correct
2. install the software package
[[Email protected] ~] # Rpm-Q DHCP// Check whether DHCP is installed
[[Email protected] ~] # Yum-y install DHCP// Install DHCP
[[Email protected] ~] # Rpm-Q DHCP
Dhcp-3.0.5-31.el5_8.1
3. modify the configuration file
Note: DHCP master configuration file template location/usr/share/doc/DHCP-*/DHCPD. conf. Sample
[[Email protected] ~] # Vim/etc/DHCPD. conf// Configure the DHCP address pool, gateway, DNS, and address
1 ddns-Update-style none;
2 default-lease-time 21600;// Default lease period
3 max-lease-time 43200;// Maximum lease period
4 Option subnet-mask limit 255.0;// Subnet Mask
5 option domain-name "tarena.com ";// Domain Name
6 Option domain-name-servers 202.106.0.20, 8.8.8.8;// DNS server address
7 subnet 192.168.1.0 netmask 255.255.255.0 {// Declare the CIDR Block
8 option routers 192.168.1.254;// Default gateway address
9 range dynamic-BOOTP 192.168.1.10 192.168.1.20;// Ip address allocation range
}
10 host pc205 {// Set the reserved address and recognize the name
11 hardware Ethernet 00: 0C: 30: E1: F5: 25;// Client MAC address
12 fixed-address 192.168.4.250;// Fixed IP Address
13}
4. Start the service
[[Email protected] ~] # Rpm-ql dhcp | grep init. d// View the service name
/Etc/rc. d/init. d/DHCPD
/Etc/rc. d/init. d/dhcrelay
[[Email protected] ~] # Service DHCPD restart// Restart the DHCP service
[[Email protected] ~] # Chkconfig DHCPD on// Set the DHCP service to automatically start upon startup
5. Verify
Linux:
# Dhclient-D eth0// Temporary access
# Dhclient-r eth0// Release
Windows:
Start> RUN> cmd> ipconfig/release// Release the IP address
Start> RUN> cmd> ipconfig/Renew// Obtain the IP address again
Restrict listening interfaces:
[[Email protected] ~] # Vim/etc/sysconfig/DHCPD
Dhcpdargs = "eth1"