你用的ubuntu?该文件第二行明确说明“DO NOT EDIT THIE FILE BY HAND”,即是你对该文件的修改无效,该文件的内容是自动生成的。如果你要修改的话,应该修改/etc/network/interfaces文件(仅限ubuntu,其它发行版可能路径跟文件名都有区别)
我的该文件内容如下:
我的设置是静态ip
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
#the primary net work interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address X.X.X.X
netmask X.X.X.X
gateway X.X.X.X
dns-nameservers X.X.X.X
网关配置对了吗?ping下网关试试。