Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use the ifconfig command of linux to display or set up network devices

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the use of linux ifconfig command to display or set up network equipment, the article is very detailed, has a certain reference value, interested friends must read it!

The English full name of the ifconfig command is "network interfaces configuring", that is, the network parameters used to configure and display network interfaces in the Linux kernel. The network card information configured with the ifconfig command will not exist after the machine is restarted after the network card is rebooted. If you want to keep the above configuration information on your computer forever, you need to modify the configuration file of the network card.

Syntax format: ifconfig [parameters]

Common parameters:

Add sets the IP address of the network device IPv6 del deletes the IP address of the network device IPv6 down turns off the specified network device up starts the specified network device IP address specifies the network device IP address

Reference example

Display network device information:

[root@linuxcool ~] # 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:

[root@linuxcool ~] # ifconfig eth0 down

[root@linuxcool ~] # ifconfig eth0 up

Configure and delete IPv6 addresses for the network card:

[root@linuxcool ~] # ifconfig eth0 add 33ffe:3240:800:1005::2/64

[root@linuxcool ~] # ifconfig eth0 del 33ffe:3240:800:1005::2/64

Modify the MAC address with ifconfig:

[root@linuxcool ~] # ifconfig eth0 down

[root@linuxcool ~] # ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE

[root@linuxcool ~] # ifconfig eth0 up

[root@linuxcool ~] # ifconfig eth2 hw ether 00:1D:1C:1D:1E

[root@linuxcool ~] # ifconfig eth2 up

Configure the IP address:

[root@linuxcool ~] # ifconfig eth0 192.168.1.56

[root@linuxcool ~] # ifconfig eth0 192.168.1.56 netmask 255.255.255.0

[root@linuxcool ~] # ifconfig eth0 192.168.1.56 netmask 255.255.255.0 broadcast 192.168.1.255 above use linux's ifconfig command to display or set up all the contents of the network device, thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report