[root@localhost mnt]# w
02:04:32 up 7:00, 2 users, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty1 - 19:07 6:18m 0.26s 0.26s -bash
root pts/0 192.168.0.121 01:36 0.00s 0.22s 0.11s w
[root@localhost mnt]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:9E:BE:DE
inet addr:192.168.0.130 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe9e:bede/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12560 errors:0 dropped:0 overruns:0 frame:0
TX packets:3543 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1104561 (1.0 MiB) TX bytes:423198 (413.2 KiB)
Interrupt:19 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
[root@localhost mnt]#
如上图,我本机的ip为192.168.0.121,为什么链接用的是192.168.0.130,
且192.168.0.130这个ip是用dhclient命令获取的。
eth0 是你虚拟机的网卡,inet addr:192.168.0.130
root pts/0 192.168.0.121 指的是你连入虚拟机的主机 IP