2012年9月25日星期二

修改ip CentOS

搬家offices ,testlink server moved ,so changes ip for it.

[go] 一下如何修改
http://www.cyberciti.biz/faq/linux-change-ip-address/

Task: Change IP address

You can change ip address using ifconfig command itself. To set IP address 192.168.1.5, enter command:
# ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up
# ifconfig eth0

想起这里都是dhcp的获取,怕冲突就先自动获取一个,在设置成static的
[go] dhcp 获取方式
http://www.cnblogs.com/liupeizhi/archive/2012/04/09/2438633.html
dhclient eth0
获取了一下发现可以使用 172.16.105.224 ,设置一下 重启,发现又回到修改前的了,why?

[go] 如何保存修改的ip呢?
http://topic.csdn.net/t/20060320/17/4627118.html
将ip配置保存到文件中:
/etc/sysconfig/network-scripts/ifcfg-eth0
这样重起后就不会丢了

直接修改就ok了,修改是发现要写gateway ,ifconfig查看没有gateway,how to?
[go]如何查看gateway?
http://www.ctohome.com/FuWuQi/f0/566.html
[root@www.ctohome.com]# netstat -rn
Kernel IP routing table
Destination Gateway      Genmask      Flags   MSS Window  irtt Iface
184.82.152.96   0.0.0.0      255.255.255.248 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      184.82.152.97   0.0.0.0      UG     0 0       0 eth0
ok 了。修改完毕,重启正常了。

[popexizhi:TREE]
i.set & show
# ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up
# ifconfig eth0
ii.change all
/etc/sysconfig/network-scripts/ifcfg-eth0
iii.gateway
netstat -rn

没有评论:

发表评论