DHCP configuration: Automatically Obtaining IP addresses in linux and windows

Source: Internet
Author: User

DHCP Configuration: automatically obtain IP addresses for linux and windows I. Prepare for the experiment 1. Check whether dhcp is installed [root @ vm2 root] # rpm-qa | grep dhcp [root @ vm2 root] # // [root @ vm2 root] # cd/home [root @ vm2 root] # ls // upload dhcp to the home Directory dhcp-3.0pl1-23.i386.rpm yanji 2. Install dhcp [root @ vm2 root # rpm-ivh dhcp-3.0pl1-23.i386.rpmwarning: dhcp-3.0pl1-23.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60ePreparing... ########################### ############### [100%] 1: dhcp ####################################### #### [100%] [root @ vm2 root] # rpm-ivh dhcp-devel-3.0pl1-23.i386.rpmwarning: dhcp-devel-3.0pl1-23.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60ePreparing... ######################################## ### [100%] 1: dhcp-devel ##################################### ###### [100%] [root @ vm2 root] # // dhcp is installed. 2. Experiment DHCP Server Configuration: 1. Configure dhcp [r Oot @ vm2 root] # ifconfig eth0 up // activate eth0 Nic [root @ vm2 root] # chkconfig -- level 2345 network on // set the default value for network services when the system startup level is 2345 start [root @ vm2 root] # ntsysv // boot automatically start dhcp Service [root @ vm2 root] # vi/etc/sysconfig/network-scripts/ifcfg-eth0 [root @ vm2 root] # cat/etc/sysconfig/network-DEVICE = eth0BOOTPROTO = dhcpIPADDR = 192.168.248.3NETMASK = 255.255.255.0ONBOOT = yesUSERCTL = noPEERDNS = noTYPE = EthernetNETWORK = 192.168.248.0BROADCAST = 192.168.248.255 [root @ vm2 root] # // modify the ifcfg-eth0 file and set the ONBOOT value to yes for the Network Service to use the NIC when it starts. Set the value of BOOTPROTO to dhcp so that the NIC can automatically obtain the IP address from the DHCP server. 2. view the dhcpd configuration file template [root @ vm2 root] # cp/usr/share/doc/dhcp-3.0pl1/dhcpd. conf. sample/etc/dhcpd. conf // copy the configuration TEMPLATE 3. The configuration file/etc/dhcpd. the linux host ip address is eth0: 192.168.248.3 [root @ vm2 root] # vi/etc/dhcpd. conf // configure [root @ vm2 root] # cat/etc/dhcpd. confddns-update-style interim; ignore client-updates; subnet 192.168.248.0 netmask 255.255.255.0 {# --- default gateway option routers 192.168.248.3; option subnet-mask Optional values 255.0; option time-offset 28800; # Eastern Standard Time range dynamic-bootp 192.168.248.80 192.168.248.180; default-lease-time 21600; max-lease-time 43200; host ns {next-server marvin.redhat.com; hardware ethernet 12: 34: 56: 78: AB: CD; fixed-address 192.168.248.3 ;}} [root @ vm2 root] # [root @ vm2 root] # service dhcpd restart ??? Dhcpd ?? [???] ??? Dhcpd ?? [???] [Root @ vm2 root] # // restart the dhcp service for the change to take effect. [Root @ vm2 root] # ps-ef | grep dhcpdroot 4154 1 0? 00:00:00/usr/sbin/dhcpdroot 4200 4159 0 00:00:00 pts/0 grep dhcpd [root @ vm2 root] # // use the ps command to check the DHCP Client configuration of the dhcpd process: 1. Open the network connection and set the VMnet8 attribute to automatically obtain the IP address. 2. Open the doscommand window and use ipconfig to view the VMnet8 IP address, we can see that the VMnet8 IP address is not the original 192.168.248.1 but the new automatically obtained IP address 192.168.248.180, And the subnet mask is 255.255.255.0. The default gateway is 192.168.248.3. At the same time, VMnet8 is changed from "Unknown network" to "Network 2": C: \ Users \ Administrator. PC-20120409FFJD> ipconfig Windows IP configure Ethernet Adapter local connection: Connection specific DNS suffix .......: IPv4 address ............: 10.1.194.203 subnet mask ............: 201710000224.0 Default Gateway .............: 10.1.192.1 Ethernet Adapter VMware Network Adapter VMnet8: Connection-specific DNS suffix .......: IPv4 address ............: 192.168.248.180 subnet mask ........ ....: 255.255.255.0 Default Gateway .............: 192.168.248.3 // configuration completed 3. Experiment Summary 1. Modify/etc/dhcpd. in the "option routers" under the conf file, it is unclear why the IP address should be set. I tried to set it to 192.168.248.2, and the result is still connectable, however, based on the success of the experiment, I wonder if the route selection must be the IP address of the vm2 virtual machine. 2. This is an experiment on Automatically Obtaining ip addresses from linux vm2 virtual machines and windows hosts.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.