ubuntu 拔掉网线后插上连不上网

来源:互联网 发布:电子数据的类型 编辑:程序博客网 时间:2024/04/29 22:59

文章出处:http://blog.csdn.net/shift_wwx


使用ifconfig eth0 down; ifconfig eth0 up

使用disable networking 后 enable networking

等都不行。


ifconfig 是一个用来查看、配置、启用或禁用网络接口的工具,这个工具极为常用的。可以用这个工具来临时性的配置网卡的IP地址、掩码、广播地址、网关等。也可以把它写入一个文件中(比如/etc/rc.d/rc.local),这样系统引导后,会读取这个文件,为网卡设置IP地址。

激活和终止网络接口的用ifconfig 命令,后面接网络接口,然后加上down或up参数,就可以禁止或激活相应的网络接口了。当然也可以用专用工具ifup和ifdown 工具


来看一下/etc/network/interfaces:

# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopback# The primary network interface auto eth0 iface eth0 inet dhcp

可以看到eht0是自动获取ip,用的是dhcp协议,所以对于DHCP自动分配的ip,就不能用ifconfig来激活或停止。

dhclient -r eth0;

dhclient eth0;

就跟windows中的ipconfig /release一样




0 0
原创粉丝点击