linux虚拟机如何配置网卡信息(确保两台服务器可以通信)

1、分别使用vmware将两台linux虚拟机还原至安装的初始状态(前提是已经创建快照,实验目的是配置网卡信息,确保两台主机可以通信,因此需要两台虚拟机)

linux虚拟机如何配置网卡信息(确保两台服务器可以通信)

 

 

 

2、为了更加清晰的分辨两台主机,先分别配置主机名称,并查看系统版本

[root@linuxprobe Desktop]# vim /etc/hostname  ## 修改虚拟机1主机名称
host1
[root@linuxprobe Desktop]# hostname  ## 查看
host1
[root@linuxprobe Desktop]# hostnamectl  ## 查看系统信息
   Static hostname: host1
         Icon name: computer
           Chassis: n/a
        Machine ID: 3475295383774df4b83491fd573fbbc2
           Boot ID: 71ab80ee01054f5b84d6cd935259a977
    Virtualization: vmware
  Operating System: Red Hat Enterprise Linux Server 7.0 (Maipo)
       CPE OS Name: cpe:/o:redhat:enterprise_linux:7.0:GA:server
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64
[root@linuxprobe Desktop]# reboot  ## 重启,是主机名称生效

 linux虚拟机如何配置网卡信息(确保两台服务器可以通信)

 

 

[root@linuxprobe Desktop]# vim /etc/hostname  ## 修改虚拟机2主机名称
host2
[root@linuxprobe Desktop]# hostname  ## 查看
host2
[root@linuxprobe Desktop]# hostnamectl  ## 查看系统版本信息,也是RHEL7
   Static hostname: linuxprobe.com
         Icon name: computer
           Chassis: n/a
        Machine ID: 94333412b1ab4fb8b024d9b7038e4caa
           Boot ID: 3998b9eeab3f45ffa78549f214f057ae
    Virtualization: vmware
  Operating System: Red Hat Enterprise Linux Server 7.0 (Maipo)
       CPE OS Name: cpe:/o:redhat:enterprise_linux:7.0:GA:server
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64
[root@linuxprobe Desktop]# reboot ## 重启使主机名称生效

linux虚拟机如何配置网卡信息(确保两台服务器可以通信)

 

 

2、分别查看两台虚拟机的网卡信息

[root@host1 Desktop]# ifconfig  ## 查看虚拟机1网卡信息,有网卡名称,MAC地址,但是没有IP信息
eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:0c:29:e4:f7:b9  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 658  bytes 51740 (50.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 658  bytes 51740 (50.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
[root@host2 Desktop]# ifconfig  ## 查看虚拟机2的网卡信息,有网卡名称,MAC地址,但是没有IP
eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:0c:29:aa:2b:29  txqueuelen 1000  (Ethernet)
        RX packets 1  bytes 243 (243.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 530  bytes 41628 (40.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 530  bytes 41628 (40.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

3、分别修改两台虚拟机的网卡配置文件

linux虚拟机如何配置网卡信息(确保两台服务器可以通信)

上一篇:hbase的基本shell命令


下一篇:规范主机名和设置最大文件进程数