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

How to use the ifconfig command to configure and display the network parameters of the Linux system network card

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the relevant knowledge of "how to use ifconfig commands to configure and display the network parameters of the Linux system network card". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Ifconfig configures and displays the network parameters of the Linux system network card

Add that 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 ifconfig (parameter) parameter add: set the ip address of the network device IPv6; del: delete the IP address of the network device IPv6; down: turn off the specified network device; set the type and hardware address of the network device; io_addr: set the Icano address of the network device; irq: set the IRQ; media of the network device: set the media type of the network device; mem_start: set the starting address occupied by the network device in the main memory Metric: specify the number to be added when calculating the number of forwarding packets; mtu: set the MTU; netmask of the network device: set the subnet mask of the network device; tunnel: establish a tunnel communication address between IPv4 and IPv6; up: start the specified network device;-broadcast: treat the packet to be sent to the specified address as a broadcast packet -pointopoint: establish a direct connection with the network device at the specified address, this mode has a secret function;-promisc: turn off or start the promiscuous mode of the specified network device; IP address: specify the IP address of the network device; network device: specify the name of the network device. The instance displays the network device information (active status):

[root@localhost ~] # ifconfig eth0 Link encap:Ethernet HWaddr 00:16:3E:00:1E:51 inet addr:10.160.7.81 Bcast:10.160.15.255 Mask:255.255.240.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:61430830 errors:0 dropped:0 overruns:0 frame:0 TX packets:88534 errors:0 dropped:0 overruns:0 carrier:0 Collisions:0 txqueuelen:1000 RX bytes:3607197869 (3.3GiB) TX bytes:6115042 (5.8MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:56103 errors:0 dropped:0 overruns:0 frame:0 TX packets:56103 errors:0 dropped:0 Overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:5079451 (4.8MiB) TX bytes:5079451 (4.8MiB) description:

Eth0 represents the first network card, where HWaddr represents the physical address of the network card. You can see that the current physical address (MAC address) of this network card is 00:16:3E:00:1E:51.

Inet addr is used to represent the IP address of the network card. The IP address of this network card is 10.160.7.81, the broadcast address Bcast:10.160.15.255, and the mask address Mask:255.255.240.0.

Lo is the bad address of the host, which is generally used to test a network program, but does not want users of the local area network or external network to view it, so it can only run and view the network interface used on this host. For example, assign the httpd server to the bad address and type 127.0.0.1 in the browser to see your WEB site. But only you can see, other hosts or users of the local area network do not know.

First line: connection type: Ethernet (Ethernet) HWaddr (hardware mac address).

The second line: the IP address, subnet and mask of the network card.

The third line: UP (for the open state of the network card) RUNNING (for the network cable of the network card is connected) MULTICAST (support for multicast) MTU:1500 (maximum transmission unit): 1500 bytes.

Fourth, five elements: statistics of receiving and sending packets.

Line 7: receive and send data byte statistics.

Start and close the specified network card:

Ifconfig eth0 up ifconfig eth0 downifconfig eth0 up to start the network card eth0,ifconfig eth0 down to close the network card eth0. Ssh login Linux server operation should be careful, closed can not be turned on, unless you have multiple network cards.

Configure and delete IPv6 addresses for the network card:

Ifconfig eth0 add 33ffe:3240:800:1005::2/64 # configure IPv6 address for Nic eth0 ifconfig eth0 del 33ffe:3240:800:1005::2/64 # Delete IPv6 address for Nic eth0 modify MAC address with ifconfig:

Ifconfig eth0 hw ether 00:AA:BB:CC:dd:EE configuration IP address:

[root@localhost ~] # ifconfig eth0 192.168.2.10 [root@localhost ~] # ifconfig eth0 192.168.2.10 netmask 255.255.255.0 [root@localhost ~] # ifconfig eth0 192.168.2.10 netmask 255.255.255.0 broadcast 192.168.2.255 enable and disable the arp protocol:

Ifconfig eth0 arp # enable the arp protocol ifconfig eth0 of the network card eth0-arp # turn off the arp protocol setting maximum transmission unit of the network card eth0:

Ifconfig eth0 mtu 1500 # sets the maximum big data packet size to 1500 bytes for other instances

Ifconfig # active network interface ifconfig-a # all configured network interfaces, regardless of whether they activate ifconfig eth0 # display the eth0 network card information "how to use the ifconfig command to configure and display the network parameters of the Linux system network card". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Development

Wechat

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

12
Report