Centos 7.1安裝後修改主機名及網路配置
Centos 7.1下修改主機名:
[root@localhost ~]# hostnamectl status
Static hostname: localhost.localdomain
Icon name: computer
Chassis: n/a
Machine ID: caa35e54020e4930a35b28c8e501b51a
Boot ID: 95321dfa104f423d9d1fc7dbade66dbb
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-229.el7.x86_64
Architecture: x86_64
[root@localhost ~]# hostnamectl set-hostname linfytest3
[root@localhost ~]# hostnamectl status
Static hostname: linfytest3
Icon name: computer
Chassis: n/a
Machine ID: caa35e54020e4930a35b28c8e501b51a
Boot ID: 95321dfa104f423d9d1fc7dbade66dbb
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-229.el7.x86_64
Architecture: x86_64
Centos 7.1網路配置
新安裝的Centos7.1如何配通網路,如下:
在Centos7.1中檢視網路配置不建議使用ifconfig,而是ip addr
1、在/etc/hosts中配置
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.0.2.151 linfytest3 linfytest3.example.com
2、在/etc/sysconfig/network-scripts中配置
vi ifcfg-eno16777736 --注意,已經不是 ifcfg-eth0
增加配置項:
IPADDR=192.0.2.151
NETMASK=255.255.255.0
NM_CONTROLLED=no
“NM_CONTROLLED=no”表示該介面將透過該配置檔案進行設定,而不是透過網路管理器進行管理。“ONBOOT=yes”告訴我們,系統將在啟動時開啟該介面。
修改配置項:
BOOTPROTO=no (原來是BOOTPROTO=dhcp)
ONBOOT=no (原來是ONBOOT=yes)
3、重啟服務
systemctl restart network.service
4、檢視網路配置
[root@linfytest3 network-scripts]# ip addr
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:7d:3b:1c brd ff:ff:ff:ff:ff:ff
inet 192.0.2.151/24 brd 192.0.2.255 scope global eno16777736
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe7d:3b1c/64 scope link
valid_lft forever preferred_lft forever
3: virbr0: mtu 1500 qdisc noqueue state DOWN
link/ether 52:54:00:98:74:f4 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 500
link/ether 52:54:00:98:74:f4 brd ff:ff:ff:ff:ff:ff
5、如果是虛機VMWARE,需要將 VMnet1的地址配置成一個網段192.0.2.X
[root@localhost ~]# hostnamectl status
Static hostname: localhost.localdomain
Icon name: computer
Chassis: n/a
Machine ID: caa35e54020e4930a35b28c8e501b51a
Boot ID: 95321dfa104f423d9d1fc7dbade66dbb
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-229.el7.x86_64
Architecture: x86_64
[root@localhost ~]# hostnamectl set-hostname linfytest3
[root@localhost ~]# hostnamectl status
Static hostname: linfytest3
Icon name: computer
Chassis: n/a
Machine ID: caa35e54020e4930a35b28c8e501b51a
Boot ID: 95321dfa104f423d9d1fc7dbade66dbb
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-229.el7.x86_64
Architecture: x86_64
Centos 7.1網路配置
新安裝的Centos7.1如何配通網路,如下:
在Centos7.1中檢視網路配置不建議使用ifconfig,而是ip addr
1、在/etc/hosts中配置
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.0.2.151 linfytest3 linfytest3.example.com
2、在/etc/sysconfig/network-scripts中配置
vi ifcfg-eno16777736 --注意,已經不是 ifcfg-eth0
增加配置項:
IPADDR=192.0.2.151
NETMASK=255.255.255.0
NM_CONTROLLED=no
“NM_CONTROLLED=no”表示該介面將透過該配置檔案進行設定,而不是透過網路管理器進行管理。“ONBOOT=yes”告訴我們,系統將在啟動時開啟該介面。
修改配置項:
BOOTPROTO=no (原來是BOOTPROTO=dhcp)
ONBOOT=no (原來是ONBOOT=yes)
3、重啟服務
systemctl restart network.service
4、檢視網路配置
[root@linfytest3 network-scripts]# ip addr
1: lo:
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736:
link/ether 00:0c:29:7d:3b:1c brd ff:ff:ff:ff:ff:ff
inet 192.0.2.151/24 brd 192.0.2.255 scope global eno16777736
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe7d:3b1c/64 scope link
valid_lft forever preferred_lft forever
3: virbr0:
link/ether 52:54:00:98:74:f4 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic:
link/ether 52:54:00:98:74:f4 brd ff:ff:ff:ff:ff:ff
5、如果是虛機VMWARE,需要將
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/543979/viewspace-1669106/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- centOS修改主機名,重啟後無效解決CentOS
- centos7 系統必要的配置(設定網路服務自啟,修改主機名)CentOS
- Centos修改網路配置CentOS
- CentOS7 安裝 配置網路CentOS
- VMware 安裝 Centos 7 虛擬機器配置網路CentOS虛擬機
- VMware安裝CentOS虛擬機器與配置網路CentOS虛擬機
- 網路裝置配置與管理————11、配置主機名、時鐘、IP地址
- Linux7修改主機IP及主機名Linux
- 如何修改mac 下主機名、電腦名、區域網主機名Mac
- LINUX如何手工配置網路和主機名Linux
- linux CentOS6.x 修改主機名(Hostname)LinuxCentOS
- virtualbox虛擬機器上安裝centOS的網路配置虛擬機CentOS
- centos安裝後配網CentOS
- CentOS 7的網路配置以及設定主機名和繫結IP的問題CentOS
- Linux修改主機名(靜態主機名、臨時主機名)Linux
- 在CentOS 8上安裝與配置Apache虛擬主機CentOSApache
- Redis安裝及主從配置Redis
- CentOS7編譯安裝php7.1配置教程詳解CentOS編譯PHP
- MAC修改主機名、計算機名Mac計算機
- Centos7中網路及裝置相關配置CentOS
- Centos7系統下修改主機名操作筆記CentOS筆記
- CentOS 7 安裝、配置、使用 PostgreSQL 10 安裝及基礎配置CentOSSQL
- CentOS7.6 下 Redis4 編譯安裝及主從配置CentOSRedis編譯
- 最小化安裝centos7下配置網路CentOS
- vmware中安裝centos6.5配置網路環境CentOS
- VMware安裝CentOS-6 minimal的網路配置CentOS
- Ubuntu Server修改主機名UbuntuServer
- Linux 修改主機名Linux
- 修改linux主機名Linux
- Linux修改主機名Linux
- ubuntu修改主機名稱Ubuntu
- centos7配置網路及sshCentOS
- RHEL及CentOS網路配置詳解CentOS
- 使用 Cobbler 安裝一臺 CentOS 主機CentOS
- 修改主機名後DB2的設定方法DB2
- CentOS 6 安裝MAVEN及系統配置CentOSMaven
- Centos安裝tomcat9及配置CentOSTomcat
- centos7.1安裝 python2.7.10CentOSPython