VMware Workstation下centOS互联
程序员文章站
2022-07-13 10:17:10
...
目标
- 修改配置文件,使之可以与主机及外网互联
- 启用sshd服务,使用SecureCRT连接centOS
VMware Workstation网络配置
点击菜单 Edit > Preferences,点击NAT Settings
配置网关IP,一般默认即可,也可以自己修改
注:下面的CentOS中会用这里配置的网关、子网掩码
查看本机的DNS IP
注:下面的CentOS中会用这里DNS IP
CentOS网络配置
[aaa@qq.com /]# cd /etc/sysconfig/network-scripts/ #切换至network-scripts目录下
[aaa@qq.com network-scripts]# vi ifcfg-ens33 #编辑ifcfg打头的文件
修改
BOOTPROTO=static #动态为dhcp
ONBOOT=yes #原先为no
添加
IPADDR=192.168.123.130 #设置IP地址
GATEWAY=192.168.123.2 #设置网关
NETMASK=255.255.255.0 #设置子网掩码
DNS1=192.168.0.1 #设置DNS
DNS2=8.8.8.8 #google提供的免费DNS服务器的IP地址
DNS3=8.8.4.4 #google提供的另一个免费DNS服务器的IP地址
[aaa@qq.com network-scripts]# service network restart #重启网络服务
[aaa@qq.com network-scripts]# ping www.baidu.com #ping外网
PING www.a.shifen.com (119.75.213.61) 56(84) bytes of data.
64 bytes from 119.75.213.61 (119.75.213.61): icmp_seq=1 ttl=128 time=30.3 ms
64 bytes from 119.75.213.61 (119.75.213.61): icmp_seq=2 ttl=128 time=30.8 ms
64 bytes from 119.75.213.61 (119.75.213.61): icmp_seq=3 ttl=128 time=31.3 ms
[aaa@qq.com network-scripts]# yum install net-tools #安装网络工具,如果不安装无法使用ifconfig等工具
[aaa@qq.com network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.123.131 netmask 255.255.255.0 broadcast 192.168.123.255
inet6 fe80::97b8:f5ed:5cf4:6b9d prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:83:9b:ed txqueuelen 1000 (Ethernet)
RX packets 2203 bytes 269053 (262.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1678 bytes 412661 (402.9 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
[aaa@qq.com network-scripts]# yum list installed | grep openssh-server #如果运行如下,则说明已经安装了ssh服务
openssh-server.x86_64 7.4p1-16.el7 @anaconda
[aaa@qq.com network-scripts]# yum install openssh-server #如果没有,则运行此命令安装
[aaa@qq.com network-scripts]# cd /etc/ssh/
[aaa@qq.com ssh]# ls
moduli ssh_config sshd_config ssh_host_ecdsa_key ssh_host_ecdsa_key.pub ssh_host_ed25519_key ssh_host_ed25519_key.pub ssh_host_rsa_key ssh_host_rsa_key.pub
[aaa@qq.com ssh]# vi sshd_config #编辑ssh配置,去掉如下属性的注释
Port 22
ListenAddress 0.0.0.0
ListenAddress ::
PermitRootLogin yes
PasswordAuthentication yes
[aaa@qq.com ssh]# sudo service sshd start #启动sshd服务
[aaa@qq.com ssh]# ps -ef | grep sshd #检查sshd服务是否已经开启
[aaa@qq.com ssh]# netstat -an | grep 22 #检查22号端口是否开启监听
一切正常后,便可以通过远程工具SecureCRT连接centOS。
如何在VMware Workstation下安装centOS可以参照 VMware Workstation 14安装Centos 7
上一篇: 基于haar特征+adboost分类器的人脸检测算法----haar特征
下一篇: VMware Workstation Pro14安装ubuntu 16.04 一 (所需软件的下载方式、安装)
推荐阅读
-
VMware Workstation 11 虚拟机安装Centos 6.6系统图文教程
-
VMware下Centos7桥接方式网络配置步骤详解
-
Linux下VMware workstation的3种使用技巧
-
VMware Workstation中就该是这样安装CentOS7系统(含真机装系统的采坑之旅)!
-
VMware Workstation虚拟机自动安装CentOS问题的解决方法
-
VMware Workstation 11 虚拟机安装Centos 6.6系统图文教程
-
VMware Workstation Pro下CentOS 7 64位服务器安装教程
-
VMware Workstation 12永久密钥 VMware Workstation 12下载注册问题汇总
-
VMware10下CentOS 7安装配置图文教程
-
vmware workstation 11下载地址 vmware 11虚拟机官方下载及新功能