网络管理基础设置和DHCP服务_第1页
网络管理基础设置和DHCP服务_第2页
网络管理基础设置和DHCP服务_第3页
网络管理基础设置和DHCP服务_第4页
网络管理基础设置和DHCP服务_第5页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、1配置主机名、IP地址等网络参数部署DHCP服务器部署文件服务器部署域名解析服务器网站、数据库等综合应用部署电子邮件系统2临时设置 使用命令调整网络参数 简单、快速,可直接修改运行中的网络参数 一般只适合在调试网络的过程中使用 系统重启以后,所做的修改将会失效永久设置 通过配置文件修改网络参数 修改各项网络参数的配置文件 适合对服务器设置固定参数时使用 需要重载网络服务或者重启以后才会生效3设置网络接口的ip地址、子网掩码 格式:ifconfig 接口名 ip地址 netmask 子网掩码 ifconfig 网络接口 ip地址/掩码长度 禁用或者重新激活网卡 格式:ifconfig 网络接口

2、up ifconfig 网络接口 down 设置虚拟网络接口 格式:ifconfig 接口名:序号 IP地址4删除路由表中的默认网关记录 格式:route del default gw IP地址向路由表中添加默认网关记录 格式:route add default gw IP地址添加到指定网段的路由记录 格式:route add -net 网段地址 gw IP地址删除到指定网段的路由记录 格式:route del -net 网段地址5设置主机名 格式:hostname 主机名rootlocalhost # rootlocalhost # hostname LinServerhostname Li

3、nServerrootlocalhost # hostnamerootlocalhost # hostnameLinServerLinServer添加、删除静态添加、删除静态ARPARP解析记录解析记录 格式:格式:arp -s IParp -s IP地址地址 MACMAC地址地址 arp -d IParp -d IP地址地址rootlocalhost # rootlocalhost # arp -s 00:0C:29:99:32:C5arp -s 00:0C:29:99:32:C5rootlocalhost # arp -nrootlocalh

4、ost # arp -nAddress HWtype HWaddress Flags Mask IfaceAddress HWtype HWaddress Flags Mask Iface ether 00:0C:29:99:32:C5 C ether 00:0C:29:99:32:C5 CMM eth0eth06/etc/sysconfig/network-scripts/ 目录下的 ifcfg-eth0:第1块以太网卡的配置文件 ifcfg-eth1:第2块以太网卡的配置文件 rootlocalhost # vi /etc/sysconfig/n

5、etwork-scripts/rootlocalhost # vi /etc/sysconfig/network-scripts/ifcfg-eth0ifcfg-eth0DEVICE=eth0DEVICE=eth0ONBOOT=yesONBOOT=yesBOOTPROTO=staticBOOTPROTO=staticIPADDR=IPADDR=NETMASK=NETMASK=GATEWAY=54GATEWAY=54rootlocalhost # rootl

6、ocalhost # ifdownifdown eth0 ; eth0 ; ifupifup eth0 eth0重新激活网卡配置重新激活网卡配置7/etc/init.d/network 脚本文件 用途:重新加载网络服务,设置相关网络参数 格式:/etc/init.d/network 控制参数 service network 控制参数常用控制参数 start:启动服务 stop:终止服务 restart:重新启动服务程序 reload:仅重新加载配置 status:查看服务状态8/etc/sysconfig/network 文件 用途:保存全局网络设置,主要包括主机名信息rootlocalhos

7、t # vi /etc/sysconfig/rootlocalhost # vi /etc/sysconfig/networknetworkNETWORKING=yesNETWORKING=yesNETWORKING_IPV6=noNETWORKING_IPV6=noHOSTNAMEHOSTNAME=LinServer=LinServerrootlocalhost # rebootrootlocalhost # reboot9/etc/hosts 文件 用途:保存主机名与IP地址的映射记录rootlocalhost # vi /etc/rootlocalhost # vi /etc/hosts

8、hosts localhost.localdomain localhost localhost.localdomain localhost LinServer LinServerrootlocalhost # ping LinServerrootlocalhost # ping LinServerPING PING LinServer ()LinServer () 56(84) bytes of data. 56(84) bytes of data.64 bytes fr

9、om LinServer (): icmp_seq=1 ttl=64 64 bytes from LinServer (): icmp_seq=1 ttl=64 time=0.02 mstime=0.02 ms64 bytes from LinServer (): icmp_seq=2 ttl=64 64 bytes from LinServer (): icmp_seq=2 ttl=64 time=0.03 mstime=0.03 mshostshosts文件和文件和DNSDNS服务器的比较服务器的比较

