为什么我更改了IP地址,可每次在关机重起电脑以后!IP又会到以前的!不是我新改的?

来源(CU)

我用:
ifconfig eth0 192.168.1.106 netmask 255.255.0.0 up (设置IP地址和掩码)

route add default gw 192.168.1.1 (设置网关)


然后查看:

[root@localhost root]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

[root@localhost root]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:10:EE:89:41:92
inet addr:192.168.1.106 Bcast:192.168.1.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11077 errors:0 dropped:0 overruns:0 frame:0
TX packets:10240 errors:0 dropped:0 overruns:0 carrier:2
collisions:133 txqueuelen:1000
RX bytes:10170721 (9.6 Mb) TX bytes:1587084 (1.5 Mb)
Interrupt:11 Base address:0xd000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:12673 errors:0 dropped:0 overruns:0 frame:0
TX packets:12673 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1331349 (1.2 Mb) TX bytes:1331349 (1.2 Mb)


问题是:
每当我关机了重起电脑以后,我设的IP地址和网关,掩码都变成以前的了!
就不是我新设置的!

郁闷中!
还请各位大侠帮忙看看!
我不知道问题出在哪里?
谢谢各位帮我看看!

=====================================================================

用ifconfig设置的本来就是一重启就没有了,直接改一下/etc/sysconfig/network-scripts/ifcfg-eth0,如果是redhat系列的linux,试试用netconfig来设置.

=====================================================================

[root@localhost pascal]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.0.6
NETMASK=255.255.255.0
ONBOOT=yes
GATEWAY=192.168.0.1
TYPE=Ethernet
USERCTL=no
NETWORK=192.168.0.0
BROADCAST=192.168.0.255
PEERDNS=no
[root@localhost pascal]#

Link: http://www.asm32.net/article_details.aspx?id=403


浏览次数 586 发布时间 2006/4/20 20:26:53 从属分类 UNIX/LINUX 【评论】【 】【打印】【关闭
 
| www.asm32.net | 2006版 | 资料中心 | linux | asm/asm32 | C/C++ | VC++ | java | Python | 书签 | ASP.Net书签 | 京ICP备09029108号-1