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 configure the network card for CentOS7.1

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

Share

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

This article is about how to configure the network card in CentOS7.1. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Next, I will introduce the network card configuration in 7, including the problems I have encountered.

After installing in the VMware virtual machine

Execute ifconfig

You will find that the information of the network card has changed.

# ifconfig

Eno16777736: flags=4163 mtu 1500

Inet 192.168.66.104 netmask 255.255.255.0 broadcast 192.168.66.255

Inet6 fe80::20c:29ff:fe8f:994b prefixlen 64 scopeid 0x20

Ether 00:0c:29:8f:99:4b txqueuelen 1000 (Ethernet)

RX packets 94480 bytes 139993185 (133.5 MiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 38775 bytes 2602634 (2.4 MiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

The original eth0/eh2 has become the current enoxxxxxxx (just after watching it, I really want to vomit blood)

As usual, first enter / etc/sysconfig/network-scripts, find the configuration file of the ifcfg-enoxxxxxx network card, and modify it to the sample paper in the following format.

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

TYPE=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.66.2 / / IP address

NETNASK=255.255.255.0 / / subnet mask

GATEWAY=192.168.66.1 / / Gateway

DNS1=8.8.8.8 / / DNS

# DEVICE=eth0

After you have modified the configuration file, execute it and confirm the network card information you set up.

Modify the network configuration through the text tool nmtui (RHEL7/CentOS7 is installed by default, provided that NetworkManager.service is enabled before you can use it)

# nmtui-edit enoxxxxxxx

Then connect it, and OK it when the connection is successful.

# nmtui-connect enoxxxxxxxx

During this period, I don't know if my friends will encounter that there is no HWADDR parameter in the network card configuration file, which is what we call the MAC address. Anyway, I encountered it and bothered me for ten minutes, and finally solved it.

The problem is, when you restart the network card,

[root@localhost ~] # systemctl restart network

Job for network.service failed. See 'systemctl status network.service' and' journalctl-xn' for details.

This error should be caused by the difference between the MAC address parameter in your configuration file and that in ifconfig. The solution is

# ifconfig

Eno16777736: flags=4163 mtu 1500

Inet 192.168.66.104 netmask 255.255.255.0 broadcast 192.168.66.255

Inet6 fe80::20c:29ff:fe8f:994b prefixlen 64 scopeid 0x20

Ether 00:0c:29:8f:99:4b txqueuelen 1000 (Ethernet)

RX packets 94480 bytes 139993185 (133.5 MiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 38775 bytes 2602634 (2.4 MiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Write the MAC address of ipv4 printed above into the configuration file of the network card, and then restart will not have this problem, of course, IPV6 said otherwise.

Modify the hostname:

Vi / etc/hostname

Save exit and log back in

# hostname

Control

Thank you for reading! This is the end of the article on "how to configure the network card in CentOS7.1". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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