10、默认情况下,系统首先从默认情况下,系统首先从hostshosts文件查找解析记录文件查找解析记录 hostshosts文件只对当前的主机有效文件只对当前的主机有效 hostshosts文件无法完全取代文件无法完全取代DNSDNS服务器,只能完成辅助的服务器,只能完成辅助的主机名称解析主机名称解析10/etc/resolv.conf 文件 用途:保存本机需要使用的DNS服务器的IP地址rootlocalhost # vi /etc/resolv.confrootlocalhost # vi /etc/resolv.confsearch localdomainsearch localdomainn

11、ameserver nameserver nameserver 0nameserver 0nameserver nameserver 11DHCP服务器软件 RHEL5光盘中的 dhcp-3.0.5-3.el5.i386.rpmdhcp软件包的主要文件 主配置文件:/etc/dhcpd.conf 执行程序:/usr/sbin/dhcpd、/usr/sbin/dhcrelay 服务脚本:/etc/init.d/dhcpd、/etc/init.d/dhcrel

12、ay 执行参数配置:/etc/sysconfig/dhcpd DHCP中继配置:/etc/sysconfig/dhcrelay12rootlocalhost # vi /etc/dhcpd.confrootlocalhost # vi /etc/dhcpd.confddns-update-style interimddns-update-style interim; ;ignore client-updatesignore client-updates; ;subnetsubnet netmasknetmask 255

13、.255.255.0 ; ; optionoption routers routers ; ; optionoption subnet-mask subnet-mask ; ; ; ; default-lease-time 21600 default-lease-time 21600; ; max-lease-time 43200 max-lease-time 43200; ; ; ; 全局配置全局配置参数参数子网网段子网网段声明声明地址配置地址配置选项选项地址配置地址配置参数参数13全局设置,

14、作用于整个配置文件 ddns-update-style none; default-lease-time 21600; max-lease-time 43200; option domain-name “”; option domain-name-servers 0;14subnet声明,配置整个子网段的地址属性 range参数:设置用于分配的IP地址池 option subnet-mask参数:设置客户机的子网掩码 option routers参数:设置客户机的默认网关地址subnetsubnet ne

15、tmasknetmask rangerange 10 20; 10 20; rangerange 28 54; 28 54; option subnet-maskoption subnet-mask ; ; option routersoption routers ; ;

16、 ; ; 15host声明,配置单个主机的地址属性 hardware ethernet参数:指定对应主机的MAC地址 fixed-address参数:指定为该主机保留的IP地址host host prtsvr prtsvr hardware ethernethardware ethernet 00:c0:c3:22:46:81;00:c0:c3:22:46:81; fixed-address fixed-address 1;1; 16/etc/sysconfig/dhcpd 提供额外执行参数,例如可修改 DHCPDARGS项,限制dhcp服务器提供服

17、务的网络接口rootlocalhost # vi /etc/sysconfig/dhcpdrootlocalhost # vi /etc/sysconfig/dhcpdDHCPDARGS=eth0 eth1DHCPDARGS=eth0 eth117租约文件dhcpd.leases 记录了分配给客户机的IP地址相关信息rootlocalhost # tail -7 rootlocalhost # tail -7 /var/lib/dhcpd/dhcpd.leases/var/lib/dhcpd/dhcpd.leaseslease 00 lease 00

18、 starts 3 2006/04/12 19:38:56; starts 3 2006/04/12 19:38:56; ends 4 2006/04/13 01:38:56; ends 4 2006/04/13 01:38:56; binding state active; binding state active; next binding state free; next binding state free; hardware ethernet 00:0c:29:0e:cb:e2; hardware ethernet 00:0c:29:0e:cb:e2; 18应用示例: 设置全局租约时

19、间 默认租约时间:21600秒 最大租约时间:43200秒 设置客户机的网络地址参数 子网掩码: 动态分配的IP地址范围:0000 默认搜索域: 默认网关地址: DNS服务器地址: 为主机Server01分配固定IP地址 对应的MAC地址:b0:c0:c3:22:46:81 保留IP地址:1rootlocalhost # vi /etc/dhcpd.confrootlocalhost # vi /etc/dhcpd.confddns-update-style

20、interimddns-update-style interim; ;ignore client-updatesignore client-updates; ;subnetsubnet netmasknetmask ; ; host Server01 host Server01 ; ; rootlocalhost # service dhcpd startrootlocalhost # service dhcpd start启动启动 dhcpddhcpd: 确定确定 启动启动dhcpddhc

21、pd服务服务19两种使用方式 修改网卡配置文件(如 ifcfg-eth0) BOOTPROTO=dhcp 使用dhclient命令 格式:dhclient -d 网络接口名查看客户机的地址租用记录 /var/lib/dhclient/dhclient.leasesrootlocalhost # vi /etc/sysconfig/network-scripts/ifcfg-eth0rootlocalhost # vi /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0DEVICE=eth0ONBOOT=yesONBOOT=yesBOOTPROTO=dhcpBOOTPROTO=dhcprootlocalhost # ifdown eth0 ; ifup et

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论