linux suse iP config

修改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地址很简单,如下图即可:

linux suse iP config_第1张图片


一个界面就可以完成任务,但是在SuSE下则需要对3份文件进行修改
分别是:
/etc/sysconfig/network/ifcfg-eth0           [IP、掩码、网段、广播]
/etc/sysconfig/network/routes                [网关]
/etc/resolv.conf                                      [DNS]
redhat的是
/etc/sysconfig/network-scripts/ifcfg-eth0  [IP、掩码、网段、广播、网关、DNS]
 
 
这部分是SuSE的

/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/

你可能感兴趣的:(SuSE)