2024年11月在CentOS上如何使用vim设置网络

发布时间:

  ⑴在安装完CentOS系统后,就要对CentOS系统进行网络相关设置了,以便CentOS能够联网,下面小编给大家介绍下CentOS使用vim手动配置网络相关的方法,会涉及到一些命令使用,感兴趣的话可以来了解下。

  ⑵网络相关的几个命令如下:

  ⑶配置固定IP地址

  ⑷[rootlocalhost ~]# vi /etc/sysconfig/work-scripts/ifcfg-eth

  ⑸[rootlocalhost ~]# cat /etc/sysconfig/work-scripts/ifcfg-eth

  ⑹# Advanced Micro Devices [AMD] c [Pet LANCE]

  ⑺DEVICE=eth

  ⑻BOOTPROTO=static

  ⑼HWADDR=:C::D:A:ED

  ⑽ONBOOT=yes

  ⑾IPADDR=...

  ⑿MASK=...

  ⒀BROARDCAST=...

  ⒁GATEWAY=...

  ⒂[rootlocalhost ~]# /etc/init.d/work restart

  ⒃Shutting down interface eth: [ OK ]

  ⒄Shutting down loopback interface: [ OK ]

  ⒅Bringing up loopback interface: [ OK ]

  ⒆Bringing up interface eth: [ OK ]

  ⒇[rootlocalhost ~]# ifconfig eth

  ⒈eth Link encap:Ether HWaddr :C::D:A:ED

  ⒉i addr:... Bcast:... Mask:...

  ⒊i addr: fe::c:ff:fed:aed/ Scope:Link

  ⒋UP BROADCAST RUNNING MULTICAST MTU: Metric:

  ⒌RX packets: errors: dropped: overruns: frame:

  ⒍TX packets: errors: dropped: overruns: carrier:

  ⒎collisions: txqueuelen:

  ⒏RX bytes: (. MiB TX bytes: (. KiB

  ⒐Interrupt: Base address:x

  ⒑[rootlocalhost ~]# vi /etc/resolv.conf

  ⒒[rootlocalhost ~]# cat /etc/resolv.conf

  ⒓search localdomain

  ⒔nameserver ...

  ⒕nameserver ...

  ⒖[rootlocalhost ~]#vi /etc/sysconfig/work

  ⒗[rootlocalhost ~]# cat /etc/sysconfig/work

  ⒘WORKING=yes

  ⒙WORKING_IPV=no

  ⒚HOSTNAME=leekwen.leekwen

  ⒛[rootlocalhost ~]# ifconfig eth

  ①[rootlocalhost ~]# vi /etc/resolv.conf

  ②[rootlocalhost ~]# cat /etc/resolv.conf

  ③search localdomain

  ④nameserver ...

  ⑤nameserver ...

  ⑥上面就是CentOS使用vim配置网络相关的方法介绍了,需要配置固定ip地址、DNS地址、修改主机名,本文介绍的是在vim下的设置,需要用到vim。