日期:2014-05-16  浏览次数:20597 次

Linux(RHEL6.1) 网络配置

1. ifconfig命令及其附加选项

??? -a:显示所有接口信息

??? -s:显示每个接口的摘要信息,与netstat -i 命令的执行结果一样

??? [init]: ifconfig eth0 :显示指定接口信息

??? up:ifconfig eth0 up:激活eth0

??? down:ifconfig eth0 down:停掉eth0

??? netmask:给一个接口设定网络掩码:ifconfig eth0 netmask 255.255.255.0

??? broadcast:设置指定接口的广播地址:ifconfig eth0 broadcast 192.168.0.255

??? [addr]:ifconfig eth0 192.168.0.100 :设置接口的IP地址

2. 重启网络

??? service network restart

3. 常见故障

??? (1)网卡工作不正常

??? 检测网卡:lsmod

??? PingIP:ping -c 5 192.168.1.168

??? (2)DNS设置问题

??? vi /etc.resolv.conf

??? (3)默认路由设置问题

??? 默认的Gateway:192.168.1.1

??? route del default #删除原有的默认路由

??? route add default gw 192.168.1.1 #将默认路由指向网关

??? (4)修改网卡的硬件地址

??? ifconfig eth0 hw ether 00:01:02:03:04:05 #ether说明网卡类型,并将网卡的物理地址改为:01:02:...:05

??? (5)一战网卡绑定多个Ip地址

??? ifconfig eth0:0 192.168.0.253

??? ifconfig eth0:1 192.168.0.252

??? 若希望系统自定绑定,则需要将浙西额命令写到/etc/rc.d/rc.local中或在/etc/sysconfig/network-scripts目录中,

??? 将ifcfg-eth0:0、ifcfg-eth0:1等,并做以下修改:

??? DEVICE=eth0:0[1]

??? IPADDR=192.168.0.253[252]??