linux虚拟机终端步骤:
[[email protected] ~]# vi /etc/sysconfig/netowrk-script/ifcfg-ens33 //配置网卡信息
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static" //static是静态IP(手动设置固定的ip)、dhcp是动态IP(自动获取ip)、none是不指定
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="eaef65c8-20e6-4f72-84d3-670483d76f01"
DEVICE="ens33"
ONBOOT="yes"
IPADDR=192.168.200.111 //配置IP
NETMASK=255.255.255.0 //配置子网掩码
DNS1=202.106.0.20 //配置DNS
GATEWAY=192.168.200.1 //配置网关
[[email protected] ~]# systemctl restart network //重启网卡
=========================================================
windows虚拟机IP配置
关闭防火墙
设置IP
==========================================================
XShell中linux虚拟机步骤:
[[email protected] etc]# rpm -q bind
[[email protected] etc]# yum -y install bind
[[email protected] ~]# mount /dev/sr0 /media/
mount: /dev/sr0 写保护,将以只读方式挂载
[[email protected] ~]# ls /media/
CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7
EFI images Packages RPM-GPG-KEY-CentOS-Testing-7
EULA isolinux repodata TRANS.TBL
[[email protected] ~]# cd /etc/yum.r*
[[email protected] yum.repos.d]# mkdir a/
[[email protected] yum.repos.d]# mv C* a/
[[email protected] yum.repos.d]# vi ./local.repo //建立yum仓库
[moter]
name=moter
baseurl=file:///media
enabled=1
gpgcheck=0
[[email protected] yum.repos.d]# yum -y clean all //清除yum仓库缓存
已加载插件:fastestmirror, langpacks
正在清理软件源: moter
Other repos take up 469 M of disk space (use --verbose for details)
[[email protected] yum.repos.d]# yum makecache //重建yum缓存
正在安装 : 32:bind-9.9.4-72.el7.x86_64 1/1
验证中 : 32:bind-9.9.4-72.el7.x86_64 1/1
已安装:
bind.x86_64 32:9.9.4-72.el7
完毕!
[[email protected] yum.repos.d]# cd /etc/ //进入/etc
[[email protected] etc]# vim named.conf //配置named.conf文件
options {
listen-on port 53 { 192.168.200.111; }; //指定访问IP地址
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { 192.168.200.0/24; }; //指定网关
recursion yes;
};
zone "." IN {
type hint;
file "named.ca";
};
[[email protected] etc]# systemctl restart named //重启named服务
[[email protected] etc]# systemctl stop firewalld //关闭防火墙
[[email protected] etc]#iptables -F //清除iptables规则
[[email protected] etc]# setenforce 0 //关闭selinux安全机制
[[email protected] etc]# ping www.baidu.com
64 bytes from 182.61.200.6 (182.61.200.6): icmp_seq=2 ttl=128 time=33.9 ms
64 bytes from 182.61.200.6 (182.61.200.6): icmp_seq=3 ttl=128 time=36.9 ms
64 bytes from 182.61.200.6 (182.61.200.6): icmp_seq=4 ttl=128 time=36.8 ms
原文地址:https://www.cnblogs.com/cxm123123form/p/11368451.html