This RHCE Study Notes include common dhcp applications, assigned fixed ip addresses, relay proxy 1. in the experiment environment, set up four CentOS5.4 virtual machines, which are S (dhcpserver), A (dhcp-client), R (route), and B (relay proxy) Nic configurations as follows: /etc/sysconfig/network-scripts/The ifcfg-eth0 or eth1S: DEVICE = eth0 & n
This RHCE Study Notes include common dhcp applications, assigned fixed ip addresses, and relay proxies.
1. Set up an experiment environment
Four CentOS5.4 virtual machines, namely S (dhcpserver), A (dhcp-client), R (route), and B (relay proxy)
Nic configuration:/etc/sysconfig/network-scripts/ifcfg-eth0 or eth1
S: DEVICE = eth0
BOOTPRTO = static
HWADDR = XX: XX
ONBOOT = yes
IPADDR = 192.168.8.2
NETMASK = 255.255.255.0
GATEWAY = 192.168.8.1 (required by the relay proxy)
A: DEVICE = eth0
BOOTPRTO = dhcp
ONBOOT = yes
HWADDR: 00: 0C: 29: 0A: 4B: EE (required for fixed IP addresses)
R: DEVICE = eth0
BOOTPRTO = static
HWADDR = XX: XX
IPADDR = 192.168.8.1
NETMASK = 255.255.255.0
DEVICE = eth1
BOOTPRTO = static
HWADDR = XX: XX
IPADDR = 192.168.38.1
NETMASK = 255.255.255.0
B: DEVICE = eth0
BOOTPRTO = static
HWADDR = XX: xX: XX: xX
IPADDR = 192.168.38.2
NETMASK = 255.255.255.0
GATEWAY = 192.168.38.1
2. topology structure description:
The Virtual Machine S is located on the 192.168.8.x network segment, and the gateway is the IP address of the Virtual Machine R eth0.
Virtual Machine B is located on the 192.168.38.x network segment, and the gateway is the IP address of the Virtual Machine R eth1
Virtual Machine R acts as a router, so configure forwarding:
Check whether the NIC can forward data
Cat/proc/sys/net/ipv4/ip_forward
Echo "1">/proc/sys/net/ipv4/ip_forward
Try Virtual Machine B to ping dhcp server S after setting successful
Vm a and S are in the same network segment (VMnet2) first)
2. Install the dhcp package
Because the dhcp package contains dhcp services for the relay service, the virtual machine S Virtual Machine B needs to be installed.
Rpm-ivh dhcp-xxxx.rpm
Copy configuration file dhcp
Cp/usr/share/doc/dhcp-3.0xx/dhcpd. conf. sample/etc/dhcpd. conf
Relay Service dhcrelay does not need to copy the configuration file
3. Configure dhcpd. conf for virtual machine S
Vi/etc/dhcpd. conf
Ddns-update-style interim;
Ignore client-updates;
Subnet 192.168.8.0 netmask 255.255.255.0 {
# --- Default gateway
Option routers 192.168.8.1;
Option subnet-mask limit 255.0;
# Option nis-domain "domain.org ";
# Option domain-name "domain.org ";
# Option domain-name-servers 192.168.13.220;
Option time-offset-18000; # Eastern Standard Time
# Option ntp-servers 192.168.1.1;
# Option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- You understand Netbios very well
# Option netbios-node-type 2;
Range dynamic-bootp 192.168.8.120 192.168.13.167; (set the address pool here)
Range dynamic-bootp 192.168.8.169 192.168.13.254; (168 reserved for a specific mac)
Default-lease-time 21600;
Max-lease-time 43200;
# We want the nameserver to appear at a fixed address
Host ns {
Next-server marvin.RedHat.com;
Hardware ethernet 00: 0C: 29: 0A: 4B: EE; (Reserved IP addresses for A specific mac are reserved for vm)
Fixed-address 192.168.8.168;
}
}