通过宿主机查看KVM中服务器IP

  • 查看已经启动的服务器

    eric@ray:~
    $ virsh list
     Id    Name                           State
    ----------------------------------------------------
     1     userver                        running
    
    
  • 查看虚拟机对应的mac地址

    eric@ray:~
    $ virsh dumpxml userver
    <domain type='kvm' id='1'>
      <name>userver</name>
      <uuid>2677045a-35a2-4730-99f7-ec8ed2a453da</uuid>
      <memory unit='KiB'>2097152</memory>
      
      ....
      
        </controller>
        <interface type='network'>
          <mac address='52:54:00:58:f0:63'/> #mac地址
          <source network='default' bridge='virbr0'/>
    
       ......
       
      
    
  • 查看mac地址对应的ip

    eric@ray:~ 
    $ arp -a
    ? (10.128.3.252) at 74:25:8a:ea:c1:54 [ether] on wlp4s0
    ? (10.128.3.253) at 74:25:8a:ea:c2:9c [ether] on wlp4s0
    ? (192.168.122.190) at 52:54:00:58:f0:63 [ether] on virbr0 #这个是对应的ip
    _gateway (10.128.3.254) at 00:00:5e:00:01:01 [ether] on wlp4s0
    
    
  • ssh登录

    eric@ray:~
    $ ssh [email protected]
    [email protected]'s password: 
    Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-36-generic x86_64)
    
     * Documentation:  https://help.ubuntu.com
     * Management:     https://landscape.canonical.com
     * Support:        https://ubuntu.com/advantage
    
      System information as of Thu Oct 25 02:25:38 UTC 2018
    
      System load:  0.0               Processes:           94
      Usage of /:   4.3% of 97.93GB   Users logged in:     0
      Memory usage: 7%                IP address for ens3: 192.168.122.190
      Swap usage:   0%
    
    
     * Canonical Livepatch is available for installation.
       - Reduce system reboots and improve kernel security. Activate at:
         https://ubuntu.com/livepatch
    
    28 packages can be updated.
    0 updates are security updates.
    
    
    Last login: Mon Oct 15 08:20:04 2018 from 192.168.122.1
    eric@oracle12c:~$ 
    
    

你可能感兴趣的:(Linux)