Redhat Linux配置IP地址 - graybull's Blog

Redhat Linux配置IP地址

graybull posted @ 2013年4月10日 22:22 in Unix/Linux with tags linux redhat ip address , 2464 阅读

转自:http://www.cnblogs.com/mailingfeng/archive/2012/10/31/2747510.html

 
要修改Linux的IP地址,依次修改以下三个文件:
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/resolv.conf
 
1./etc/sysconfig/network
 
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=WKM                  #主机名
GATEWAY=192.168.53.1       #默认网关
 
2./etc/sysconfig/network-scripts/ifcfg-eth0
 
DEVICE=eth0                                #设备名称
NETMASK=255.255.255.0             #子网掩码
IPADDR=192.168.53.147             #IP地址
BOOTPROTO=static                      #【none | static | bootp | dhcp】引导时不使用协议|静态分配|
                                                    #   BOOTP协议|DHCP协议
DNS1=211.99.25.1                      #域名解析服务器
ONBOOT=yes                               #【yes | no】引导时是否激活设备
PEERDNS=yes
 
3./etc/hosts
#建立hostName到ip的映射关系
#可建立多条, 其中有一条的yourHostName应该为第一步中的HOSTNAME相同.
#否则你使用InetAddress.getLocalhost()会有异常,应该找不到相应ip的映射
192.168.0.99  yourHostName localhost locahost.domain 
 
4./etc/resolv.conf (该步可以不做)
nameserver 211.99.25.1          #DNS配置 同2中的 【DNS1=211.99.25.1 】
 
5.重启生效
    使IP地址生效:
   /sbin/ifdown eth0
   /sbin/ifup eth0
 
   配置dns解析 (该步可以不做)
   echo "nameserver 211.98.1.28">> /etc/resolv.conf 
 
   通知网关更新信息:
   /etc/init.d/network restart

 

Avatar_small
queensland-assignmen 说:
2018年11月25日 22:21

It is always a big challenge for the coders to develop any program without using any helping tool. You made it easy to understand the real efforts behind developing programs.

Avatar_small
happy wheels 说:
2018年12月18日 23:02

The news you share is very attractive. I would love to read your posts, I will often visit your blog.

Avatar_small
Alyssa 说:
2022年12月18日 01:50

To configure an IP address on Redhat Linux, you can use the ifconfig command. This command allows you to view and set best doctor for rheumatoid arthritis near me the IP address of network interfaces on your system. The above thread will discuss more about it and I am looking here for more updates on that.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee