- CentOS 版本:CentOS-7-x86_64-DVD-1804.iso
ifconfig 命令问题
[root@localhost ~]# ifconfig
-bash: ifconfig: command not found
若 CentOS 里边是没有安装 ifconfig
解决办法:yum安装ifconfig这个命令包
# 需要保证虚拟机能连接外网
yum search ifconfig
yum install net-tools.x86_64
通信问题
NAT | Bridged Adapter | Internal | Host-only Adapter | |
---|---|---|---|---|
虚拟机->主机 | ✔️ | ✔️ | ❌ | 默认不需要设置 |
主机->虚拟机 | ❌ | ✔️ | ❌ | 默认不需要设置 |
虚拟机->其他主机 | ✔️ | ✔️ | ❌ | 默认不需要设置 |
其他主机->虚拟机 | ❌ | ✔️ | ❌ | 默认不需要设置 |
虚拟机之间 | ❌ | ✔️ | 同网络名下可以 | ✔️ |
需要的条件:主机能 ssh 连接虚拟机,虚拟机能连接外网
- 网卡1:桥接网络
- 网卡2:网络地址转换(NAT)
[root@localhost ~]# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.119 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::8aae:e52f:c521:efb prefixlen 64 scopeid 0x20<link>
ether 08:00:27:67:bd:5c txqueuelen 1000 (Ethernet)
RX packets 140 bytes 13812 (13.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 100 bytes 11757 (11.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.3.15 netmask 255.255.255.0 broadcast 10.0.3.255
inet6 fe80::8c29:2c4a:8682:b9f5 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:06:46:d4 txqueuelen 1000 (Ethernet)
RX packets 4 bytes 814 (814.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15 bytes 1400 (1.3 KiB)
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 1000 (Local Loopback)
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
网友评论