Redhat中通过命令工具和配置文件设置TCP/IP参数的方法

①ifconfig命令
用ifconfig命令修改后重起服务配置不保存
给Eth0接口设置IP地址和子网掩码广播地址并激活:ifconfig eth0 192.168.1.155 netmask 255.255.255.0 broadcast 192.168.1.255 UP
更改Eth0口的MAC地址:ifconfig eth0 hw ehter 00:40:64:c8:03:04
一个网卡添加多个IP:ifoconfig eht0:1 192.168.1.156 ifconfig eth1:192.168.157
添加网关:route add default gw 192.168.1.1
动态获取IP:ifconfig eth0 -dynamic
②netconfig工具
netconfig命令后 可以选择静态还是动态获取IP,选择静态后
IP address:IP地址
netmask:子网掩码
default gateway (IP):网关
Primary nameserver: DNS地址
如果只想配置某一项
修改IP是动态还是动态获取netconfig --bootproto=dhcp|bootp
设置子网掩码netconfig --netmask=255.255.255.0
设置IP地址netconfig --ip=192.168.1.124
设置DNS地址netconfig --nameserver=218.30.19.40
netconfig默认是设置Eth0网卡的如果想设置其他网卡在device=这打网卡名称
netconfig -d --device=eht1
修改完毕后需要重起服务.不重其服务不生效
③/etc/sysconfig/network-scripts/ifcfg-eth0
dev=eth0 网卡的物理名称
ONBOOT=yes 启动系统时是否启动
BOOTPROTO=static|dynamic 静态还是动态获取IP
ipadd=192.168.1.123 IP地址
netmask=255.255.255.0 子网掩码
network=192.168.1.0   网络地址
boradcast=192.168.1.255 广播地址
gateway=192.168.1.1 网关
#GATEWAYDEV=eth0 与次网关通讯所使用的网卡物理名称
修改完毕后需要重起服务.不重其服务不生效

posted on 2007-08-03 10:52  测试者家园  阅读(9650)  评论(0编辑  收藏  举报

导航