| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1099 人关注过本帖
标题:Linux的网络配置-->Plateau转移
只看楼主 加入收藏
有始有终
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2004-5-10
收藏
 问题点数:0 回复次数:2 
Linux的网络配置-->Plateau转移
网络配置相关文件
模块配置文件用于linux系统起动加载系统所需的硬件驱动模块,redhat linux 9中,模块配置文件的全路径名为/etc/modules.conf,根据网卡硬件的不同加载网卡的模块也会不同,如果系统中有多块网卡,需要对每块网卡都加载相应的驱动模块.
#grep eth modules.conf
alias eth0 8139too

网卡ip地址配置文件
位于/etc/sysconfig/network-scripts/中,文件名以ifcfg-开始后跟网卡的类型,通常为ethN,如第一块网卡的配置文件名为ifcfg-eth0,linux支持一块物理网卡绑定多个ip地址,需要建立多个网卡配置文件,文件名形式为ifcfg-ethN:M,如第一块以太网卡的第一个虚拟网卡的配置文件为ifcfg-eth0:0
配置文件的格式如下,项目名称和项目内容之间用=连接
DEVICE eth0 //设备名称
ONBOOT yes //起动时是否起动该设备
BOOTPROTO none //起动协议,none表示使用设置ip地址,dhcp表示从dhcp获得ip地址
IPADDR
NETMASK
BROADCAST //广播地址,一般为.255结束
NETWORK //网络地址,一般为.0结束
GATEWAY //默认网关地址

dns客户配置配置文件
全路径名为/etc/resolv.conf
使用nameserver关键字,最多可以使用3个有效的dns服务器.
$ more resolv.conf
nameserver 197.2.6.11

名称解析顺序
linux,unit中除了使用dns外还可以使用nis,hosts文件等方式进行名称解析,在同时使用时,需要设定一个顺序.
文件/etc/nsswitch.conf中使用hosts关键字设置名称解析顺序.
$ grep hosts /etc/nsswitch.conf
#hosts: db files nisplus nis dns
hosts: files dns

hosts文件
/etc/hosts
系统直接读取该文件中设置的ip地址和主机名的对应记录.
$ more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost

网络相关命令
hostname
hostname //直接使用显示当前系统的主机名称
hostname 主机名 //用于设置系统主机名

ifconfig
ifconfig //显示当前系统中活动的网卡设置
ifconfig -a //显示所有网卡的信息
ifconfig 网卡设备名 //显示指定网卡备的信息
ifconfig 网卡设备名 up //起动系统中指定的非活动网卡
ifconfig 网卡设备名 down //停止指定的活动网卡
ifconfig 网卡设备名称 ip地址 //设置网卡的名称

ifup 网卡设备名 //起动非活动的网卡设备,与ifconfig up命令功能类似
ifdown 网卡设备名 //停止活动的网卡设备,与ifconfig down命令类似

route用于显示和动态修改系统当前的路由表信息.该路由表信息在系统运行时有效,重新起动网络将丢失route命令设置的路由信息.
route //显示系统当前的路由信息
route add -net 网络地址 netmsk 子网掩码 dev 网络设备名 //在系统当前路由表中添加路由记录
route del -net 网络地址 netmask 子网掩码 //删除路由记录

route add default gw 网关ip地址 dev 网卡设备名称 //添加系统当前路由表中的默认网关记录
route del default gw 网关ip地址 //删除默认网关记录

ping [-c 发出报文数] 目的主机地址

nslookup用于使用系统设定的dns服务器解析域名,可以用来测试dns服务起是否工作正常,有交互式和命令两种模式
nslookup
交互式用exit命令退出
nslookup 主机域名|ip地址

使用netconfig程序配置网络
使用netconfig程序可疑配置ip地址,netmask,default gateway,primary nameserver
要使改变的ip地址生效,要重新起动network服务
# service network restart
正在关闭接口 eth0: [ 确定 ]
关闭环回接口: [ 确定 ]
设置网络参数: [ 确定 ]
弹出环回接口: [ 确定 ]
弹出界面 eth0: [ 确定 ]
搜索更多相关主题的帖子: Plateau Linux 网络 
2004-05-17 14:58
gxc
Rank: 1
等 级:新手上路
帖 子:116
专家分:0
注 册:2004-5-13
收藏
得分:0 
感谢

做就做到最好!
2004-05-17 15:05
eghost
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2004-11-10
收藏
得分:0 
我晕!怎么这儿也开始讲linux了,我晕,那还要unix 做什么呀!!要linux版面做什么呀!!晕死!

/mxbz/myphoto/2.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://test105.web104./mxbz/myphoto/2.gif');}" onmousewheel="return imgzoom(this);" alt="" /> /pub/date/date.png" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www./pub/date/date.png');}" onmousewheel="return imgzoom(this);" alt="" />/mxbz/myphoto/blogo.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://test105.web104./mxbz/myphoto/blogo.gif');}" onmousewheel="return imgzoom(this);" alt="" /> [glow=500,red,2]忘情工作室專業建站網站優化出售8位无保QQ[/glow]
2004-11-10 03:41
快速回复:Linux的网络配置-->Plateau转移
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011458 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved