我使用这个发问配置默认的Ubuntu14.10以在RUNLEVEL 1中启动
但是当我切换到另一个RUNLEVEL (2,3或5)时,没有网络连接,我必须使用命令NetworkManger启动网络
这是一种正常行为吗?如果不是,则如何在切换运行级别时将网络配置为自动启动?
发布于 2015-05-20 08:12:35
网络管理器实际上是一个(本地)服务器,它处理(本地)客户端的请求。这个客户端通常是桌面中的网络小程序,因此当然属于GUI会话。
小解释
-----------------------------------------------------------------------------------------------------------------------------
| run level | name | Description |
-----------------------------------------------------------------------------------------------------------------------------
| 2 | Multi-User Mode | Does not configure network interfaces and does not export networks services |
| 3 | Multi-User Mode with Networking | Starts the system normally |
| 4 | Not used / user definable | For special purposes |
| 5 | System normally with GUI | Run level 3 + display manager |
-----------------------------------------------------------------------------------------------------------------------------建议您禁用网络管理器并手动配置接口。
停止网络管理程序
sudo service network-manager stop禁用它
echo "manual" | sudo tee /etc/init/network-manager.override也可以从系统中删除NetworkManager。
sudo apt-get purge network-manager然后您需要手动设置网络。
编辑/etc/network/interfaces,写ip,netmask .
auto eth0
iface eth0 inet static
address xxx.xxx.x.xx
gateway xxx.xxx.x.x
netmask xxx.xxx.xxx.x
network xxx.xxx.x.x
broadcast xxx.xxx.x.xxx输入所有详细信息后,需要使用以下命令重新启动网络服务
sudo /etc/init.d/networking restart设置DNS
编辑/etc/resolv.conf
sudo nano /etc/resolv.conf写
nameserver dns_server_ip
nameserver dns2_server_ip在这一步之后,您的网络将在没有NM的情况下进行配置,并且将在运行级别3和5上工作。
编辑1
如果您将一个GUI文件放在~/..config/autostart中以在用户登录后运行应用程序,则可以在登录到.desktop时自动启动任何应用程序。这可能有以下内容:
nano ~/.config/autostart/nm.desktop
[Desktop Entry]
Type=Application
Name=<Name of application as displayed>
Exec=<command to execute>
Icon=<full path to icon>
Comment=<optinal comments>
X-GNOME-Autostart-enabled=truehttps://askubuntu.com/questions/625936
复制相似问题