RHEL5
基本網絡配置
1、
1
、RHEL5:如圖1
(如圖1)
2
、#hostname //查看當前主機的主機名:如圖2
(如圖2)
3
、#vi /etc/sysconfig/network-scripts/ifcfg-eth0 編輯指定網絡接口配置文件:如圖3
(如圖3)
4
、#vi /etc/sysconfig/network 經過配置文件修改主機名:如圖4
(如圖4)
5
、#vi /etc/syconfig/i18n在終端字符界面修改其字體和中文字體大小:如圖5
(如圖5)
6
、掛載光盤:如圖6
(如圖6)
7
、查看OpenSSH是否安裝:如圖7
(如圖7)
8
、
#vi /etc/hosts
設置本地
DNS
解析文件:
如圖8
(如圖8)
9
、
#vi /etc/resolv.conf
指定當前主機的
DNS
服務器,最多可指定三個:
如圖9
(如圖9)
10
、關閉iptables防火牆:如圖10
(如圖10)
2、DHCP簡單配置
一、掛載並查詢dhcp是否安裝:
[root@dhcp ~]# mount /dev/hdc /mnt/dvd/
mount: block device /dev/hdc is write-protected, mounting read-only
[root@dhcp ~]# cd /mnt/dvd/Server/
[root@dhcp Server]# rpm -qa | grep dhcp
dhcpv6_client-0.10-33.el5
[root@dhcp Server]# ls -l dhcp*
-rw-r--r-- 110 root root 894361 2007-06-28 dhcp-3.0.5-7.el5.i386.rpm
-rw-r--r-- 125 root root 132573 2007-06-28 dhcp-devel-3.0.5-7.el5.i386.rpm
-rw-r--r-- 110 root root 218171 2007-01-18 dhcpv6-0.10-33.el5.i386.rpm
-rw-r--r-- 115 root root 80927 2007-01-18 dhcpv6_client-0.10-33.el5.i386.rpm
2
、安裝
dhcp
並查詢
[root@dhcp Server]# rpm -ivh --aid dhcp-3.0.5-7.el5.i386.rpm
warning: dhcp-3.0.5-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:dhcp ########################################### [100%]
[root@dhcp Server]# rpm -ivh dhcp-devel-3.0.5-7.el5.i386.rpm
warning: dhcp-devel-3.0.5-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:dhcp-devel ########################################### [100%]
[root@dhcp Server]# rpm -ivh dhcpv6-0.10-33.el5.i386.rpm
warning: dhcpv6-0.10-33.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:dhcpv6 ########################################### [100%]
[root@dhcp Server]# rpm -qa | grep dhcp
dhcp-devel-3.0.5-7.el5
dhcpv6-0.10-33.el5
dhcpv6_client-0.10-33.el5
dhcp-3.0.5-7.el5
3
、複製模板文件
dhcpd.conf.sample
到
/etc
目錄下名爲
dhcpd.conf
[root@dhcp Server]#
cd /usr/share/doc/dhcp-3.0.5/
[root@dhcp dhcp-3.0.5]# ls
api+protocol draft-ietf-dhc-failover-07.txt RELNOTES rfc2485.txt
dhcpd.conf.sample IANA-arp-parameters rfc1542.txt rfc2489.txt
draft-ietf-dhc-authentication-14.txt ja_JP.eucJP rfc2131.txt rfc951.txt
draft-ietf-dhc-dhcp-dns-12.txt README rfc2132.txt
[root@dhcp dhcp-3.0.5]#
cp dhcpd.conf.sample /etc/dhcpd.conf
cp:是否覆蓋「/etc/dhcpd.conf」?
y
[root@dhcp dhcp-3.0.5]# cd
4
、修改
/etc/dhcp.conf
內容,注意加黑字體是修改內容
[root@dhcp ~]# vim /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet
10.2.11
.0 netmask 255.255.255.0 {
(修改
10.2.11.0
網段)
# --- default gateway
option routers
10.2.11
.1;
(修改網關)
option subnet-mask 255.255.255.0;
(子網掩碼)
option nis-domain "domain.org";
option domain-name "
benet.com";
(
修改域名)
option domain-name-servers
202.106.46.151;
(設置
dns
)
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
10.2.11
.200 10.2.11.230;
(獲取
IP
地址網段)
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 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}
"/etc/dhcpd.conf" 31L, 844C 已寫入
5
、啓動
dhcpd
服務
[root@dhcp ~]# service dhcpd restart
關閉 dhcpd: [失敗]
啓動 dhcpd: [肯定]
[root@dhcp ~]# chkconfig --list dhcpd
dhcpd 0:關閉 1:關閉 2:關閉 3:關閉 4:關閉 5:關閉 6:關閉
[root@dhcp ~]# chkconfig --level 2345 dhcpd on
[root@dhcp ~]# chkconfig --list dhcpd
dhcpd 0:關閉 1:關閉 2:啓用 3:啓用 4:啓用 5:啓用 6:關閉
6
、客戶機測試
7
、能夠指定用戶獲取的
IP
# we want the nameserver to appear at a fixed address
host
ns
(
修改主機名如:
honglin) {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
(修改
MAC
地址)
fixed-address
207.175.42.254;
(
修改
IP
如:
10.2.11
.229)
}
[root@dhcp ~]#
cat /var/lib/dhcpd/dhcpd.leases
# All times in this file are in UTC (GMT), not your local timezone. This is
# not a bug, so please don't ask about it. There is no portable way to
# store leases in the local timezone, so please don't request this as a
# feature. If this is inconvenient or confusing to you, we sincerely
# apologize. Seriously, though - don't ask.
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-V
3.0.5
-RedHat
lease
10.2.11
.230 {
starts 3 2009/11/18 08:41:43;
ends 3 2009/11/18 14:41:43;
tstp 3 2009/11/18 14:41:43;
binding state active;
next binding state free;
hardware ethernet 00:24:
8c
:15:97:28;
uid "\001\000$\214\025\227(";
client-hostname "PC-200910272235";
}
[root@dhcp ~]#
配置文件在附件裏面:
若有不懂的地方,請call我!qq:357714938 mail:hongwish8es@126.com