Ubuntu网络配置相关
以DHCP方式配置网络
1.sudo vi /etc/network/interfaces
改为
auto lo
iface lo inet loopback
#iface eth0 inet static
#address 10.60.3.85
#netmask 255.255.255.0
#gateway 10.60.3.1
auto eth0
iface eth0 inet dhcp
2.重启网络服务:
sudo /etc/init.d/networking restart
3.获取网络地址
sudo dhclient eth0
重启网卡
如果是具体某个网卡,比如eth0,可以关闭:
sudo ifdown eth0
然后启动:
sudo ifup eth0
如果是修改了配置文件,需要网络的重启:
sudo /etc/init.d/networking restart
ubuntu ifupdown 不能修改解决
1.sudo vi /etc/dbus-1/system.d/NetworkManager.conf
将deny改为allow
<policy context=default>
<allow own="org.freedesktop.NetworkManager"/>
<allow send_destination="org.freedesktop.NetworkManager"/>
<allow send_interface="org.freedesktop.NetworkManager"/>
</policy>
2.停止 NetworkManager
sudo /etc/init.d/network-manager stop
3.删除/etc/network/interfaces
sudo mv /etc/network/interfaces /etc/network/interfaces.bak
4.启动 NetworkManager
sudo /etc/init.d/network-manager start