ubuntu 怎么手动设置IP

来源:百度知道 编辑:UC知道 时间:2024/05/25 18:27:30

/etc/network/interfaces 是网络配置文件,你可以用任何文本编辑程序编辑,z注意保存之后要重启相应的网络连接使它生效,如eth0:
sudo ifdown eth0
sudo ifup eth0
下面是我的文件,你可以参考
# 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

iface eth0 inet static
address 192.168.0.110
netmask 255.255.255.0
gateway 192.168.0.1
auto eth0

#auto dsl-provider
#iface dsl-provider inet ppp
#pre-up /sbin/ifconfig eth0 up # line maintained by pppoeconf
#provider dsl-provider

#iface ppp0 inet ppp
#provider ppp0

#auto ppp0

auto dsl-provider
iface dsl-provider inet ppp
provider dsl-provider

当然图形界面以及ifconfig命令本身就可以完成这些任务,相对麻烦,你可以参看ifconfig命令的帮助: man ifconfig

补充一下,ubuntu图形界面手动设置ip地址后,要将网卡刷新一下才能识别设置的静态地址。ifconfig eth0 down ;ifconfig eth0 up

桌面版