进行此操作时需要将Linux 中的防火墙关闭...........
下面操作出现错误时internet连接共享访问被启用时出现错误解决方法
虚拟网络编辑器设置,其相当于是一个路由器
centos7 网络配置如下
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=2255047d-19fb-459b-b3ea-abc57c9772d9
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.137.110
NETMASK=255.255.255.0
GATEWAY=192.168.137.1
DNS1=8.8.8.8
NDS2=192.168.137.1
修改新服务器名称
[root@test03 ~]# hostnamectl set-hostname test04 # 使用这个命令会立即生效且重启也生效
[root@test03 ~]# hostname # 查看下
test04
部分使用vmware 克隆的服务器会出现网卡无法启动的情况,网上查询说是NetworkManager的问题,停掉后恢复正常
[root@test02 ~]# systemctl status NetworkManager.service
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-11-23 15:36:03 CST; 20min ago
Docs: man:NetworkManager(8)
Main PID: 7842 (NetworkManager)
Tasks: 3
Memory: 6.9M
CGroup: /system.slice/NetworkManager.service
└─7842 /usr/sbin/NetworkManager --no-daemon
Nov 23 15:36:06 test02 NetworkManager[7842]: <info> [1637652966.4196] ifcfg-rh: add connection in-memory (ae8c9d70-b4cb-46ac-bb80-1345edeb33b2,"docker0")
Nov 23 15:36:06 test02 NetworkManager[7842]: <info> [1637652966.4203] device (docker0): state change: unavailable -> disconnected (reason 'connection-assumed', sys-iface-state: 'external')
Nov 23 15:36:06 test02 NetworkManager[7842]: <info> [1637652966.4212] device (docker0): Activation: starting connection 'docker0' (ae8c9d70-b4cb-46ac-bb80-1345edeb33b2)
Nov 23 15:36:06 test02 NetworkManager[7842]: <info> [1637652966.4213] device (docker0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'external')
Nov 23 15:36:06 test02 NetworkManager[7842]: <info> [1637652966.4219] device (docker0): state change: prepare -> config (reason 'none', sys-iface-state: 'external')
Nov 23 15:36:06 test02 NetworkManager[7842]: <info> [1637652966.4223] device (docker0): state change: config -> ip-config (reason 'none', sys-iface-state: 'external')
Nov 23 15:36:06 test02 NetworkManager[7842]: <info> [1637652966.4227] device (docker0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'external')
Nov 23 15:36:06 test02 NetworkManager[7842]: <info> [1637652966.4235] device (docker0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'external')
Nov 23 15:36:06 test02 NetworkManager[7842]: <info> [1637652966.4238] device (docker0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'external')
Nov 23 15:36:06 test02 NetworkManager[7842]: <info> [1637652966.4327] device (docker0): Activation: successful, device activated.
[root@test02 ~]# systemctl stop NetworkManager.service
[root@test02 ~]# systemctl disable NetworkManager.service
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
Removed symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.
至此虚拟机上的虚拟系统网络的配置都已经OK了
桥接模式的配置
进入cd /etc/sysconfig/network-scripts/
目录修改ifcfg-eth0
如下,其他三个节点均作出修改,并service network restart
重启网卡成功后,修改三个节点的etc下hosts目录。具体ip要根据自己电脑所属网段进行相应修改即可,填写固定IP时要先ping一下要设置的ip地址小心地址冲突。
去掉ip使用dhcp指定IP更新版
yum install 出现无法解析主机地址的错误,需要修改一下DNS的配置
[root@cdh1 etc]# yum install lrzsz
Loaded plugins: fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirrors.163.com/centos/7.4.1708/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.163.com; Unknown error"
解决办法
[root@cdh2 ~]# vim /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.137.1