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 does Linux view the specific information of network services?

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

Share

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

This article introduces the relevant knowledge of "how to view the specific information of network services in Linux". In the operation of actual cases, many people will encounter such a dilemma. Next, 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!

View the network interface address ifconfig

Use ifconfig to view address configuration information for network interfaces

Nic name: ens33

Ip address: 192.168.71.151

Subnet mask: 255.255.255.0

MAC address: 00:0c:29:70:fe:fc

IPV6 address: fe80::58b9:7c59:8d8c:23d

View hostname hostname

View or set the current hostname: hostname

Modify hostname

Hostname+ hostname (temporarily modify hostname)

Hostnamectl ste-hostname+ Hostnam

Route command to view routing table entries

Route command

View or set the information in the host table: route [- n]

Check the network connection

Netstat

View the network connection status, routing table, interface and other information of the system netstat [options]

Common option

A: indicates that all

N: indicates that it is displayed in digital form

T:TCP

U:UDP

P: protocol

R: represents the router

Example:

Enter netstat-ntap (view TCP protocol)

Enter netstat-nuap (view UDP protocol)

Enter netstat-r to view the routing table

Domain name resolution

Nslookup command

Test DNS domain name resolution: nslookup target host address [DNS server address]

Port 53 uses UDP protocol and TCP protocol

Example

When the hosts are connected to the Internet

Input

Nklookup www.baidu.com

The address resolved is 180.101.49.11. You can also visit Baidu website with this address.

Test the network connection

Test network interoperability: ping+ host ip address

Example

To test the long ping state of network connection in Linux system, you need to use Ctrl+Z to stop.

Only 4 ping packets are sent in the Window system and will stop automatically

Set network address parameters

Temporary configuration:

Directly modify the network address currently in use through the command line, which can take effect immediately. Simple and fast, high execution efficiency, generally used in the process of debugging the network. However, because the changes are not permanently stored in a static file, it will fail after restarting the ntewor service or restarting the host.

Fixed configuration:

Various fixed network addresses are stored through configuration files, which will not take effect until the network service is restarted or the host is restarted. This method is relatively complex, but it is equivalent to "permanent configuration" and is generally used when you need to set a fixed network address for the server.

Temporary modification command

Fixed settin

Input

Vim / etc/sysconfig/network-scripts/ifcfg-ens33

Go to the configuration file and change dhcp to static (static)

Press "G" to the last line, and press "O" to insert on the next line: IPADD, NETMASK (subnet mask), GETWAY

Set network interface parameters

Ifconfig command

The ifconfig command can not only be used to view the configuration of the network card, but also modify the IP address and subnet mask of the network card, bind the virtual network interface, activate or deactivate the network interface.

(1) modify the IP address and subnet mask of the network card

Ifconfig wide network interface name IP address [netmask subnet mask] ifconfig network interface name IP address [netmask subnet mask]

(2) disable and activate the network card interface

Ipconfig network interface up

Ipconfig network interface down

Set up a virtual network card

Ifconfig+ interface serial number + ip address

Set up routing record

Route command

The route command can be used not only to view routing table information, but also to add and delete static routing table entries, including setting default gateway addresses.

(1), the route record added to the specified network segment

Route add-net network segment address gw ip address

(2) delete the route record to the specified network segment'

Route del-net network segment address ge ip address

(3) delete the default gateway record

Route del default gw Gateway address

(4) add gateway record

Route add deafult gw Gateway address

This is the end of the content of "how to view the specific information of web services by Linux". 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

Servers

Wechat

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

12
Report