linux中重启网络

Linux Generic Commands

1
2
3
4
5
6
7
8
# to turn off eth0 interface is as follows. Run:
ifdown eth0

# To turn on eth0 interface run:
ifup eth0

# See ip address info using the ip command:
ip a show eth0

Debian / Ubuntu Linux restart network

1
2
3
4
5
# To restart network interface, enter:
sudo /etc/init.d/networking restart

sudo /etc/init.d/networking stop
sudo /etc/init.d/networking start
1
2
# with systemd, run:
sudo systemctl restart networking

Redhat (RHEL) / CentOS / Fedora / Suse / OpenSuse Linux – Restart network

1
2
3
4
5
# To restart network interface, enter:
/etc/init.d/network restart

/etc/init.d/network stop
/etc/init.d/network start
1
2
# with systemd, run:
sudo systemctl restart network