Linux Basic Network Configuration
2 experimental Environment:
The company requires that an idle Linux host be configured as a DHCP service to provide automatic assignment of IP address services to employees ' office computers in the LAN, and improve network management and maintenance efficiency. Two windows host tests.
2 Requirements Description:
? The host name of the DPCH server is Dhcpsvr.benet.com,ip address is 192.168.4.11/24
? Used to automatically assign the IP address range to 192.168.4.20~192.168.4.200 for each host in the LAN.
? The default gateway for each host in LAN is 192.168.4.1.
? The host names of the DNS server addresses for the 192.168.4.2 and 192.168.4.3.DNS servers used by each host on the LAN are ns1.benet.com and ns2.benet.com respectively.
? Network printer device (can find another Windows host in the network, perform Ipconfig/all view MAC address) host name is PRTSVR, require automatic allocation of fixed IP address 192.168.4.9
Experimental steps:
L DPCH Server host name Dhcpsvr.benet.com,ip address is 192.168.4.11/24
Let's start with the first step, changing the hostname and permanent IP address of the Linux server
650) this.width=650; "title=" clip_image003 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image003 "src=" http://s3.51cto.com/wyfs02/M01/77/AC/ Wkiom1zrf8ez60ipaaafz6-cut0509.jpg "644" height= "/>"
Figure 1
650) this.width=650; "title=" clip_image005 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image005 "src=" http://s3.51cto.com/wyfs02/M00/77/AB/ Wkiol1zrf8rdbre1aaap1eszsca219.jpg "" 644 "height="/>
Figure 2
After you delete the = number, enter the hostname you want to enter to save and exit. Hostname should be finished, but also need to restart the network card service, here we do not restart, we changed the IP address after the restart.
650) this.width=650; "title=" clip_image007 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image007 "src=" http://s3.51cto.com/wyfs02/M01/77/AB/ Wkiol1zrf8vq-jpsaaapbwsg2-o534.jpg "644" height= "/>"
Figure 3
650) this.width=650; "title=" clip_image009 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image009 "src=" http://s3.51cto.com/wyfs02/M01/77/AB/ Wkiol1zrf8zdi32laabzmsikywi349.jpg "" 644 "height=" 241 "/>
Figure 4
Above is the basic information of the network card, if your profile is missing one of them, add it manually, note must be capitalized
Note: BOOTPROTO=DHCP is automatically acquired and, if required, we want to change to static.
If you use dynamic addresses, all of the files you changed above are useless.
650) this.width=650; "title=" clip_image011 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image011 "src=" http://s3.51cto.com/wyfs02/M02/77/AC/ Wkiom1zrf8vawhe9aabbe53kth4021.jpg "" 644 "height=" 118 "/>
Figure 5
After the NIC service restarts, let's see if it's successful. If the restart network card does not take effect, we can restart the host, it will be effective.
? Used to automatically assign the IP address range 192.168.4.20~192.168.4.200 to each host in the LAN. The default gateway for each host in the LAN is 192.168.4.1. The DNS server addresses used by each host on the LAN are 192.168.4.2 and 192.168.4.3.
We have to make these experiments together, or one effect is not very good
To implement the above, you need to install the DHCP service installation package in the rhel5.2 installation CD. We insert the disc.
Mount the disc to media
650) this.width=650; "title=" clip_image013 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image013 "src=" http://s3.51cto.com/wyfs02/M02/77/AB/wKioL1Zrf86SHG_ Raaaal-ns6bk159.jpg "" 644 "height="/>
Figure 6
Path in/media/server/
installation is possible.
A master configuration file is generated when the installation is complete/etc/dhcpd.conf
We can modify this master configuration file to do the DHCP service to dynamically assign the address.
650) this.width=650; "title=" clip_image015 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image015 "src=" http://s3.51cto.com/wyfs02/M00/77/AC/ Wkiom1zrf8yd8zegaabeerpg7xk597.jpg "" 644 "height=" 154 "/>
Figure 7
Linux Network Service basically each software will have a template file, as long as we will modify this file, we can build services, and start the service.
650) this.width=650; "title=" clip_image017 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image017 "src=" http://s3.51cto.com/wyfs02/M00/77/AB/wKioL1Zrf8_ Ithcgaaauygawyhe069.jpg "" 644 "height="/>
Figure 8
R copy Copies the contents of this template file into the main configuration file, deleting comments and blank lines. Make changes
650) this.width=650; "title=" clip_image019 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image019 "src=" http://s3.51cto.com/wyfs02/M01/77/AC/ Wkiom1zrf8-chb61aadtc378o1o333.jpg "" 644 "height=" 357 "/>
Figure 9
We are modified after the middle of the space, can be deleted, I was to explain deliberately.
L Network printer Device (can find another Windows host within the network, perform Ipconfig/all view MAC address) host name is PRTSVR, require automatic allocation of fixed IP address 192.168.4.9
We did not make reservations just now, let's do it, open a WinXP change the hostname, Windows change the hostname I believe everyone will.
650) this.width=650; "title=" clip_image021 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image021 "src=" http://s3.51cto.com/wyfs02/M02/77/AB/ Wkiol1zrf9kc8oxzaabdkvl6rpo490.jpg "" 644 "height=" 102 "/>
Figure 10
Under the global configuration, there is a host NS record where the reserved address can be configured and we need the MAC address of XP
is not modified yet, let's change it now
Enter Ipconfig/all on XP to see the physical address of the NIC.
650) this.width=650; "title=" clip_image023 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image023 "src=" http://s3.51cto.com/wyfs02/M00/77/AB/ Wkiol1zrf9txj8raaaa2dreymkw046.jpg "" 644 "height=" "The/>
Figure 11
To enter a good reserved address
We save the exit and start the DHCPD service to provide the service.
650) this.width=650; "title=" clip_image025 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image025 "src=" http://s3.51cto.com/wyfs02/M01/77/AB/ Wkiol1zrf9xbb5reaaaodihqi-0135.jpg "" 644 "height="/>
Figure 12
Service has started, if the service can not start, 80 is a configuration file error, there is the IP address does not take effect.
Now the network card is changed to VM1 XP to automatically get the IP address, XP is now a printer, not a normal client, testing the printer after the success of our normal client testing
Virtual machine Note Close Virtual DHCP assignment address
650) this.width=650; "title=" clip_image027 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image027 "src=" http://s3.51cto.com/wyfs02/M02/77/AC/ Wkiom1zrf9stwezlaacd1zypdj4598.jpg "" 434 "height=" 399 "/>
Figure 13
Successfully acquired.
We are opening an XP or Win7 for testing
650) this.width=650; "title=" clip_image029 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image029 "src=" http://s3.51cto.com/wyfs02/M02/77/AB/ Wkiol1zrf9ig0m0paaeb6sfe-2q820.jpg "" "height=" 484 "/>
Figure 14
The WIN7 client obtains the network information, which is assigned from the back to the beginning
We are opening a Linux client for DHCP dynamic acquisition and a look at the lease process
650) this.width=650; "title=" clip_image031 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image031 "src=" http://s3.51cto.com/wyfs02/M00/77/AC/ Wkiom1zrf9axuwakaaaznw59i0i801.jpg "" 644 "height=" 129 "/>
Figure 15
Modify the IP configuration file to do so.
Change the NIC to vm1 restart the NIC service.
650) this.width=650; "title=" clip_image033 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image033 "src=" http://s3.51cto.com/wyfs02/M02/77/AC/ Wkiom1zrf9jqduo4aacrgzh3hro949.jpg "" 644 "height=" 155 "/>
Figure 16
Get to the
Let's take a look at the lease process
650) this.width=650; "title=" clip_image035 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image035 "src=" http://s3.51cto.com/wyfs02/M00/77/AC/ Wkiom1zrf9ngcpizaaczmnub-hc469.jpg "" 644 "height=" 223 "/>
Figure 17
We saw the past process and the packages sent each step, as well as getting the IP address.
The Book of experimental cases we finished, the book recommended test steps, more cumbersome, and we do not have a DNS server so, I did not follow the steps of the book. Now we're done with the after-school experiment.
650) this.width=650; "title=" clip_image001 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image001 "src=" http://s3.51cto.com/wyfs02/M01/77/AC/ Wkiom1zrf9rtqcavaaactxu8pnc168.gif "" "height=" "/>" test requirements
1, the DHCP server network card type is set to VM1, the IP address is permanently set to 192.168.4.100, the host name is dhcpd.benet.com.
2. Set the address pool range to 192.168.4.10-192.168.4.150, the gateway to the 192.168.4.1,DNS server address is 202.106.0.20 and 202.106.148.1, set the reserved address for XP clients to 192.168.4.20.
3, with the host (native) as a client, to see if the VM1 network card can automatically obtain an IP address, the other options are correct? Does the XP client get a reserved address? (Note that turning off the virtual machine comes with the DHCP feature)
4. After restarting the DHCPD service, check whether the DHCPD service port is successfully opened to view the lease file.
In fact, after the experiment, far from the experimental case good, here we also do a bit.
L Experimental steps:
1, the DHCP server network card type is set to VM1, the IP address is permanently set to 192.168.4.100, the host name is dhcpd.benet.com.
650) this.width=650; "title=" clip_image037 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image037 "src=" http://s3.51cto.com/wyfs02/M01/77/AC/wKiom1Zrf9vgeI1_ Aabxej418o8269.jpg "" 644 "height=" 232 "/>
Figure 18
When modifying an IP address, be sure to modify the network segment, subnet mask, broadcast address.
650) this.width=650; "title=" clip_image039 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image039 "src=" http://s3.51cto.com/wyfs02/M02/77/AC/ Wkiom1zrf9yh46aqaaatbx7hevy028.jpg "" 644 "height="/>
Figure 19
Modify host name, path is/etc/sysconfig/network
After the change has been restarted, no restart will not take effect, the experimental case we have done.
650) this.width=650; "title=" clip_image041 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image041 "src=" Http://s3.51cto.com/wyfs02/M00/77/AB/wKioL1Zrf9-Rnj_BAAAbF _l5uoy907.jpg "" 644 "height="/>
Figure 20
Modification succeeded
650) this.width=650; "title=" clip_image043 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image043 "src=" http://s3.51cto.com/wyfs02/M00/77/AC/wKiom1Zrf93AYoctAACN_ Wbmfoy274.jpg "" 644 "height=" 155 "/>
Figure 21
The configuration was successful.
2. Set the address pool range to 192.168.4.10-192.168.4.150, the gateway to the 192.168.4.1,DNS server address is 202.106.0.20 and 202.106.148.1, set the reserved address for XP clients to 192.168.4.20.
The requirement is to build a DHCP service
Steps, install the software. After the software installation is complete, modify the master configuration file
650) this.width=650; "title=" clip_image044 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image044 "src=" http://s3.51cto.com/wyfs02/M00/77/AB/ Wkiol1zrf-hc2hq6aabeeju7s34782.jpg "" 644 "height=" 154 "/>
Figure 22
or call a template file
650) this.width=650; "title=" clip_image045 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image045 "src=" http://s3.51cto.com/wyfs02/M01/77/AC/wKiom1Zrf9_ Rpzv-aaauxjnpxtm491.jpg "" 644 "height="/>
Figure 23
650) this.width=650; "title=" clip_image047 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image047 "src=" http://s3.51cto.com/wyfs02/M02/77/AC/ Wkiom1zrf-cgdbwraacmrq3dhda179.jpg "" 644 "height=" 284 "/>
Figure 24
Configuration complete
The reserved address is the address of XP
3, with the host (native) as a client, to see if the VM1 network card can automatically obtain an IP address, the option is correct? Does the XP client get a reserved address? (Note that turning off the virtual machine comes with the DHCP feature)
Restart DHCPD Service
XP Auto Get IP Address
Disabling virtual DHCP functionality
650) this.width=650; "title=" clip_image049 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image049 "src=" http://s3.51cto.com/wyfs02/M01/77/AB/ Wkiol1zrf-ts8urtaacb5dhjckc651.jpg "" 433 "height=" 484 "/>
Figure 25
The reserved address was obtained.
Take the real machine as a client to get an automatically assigned address.
Note Change to auto get
650) this.width=650; "title=" clip_image051 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image051 "src=" http://s3.51cto.com/wyfs02/M02/77/AC/ Wkiom1zrf-oy8gvhaachc7gtg5s918.jpg "" 432 "height=" 484 "/>
Figure 26
Successfully acquired address
4. After restarting the DHCPD service, check whether the DHCPD service port is successfully opened to view the lease file.
650) this.width=650; "title=" clip_image053 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; margin:0px; padding-right:0px "border=" 0 "alt=" clip_image053 "src=" http://s3.51cto.com/wyfs02/M01/77/AB/ Wkiol1zrf-bddjuhaaaswrqp7qe389.jpg "" 644 "height=" "/>
Figure 27
You can see that the DHCPD listener port is 67 service process number 6426 successfully opened
650) this.width=650; "title=" clip_image055 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" clip_image055 "src=" http://s3.51cto.com/wyfs02/M00/77/AC/wKiom1Zrf-XSN_ Gzaaclycbm2pc659.jpg "" 644 "height=" 173 "/>
Figure 28
For details of the lease, the reserved IP address is not displayed because it is permanent.
This is done, if you need a different network segment IP address need to add another network card, the master configuration file to add a global configuration, do not add a retention configuration.
Thank you! : Wq exit and SAVE!!!
Linux Basic Network configuration