当前位置:网站首页>Ifconfig command – displays or sets network devices

Ifconfig command – displays or sets network devices

2022-06-25 05:59:00 ProYuan28

ifconfig The full English name of the order is “network interfaces configuring”, It is used for configuration and display Linux Network parameters of network interface in kernel . use ifconfig Command configuration network card information , After the network card restarts, the machine restarts , Configuration doesn't exist . To store the above configuration information in the computer forever , Then you need to modify the configuration file of the network card .

Grammar format :ifconfig [ Parameters ]

Common parameters :

add< Address > Set up network devices IPv6 Of IP Address
del< Address > Delete network device IPv6 Of IP Address
down Turn off the specified network device
up Start the specified network device
IP Address Specify the... Of the network device IP Address

Reference examples

Display network device information :

[[email protected] ~]# ifconfig
eth0   Link encap:Ethernet HWaddr 00:50:56:0A:0B:0C       
       inet addr:192.168.0.3 Bcast:192.168.0.255 Mask:255.255.255.0
       inet6 addr: fe80::250:56ff:fe0a:b0c/64 Scope:Link     
       UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1      
       RX packets:172220 errors:0 dropped:0 overruns:0 frame:0      
       TX packets:132379 errors:0 dropped:0 overruns:0 carrier:0 
       collisions:0 txqueuelen:1000       
       RX bytes:87101880 (83.0 MiB) TX bytes:41576123 (39.6 MiB) 
       Interrupt:185 Base address:0x2024  
lo    Link encap:Local Loopback       
      inet addr:127.0.0.1 Mask:255.0.0.0      
      inet6 addr: ::1/128 Scope:Host      
      UP LOOPBACK RUNNING MTU:16436 Metric:1      
      RX packets:2022 errors:0 dropped:0 overruns:0 frame:0      
      TX packets:2022 errors:0 dropped:0 overruns:0 carrier:0   
      collisions:0 txqueuelen:0       
      RX bytes:2459063 (2.3 MiB) 
      TX bytes:2459063 (2.3 MiB)

Start and close the specified network card :

[[email protected] ~]# ifconfig eth0 down
[[email protected] ~]# ifconfig eth0 up 

Configure and delete the network card IPv6 Address :

[[email protected] ~]# ifconfig eth0 add 33ffe:3240:800:1005::2/64
[[email protected] ~]# ifconfig eth0 del 33ffe:3240:800:1005::2/64

use ifconfig modify MAC Address :

[[email protected] ~]# ifconfig eth0 down
[[email protected] ~]# ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE
[[email protected] ~]# ifconfig eth0 up
[[email protected] ~]# ifconfig eth1 hw ether 00:1D:1C:1D:1E 
[[email protected] ~]# ifconfig eth1 up

To configure IP Address :

[[email protected] ~]# ifconfig eth0 192.168.1.56 
[[email protected] ~]# ifconfig eth0 192.168.1.56 netmask 255.255.255.0
[[email protected] ~]# ifconfig eth0 192.168.1.56 netmask 255.255.255.0 broadcast 192.168.1.255
原网站

版权声明
本文为[ProYuan28]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202201251057102.html