一、使用命令下修改
1、设置网卡地址
ifconfig eth0 192.168.1.131 netmask 255.255.255.0
2、修改网关
route add default gw 192.168.1.1
3、修DNS
vi /etc/resolve.conf
加入或者修改 nameserver 202.106.46.151
4、重启网络
/etc/init.d/networking restart
二、修改配置文件
dhcp方式
1、修改/etc/network/interfaces
如果是在centos下修改的是/etc/sysconfig/network-scripts/ifcfg-eth0等
加入或者修改
auto eth0
iface eth0 inet dhcp
static方式
1、修改/etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.2.1
gateway 192.168.2.254
netmask 255.255.255.0
2、 配置dns,同上
3、手动重启网络,同上