残缺极品 发表于 2019-2-18 10:15:51

Ubuntu14.04重启网卡的三种方法:

  $ ifconfig -a
  展示全部网卡
  $ ifconfig enp2s0 up
  启用网卡enp2s0
  $ sudo vi /etc/network/interfaces
  auto enp2s0
iface enp2s0 inet static
address 192.168.2.10
network 255.255.255.0
gateway 192.168.2.1
  Ubuntu14.04重启网卡的三种方法:
  一、network
利用root帐户
service networking restart
  或者/etc/init.d/networking restart
  二、ifdown/ifup
ifdown enp2s0
ifup enp2s0
  三、ifconfig
ifconfig enp2s0 down
ifconfig enp2s0 up
  Ubuntu14.04修改配置,重启网卡没有生效,出现如下问题:
  service  networking restart //重启网络服务
stop: Job failed while stopping
start: Job is already running: networking
  tail -f /var/log/upstart/networking.log //查看错误日志
Stopping or restarting the networking job is notsupported.
Use ifdown & ifup to reconfigure desired interface.
  从以上日志内容可以看出,传统的service重启和停止网络已经不再支持了,需要通过使用ifdown &ifup来实现相应的操作。tail -f /var/log/upstart/networking.log
  重启指定网卡
  ifdown enp2s0 && ifup enp2s0



页: [1]
查看完整版本: Ubuntu14.04重启网卡的三种方法: