修改SuSE Linux 的IP地址
目标:
192.168.244.4 (IP)
255.255.255.0 (掩码)
192.168.244.2 (网关)
211.136.192.6 (主DNS)
120.196.165.24 (副DNS)
在windows下修改IP地址很简单,如下图即可:
/etc/sysconfig/network/ifcfg-eth0
BOOTPROTO='static' #静态IP,非DHCP
IPADDR='192.168.244.4'
NEWMASK='255.255.255.0'
NETWORK='192.168.244.0'
BROADCAST='192.168.244.255'
STARTMODE='auto' #开机自动激活网卡
/etc/sysconfig/network/routes
default 192.168.244.2 - -
/etc/resolv.conf
nameserver 211.136.192.6
nameserver 120.196.165.24
重启网卡服务
/etc/init.d/network restart
/etc/rc.d/init.d/network restart
Redhat的如下:
默认
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR="00:0C:29:3C:D4:A3"
NM_CONTROLLED="yes"
ONBOOT="no"
需要改为如下:
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.244.3
PREFIX=24
GATEWAY=192.168.244.2
DNS1=202.96.128.166
DOMAIN=202.96.128.86
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
HWADDR=00:0C:29:3C:D4:A3
其中 ONBOOT=yes 很重要,否则重启就没网卡了
原文件地址:
http://tophandxing.blog.163.com/blog/static/1097148201241233637794/