一、作用

用于配置和显示Linux内核中网络接口的网络参数
*注:用ifconfig命令配置的网卡信息,在网卡重启后机器重启后,配置就不存在

  • down:关闭指定的网络设备
  • up:启动指定的网络设备

    二、选项

  • down

  • up

    三、实例

    ```shell [root@localhost ~]# ifconfig ens34 down
  1. ```shell
  2. [root@localhost ~]# ifconfig ens34 up
  1. [root@localhost ~]# ifconfig
  2. docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
  3. inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
  4. ether 02:42:4f:77:d7:78 txqueuelen 0 (Ethernet)
  5. RX packets 0 bytes 0 (0.0 B)
  6. RX errors 0 dropped 0 overruns 0 frame 0
  7. TX packets 0 bytes 0 (0.0 B)
  8. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  9. ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
  10. inet 192.168.11.101 netmask 255.255.255.0 broadcast 192.168.11.255
  11. inet6 fe80::20c:29ff:fe17:f941 prefixlen 64 scopeid 0x20<link>
  12. ether 00:0c:29:17:f9:41 txqueuelen 1000 (Ethernet)
  13. RX packets 1435899 bytes 1836224033 (1.7 GiB)
  14. RX errors 0 dropped 0 overruns 0 frame 0
  15. TX packets 1699000 bytes 4227442715 (3.9 GiB)
  16. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  17. ens34: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
  18. inet 192.168.137.179 netmask 255.255.255.0 broadcast 192.168.137.255
  19. inet6 fe80::f1d5:f6ae:7457:f37e prefixlen 64 scopeid 0x20<link>
  20. ether 00:0c:29:17:f9:4b txqueuelen 1000 (Ethernet)
  21. RX packets 416467 bytes 461130094 (439.7 MiB)
  22. RX errors 0 dropped 0 overruns 0 frame 0
  23. TX packets 165530 bytes 10038790 (9.5 MiB)
  24. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  25. ens40: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
  26. inet 192.168.137.181 netmask 255.255.255.0 broadcast 192.168.137.255
  27. inet6 fe80::128f:ebc9:69d5:70b6 prefixlen 64 scopeid 0x20<link>
  28. ether 00:0c:29:17:f9:69 txqueuelen 1000 (Ethernet)
  29. RX packets 80822 bytes 73213737 (69.8 MiB)
  30. RX errors 0 dropped 0 overruns 0 frame 0
  31. TX packets 40281 bytes 2440248 (2.3 MiB)
  32. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  33. lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
  34. inet 127.0.0.1 netmask 255.0.0.0
  35. inet6 ::1 prefixlen 128 scopeid 0x10<host>
  36. loop txqueuelen 1000 (Local Loopback)
  37. RX packets 256 bytes 22272 (21.7 KiB)
  38. RX errors 0 dropped 0 overruns 0 frame 0
  39. TX packets 256 bytes 22272 (21.7 KiB)
  40. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0