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