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

Configuration method for setting up a network on CentOS using vim so that CentOS can connect to the network

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

Share

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

This article mainly introduces "the configuration method of using vim to set up the network on CentOS so that CentOS can connect to the network". In the daily operation, it is believed that many people have doubts about the configuration method of setting up the network on CentOS so that CentOS can be connected to the network. The editor consulted all kinds of materials and sorted out simple and useful operation methods. I hope it will be helpful to answer your doubts about how to use vim to set up a network on CentOS so that CentOS can be connected to the Internet. Next, please follow the editor to study!

Several network-related commands are as follows:

Configure fixed IP addr

[root@localhost ~] # vi / etc/sysconfig/network-scripts/ifcfg-eth0

[root@localhost ~] # cat / etc/sysconfig/network-scripts/ifcfg-eth0

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]

DEVICE=eth0

BOOTPROTO=static

HWADDR=00:0C:29:D1:A6:ED

ONBOOT=yes

IPADDR=192.168.160.11

NETMASK=255.255.255.0

BROARDCAST=192.168.160.255

GATEWAY=192.168.160.1

[root@localhost ~] # / etc/init.d/network restart

Shutting down interface eth0: [OK]

Shutting down loopback interface: [OK]

Bringing up loopback interface: [OK]

Bringing up interface eth0: [OK]

[root@localhost ~] # ifconfig eth0

Eth0 Link encap:Ethernet HWaddr 00:0C:29:D1:A6:ED

Inet addr:192.168.160.11 Bcast:192.168.160.255 Mask:255.255.255.0

Inet6 addr: fe80::20c:29ff:fed1:a6ed/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:13960 errors:0 dropped:0 overruns:0 frame:0

TX packets:4796 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:3749651 (3.5 MiB) TX bytes:480572 (469.3 KiB)

Interrupt:75 Base address:0x2000

Configure DNS addr

[root@localhost ~] # vi / etc/resolv.conf

[root@localhost ~] # cat / etc/resolv.conf

Search localdomain

Nameserver 192.168.160.1

Nameserver 202.101.172.46

Modify hostname

[root@localhost ~] # vi / etc/sysconfig/network

[root@localhost ~] # cat / etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=leekwen.leekwen

[root@localhost ~] # ifconfig eth0

[root@localhost ~] # vi / etc/resolv.conf

[root@localhost ~] # cat / etc/resolv.conf

Search localdomain

Nameserver 192.168.160.1

Nameserver 202.101.172.46

At this point, the study on "the configuration method of using vim to set up the network on CentOS so that CentOS can connect to the Internet" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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