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

Network problems on linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

First, check the IP.

1 、 ifconfig

[root@Hankwr312 ~] # ifconfig

Eth0: flags=4163 mtu 1500

Inet 192.168.2.252 netmask 255.255.255.0 broadcast 192.168.2.255

Inet6 fe80::c89c:2e9:21be:b9fb prefixlen 64 scopeid 0x20

Ether 28:6e:d4:88:c6:2e txqueuelen 1000 (Ethernet)

RX packets 737399 bytes 67992906 (64.8 MiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 1095 bytes 57145 (55.8 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

2 、 ip addr

[root@Hankwr312 ~] # ip addr

2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

Link/ether 28:6e:d4:88:c6:2e brd ff:ff:ff:ff:ff:ff

Inet 192.168.2.252/24 brd 192.168.2.255 scope global noprefixroute eth0

Valid_lft forever preferred_lft forever

Inet6 fe80::c89c:2e9:21be:b9fb/64 scope link noprefixroute

Valid_lft forever preferred_lft forever

Ifconfig can only be used when NetworkManager is installed and running, and ip addr is used with minimal installation.

2. Modify / set IP

1. Set up during installation

2. When NetworkManager is installed again, use the nmtui command.

3. Modify the configuration file directly

[root@Hankwr312 ~] # cd / etc/sysconfig/network-scripts/ Jump to the directory where the network card is located

[root@Hankwr312 network-scripts] # ls look at the files and directories in the directory and find the configuration file of the network card

Ifcfg-eth0 ifdown-bnep ifdown-ipv6 ifdown-ppp ifdown-Team ifup ifup-eth ifup-isdn ifup-post ifup-sit ifup-tunnel network-functions

Ifcfg-lo ifdown-eth ifdown-isdn ifdown-routes ifdown-TeamPort ifup-aliases ifup-ippp ifup-plip ifup-ppp ifup-Team ifup-wireless network-functions-ipv6

Ifdown ifdown-ippp ifdown-post ifdown-sit ifdown-tunnel ifup-bnep ifup-ipv6 ifup-plusb ifup-routes ifup-TeamPort init.ipv6-global

[root@Hankwr312 network-scripts] # vi ifcfg-eth0 enters the configuration file of the network card

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=none

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=eth0

UUID=c8325dd6-476c-4e23-8ae5-59bc91732f2c

DEVICE=eth0

ONBOOT=yes

IPV6_PRIVACY=no

IPADDR=192.168.2.252

PREFIX=24

GATEWAY=192.168.2.1

DNS1=8.8.8.8

~

~

Description:

 device type: TYPE=Ethernet

 address assignment mode: BOOTPROTO=static

" Nic name: NAME=eno16777736

Whether  is started: ONBOOT=yes

" IP address: IPADDR=192.168.10.10

" subnet mask: NETMASK=255.255.255.0

" gateway address: GATEWAY=192.168.10.1

" DNS address: DNS1=192.168.10.1

The above is necessary, and the rest can be deleted. Back up the source configuration file at least before modifying it to avoid damage to the final configuration file.

4 、 ip addr

5. Graphical interface

Third, the network card is activated at startup (automatically connects to the network after startup)

1. Select during installation.

2. Use nmtui command.

An asterisk before the name of the network card indicates that the activation is successful.

3. Modify the network card configuration file

ONBOOT=yes

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