一。通过命令配置
ifconfig命令
ifconfig eth0 192.168.1.253 netmark 255.255.255. 增加一个IP地址
ifconfig eth0 down 关闭第0块网卡
ifconfig eth0 up 启动第0块网卡
ifconfig eth0 查看第0块网卡的配置情况
iconfig eth0 -broadcast 192.168.1.255 设置第一块网卡的广播地址为192.168.1.255
ifconfig eth0 -allmulti 设置第一块网卡接收多播地址
ifconfig eth0 allmulti 设置第一块网卡不接收多播地址
route命令
route 察看路由表
route add default gw 192.168.1.1 增加一个网关
route del default gw 192.168.1.1 删除一个网关
route add -net 192.168.16.0/24 gw 192.168.16.254 增加一条路由
自动取得网络配置
dhclient 为当前主机取得网络配置
hostname linux 修改当前主机名为linux
hostname 查看当前主机名
服务命令配置文件
#etc/init.d/network restart
#/etc/init.d/network stop
#/etc/init.d/network start
服务状态改变的命令
#service network start
#service network stop
#service network restart
#service network status
#chkconfig --list|grep network 查看某服务的自动启动级别
#chkconfig --level 35 network off
#chkconfig --level 3 network 0n
二。通过字符界面配置
#ntsysv
三。通过配置文件配置
#vi /etc/sysconfig/network-script/eth0 设置网卡的网络配置
#vi /etc/sysconfig/network 设置本地的主机名
#vi /etc/hosts 设置本地HOST的文件
#vi /etc/resolv.conf 设置DNS服务器的相关配置
#vi /etc/rc.d/rc.local
查看网络是否正常的方法
# ping 192.168.1.1
#ping www.hqew.com
#ping -c 4 192.168.1.1 发送多大的数据包检测
#ping -T eth0 192.168.1.1 通过第一块网卡检测。
#traceroute 192.168.1.1查看到此IP所经过的路由信息,可以知道网络故障出在了什么地方。
#netstat -i查看linux系统所到网络的状况。
# nslookup 查看当前主机的DNS服务器,也可以设定当前主机的DNS服务器。