2024年11月Linux中ifconfig命令用法汇总(2)

发布时间:

  ⑴实例:启动关闭指定网卡

  ⑵ifconfig eth up

  ⑶ifconfig eth down

  ⑷ifconfig eth up 为启动网卡eth ;ifconfig eth down 为关闭网卡eth。ssh登陆linux服务器操作要小心,关闭了就不能开启了,除非你有多网卡。

  ⑸实例:为网卡配置和删除IPv地址

  ⑹ifconfig eth add ffe:::::/

  ⑺ifconfig eth del ffe:::::/

  ⑻ifconfig eth add ffe:::::/ 为网卡eth配置IPv地址;

  ⑼ifconfig eth add ffe:::::/ 为网卡eth删除IPv地址;

  ⑽练习的时候,ssh登陆linux服务器操作要小心,关闭了就不能开启了,除非你有多网卡。

  ⑾实例:用ifconfig修改MAC地址

  ⑿命令:ifconfig eth hw ether :AA:BB::DD:EE

  ⒀[rootlocalhost ~]# ifconfig eth down //关闭网卡

  ⒁[rootlocalhost ~]# ifconfig eth hw ether :AA:BB::DD:EE //修改MAC地址

  ⒂[rootlocalhost ~]# ifconfig eth up //启动网卡

  ⒃[rootlocalhost ~]# ifconfig

  ⒄eth Link encap:Ether HWaddr :AA:BB::DD:EE

  ⒅i addr:... Bcast:... Mask:...

  ⒆UP BROADCAST RUNNING MULTICAST MTU: Metric:

  ⒇RX packets: errors: dropped: overruns: frame:

  ⒈TX packets: errors: dropped: overruns: carrier:

  ⒉collisions: txqueuelen:

  ⒊RX bytes: (. MiB TX bytes: (. MiB《/p》 《p》lo Link encap:Local Loopback

  ⒋i addr:... Mask:...

  ⒌UP LOOPBACK RUNNING MTU: Metric:

  ⒍RX packets: errors: dropped: overruns: frame:

  ⒎TX packets: errors: dropped: overruns: carrier:

  ⒏collisions: txqueuelen:

  ⒐RX bytes: (. KiB TX bytes: (. KiB

  ⒑[rootlocalhost ~]# ifconfig eth hw ether :::BF:: //关闭网卡并修改MAC地址

  ⒒[rootlocalhost ~]# ifconfig eth up //启动网卡

  ⒓[rootlocalhost ~]# ifconfig

  ⒔eth Link encap:Ether HWaddr :::BF::

  ⒕i addr:... Bcast:... Mask:...

  ⒖UP BROADCAST RUNNING MULTICAST MTU: Metric:

  ⒗RX packets: errors: dropped: overruns: frame:

  ⒘TX packets: errors: dropped: overruns: carrier:

  ⒙collisions: txqueuelen:

  ⒚RX bytes: (. MiB TX bytes: (. MiB《/p》 《p》lo Link encap:Local Loopback

  ⒛i addr:... Mask:...

  ①UP LOOPBACK RUNNING MTU: Metric:

  ②RX packets: errors: dropped: overruns: frame:

  ③TX packets: errors: dropped: overruns: carrier:

  ④collisions: txqueuelen:

  ⑤RX bytes: (. KiB TX bytes: (. KiB