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

What are the commands for the Linux system to view the network configuration

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article "what are the commands for Linux system to view network configuration" is not quite understood by most people except programmers. Today, in order to give you a better understanding of "what are the commands for Linux system to view network configuration", the editor summarizes the following content, which has a certain reference value, the detailed steps are clear, and the details are handled properly. I hope you can get something through this article. Now let's take a look at the details.

1. Check the configuration of Nic ifconfigIfconfig | more to view the configuration of all NICs

Ifconfig enp6s0 192.168.5.160 netmask 255.255.255.0 temporarily modify the ip and mask of enp6s0

Watch ifconfig enp6s0 to check the network packets of the network card enp6s0

2. Enable / disable a certain network card ifup network card name

The name of the ifdown Nic is set based on finding the corresponding ifcfg-xx file. If you cannot find it, the setting will fail.

If you have modified the network parameters with ifconfig, shut down the network card through ifconfig eth0 down

3. Configure the Nic file into the directory cd / etc/sysconfig/network-scripts

Locate the network card ifcfg-enoxxx file that you want to configure and follow the instructions below:

Vi ifcfg-enoxxx

HWADDR=00:0c:29:8f:99:4b / / Network Card MAC address

TYPE=Ethernet / / Ethernet

BOOTPROTO=static / / the default meeting should be dhcp,static for static IP

DEFROUTE=yes

PEERDNS=yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=yes

NAME=eno16777736 / / name of the network card

UUID=94271989-6217-457d-a88f-40fb635af64c / / UUID, don't touch it, or you'll regret it.

# DEVICE=eno16777736

ONBOOT=yes / / Boot starts automatically

IPADDR=192.168.5. 150 / / IP address

NETNASK=255.255.255.0 / / subnet mask

GATEWAY=192.168.66.1 / / Gateway

DNS1=61.139.2.69 / / DNS

# DEVICE=eth0

After the configuration is completed

Service network restart restarts the network

Network problem solving

When multiple network cards, check whether there is a conflict between the network card ip and dns, and block the network card ip and dns that cause the conflict.

Configure vim / etc/resolv.conf

Configure the dns server and standby server 8.8.8.8 restart the network card

Nameserver 61.139.2.69

Nameserver 8.8.8.8

4. View the vnstatyum install epel-release of network traffic

Yum install-y vnstat install vnstat tool

Vnstat-create-I enp7s0 installs the database of the network card viewed

Vnstat-I enp7s0-l # View real-time traffic

5. Grab package tool tcpdump installation: yum install tcpdump

Use: tcpdump-I eth0 to view packets on a specified interface

Tcpdump host ip views the packets of the specified ip

Tcpdump-I enp6s0 host 192.168.5.160-w / home/wangjing/baotest.cap grab IP address 160and network card is enp6s0 packet

Tcpdump-I enp6s0 host 192.168.1.160 and port 80-w / tmp/xxx.cap grab IP packet with address 160,80 and network card enp6s0

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

Thank you for your reading. I hope you have a certain understanding of the key issue of "what are the commands for Linux system to view network configuration?" the specific usage still needs to be understood by everyone through hands-on experiments. Try it quickly. If you want to read more articles about relevant knowledge points, 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

Development

Wechat

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

12
Report