师说部署
在vm虚拟网络编辑器 配置vmnet1与wmnet8
电脑端IP192.168.x.1 掩码24 无需网关配置
添加第二个网卡
删除网卡nmcli connection show
nmcli connection delete ens160
添加网卡nmcli connection add type ethernet ifname eth0 con-name eth0
nmcli connection add type ethernet ifname eth1 con-name eth1
修改IP地址nmcli connection modify eth0 ipv4.method manual ipv4.addresses 192.168.8.3/24 autoconnect yes nmcli connection up eth0
nmcli connection modify eth1 ipv4.method manual ipv4.addresses 192.168.9.3/24 ipv4.gateway 192.168.9.2 autoconnect yes nmcli connection up eth1
配置dnsecho "nameserver 192.168.9.2" >> /etc/resolv.conf
测试ping baidu.com
使用脚本修改IP地址和主机名
~]# vim /usr/bin/sethost #!/bin/bash nmcli connection modify eth1 ipv4.method manual ipv4.addresses 192.168.99.$1/24 ipv4.gateway 192.168.99.2 autoconnect yes nmcli connection up eth1 nmcli connection modify eth0 ipv4.method manual ipv4.addresses 192.168.88.$1/24 autoconnect yes nmcli connection up eth0 hostnamectl set-hostname $2 echo "nameserver 192.168.99.2" >> /etc/resolv.conf ~]# chmod +x /usr/bin/sethost
通过执行sethost把当前模板机的IP改为192.168.8.3和192.168.9.3~]# sethost 3 a
查看网卡配置信息cat /etc/sysconfig/network-scripts/ifcfg-eth0
cat /etc/sysconfig/network-scripts/ifcfg-eth1
关闭selinux,卸载防火墙
1 |
|
克隆三台虚拟机
192.168.8.10 nginx
192.168.8.11 tomcat
192.168.8.12 dnssethost 10 nginx
sethost 11 tomcat
sethost 12 dns
配置tomcat
从课件材料中把tomcat上传到tomcat01机器上 apache-tomcat-8.0.30.tar.gz (tmp路径下)
1 |
|