如何配置网卡参数

1.ip地址   2.子网掩码  3. 默认网关  4.dns指向   5.主机名

在系统中如何查看网卡参数

1.ifconfig

临时配置ip

ifconfig+网卡别名+ip地址   如果需要掩码的话,使用netmak+子网掩码。(但是这种临时配置,如果服务器重启的话,就会丢失。)

永久配置ip

/etc/sysconfig/network-scripts/ifcfg-网卡别名

1.直接编辑

2.Setup

3.system-config-network

如下所示:

Setup命令

 

Authentication configuration(和验证相关)

Firewall configuration(和防火墙相关的)

Keyboard configuration(和键盘相关的)

Neteork configuration(和网络相关的)

System services(和服务相关的)

Timezone configuration(和时间相关的)

X configurationXwindouws配置)

 

Edit Devices(网卡的相关参数)

Edit DNS configuration

注意:如果执行setup不出现界面的话,rpm -qa |grep setup

 

 

安装setup工具

system-config-network

 

 

如果要配置ip,双击则可

配置显示的相关参数:stemsystem-config-dispaly

 

配置完之后,重启网络服务

[root@localhost ~]# service network restart

Shutting down interface eth0:                              [  OK  ]

Shutting down loopback interface:                          [  OK  ]

Bringing up loopback interface:                            [  OK  ]

Bringing up interface eth0:                                [  OK  ]

在思科上配置辅助地址使用secondary   在华为上使用sub

一个主地址可以有多个辅助地址:ifconfig 网卡别名:编号 ip地址   netmask

 

 

 

配置网关

临时配置:route add

          route del(删除

[root@localhost ~]# route add -net 0.0.0.0/0  gw  192.168.23.168 

[root@localhost ~]# route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.23.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0

169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0

0.0.0.0         192.168.23.168  0.0.0.0         UG    0      0        0 eth0

[root@localhost ~]# route del -net 0.0.0.0/0

[root@localhost ~]# route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.23.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0

169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0

永久配置

1./etc/sysconfig/network

Dns指向

名称--ip     例:www.sina.com\

主目录下的hosts文件

 

注意:localhost.localdomain localhost    不能删除

主机名

/etc/sysconfig/network

Hostname=名称

 

    好了,到这里就全部结束了。嘿嘿,有问题的可以向我询问啊。