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

The configuration method of Network under centos

2025-02-28 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 configure the network under centos". Many people will encounter such a dilemma in the operation of actual cases, 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!

Centos network configuration example

1, configure DNS

Vi / etc/resolv.conf

Join:

The code is as follows:

Nameserver 192.168.0.1

Nameserver 8.8.8.8

Nameserver 8.8.4.4

2. Configure the gateway:

Vi / etc/sysconfig/network

Join:

GATEWAY=192.168.0.1

The complete ones are as follows:

The code is as follows:

NETWORKING=yes

HOSTNAME=localhost.localdomain

GATEWAY=192.168.0.1

3. Configure ip address:

Vi / etc/sysconfig/network-scripts/ifcfg-eth0

The contents are as follows:

The code is as follows:

DEVICE= "eth0"

HWADDR= "00:0C:29:6C:BB:E6"

NM_CONTROLLED= "yes"

ONBOOT= "no"

NETMASK=255.255.255.0

IPADDR=192.168.0.8

GATEWAY=192.168.0.1

BOOTPROTO=static

ONBOOT=yes

PEERDNS=yes

4, restart the service:

The code is as follows:

/ etc/init.d/network restart

Or use the command:

Service network restart

Or:

Ifdown eth0 and ifup eth0

After the configuration is complete, ping the gateway to check whether you can ping or use ifconfig eth0, and check the actual configured ip address.

This is the end of the content of "how to configure the Network under centos". Thank you for your 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