1.通过dns分离技术解析www.qq.com主机ip地址,实现通过内网主机解析为内网服务主机,外网主机解析到外网主机。
2.配置A和B主机实现免密登录。
1.安装软件包并关闭防火墙、selinux
主配置文件
vim /etc/named.conf
options {
listen-on port 53 { 192.168.226.200; };
directory "/var/named";
allow-query { "any"; };
};
acl "china" { 192.168.226.200; };
acl "vmware" { 192.168.226.129; };
view "china" {
match-clients { "china"; };
zone "openlab.com" IN {
type master;
file "named.qq.com";
notify yes;
};
};
view "vmware" {
match-clients { "vmware"; };
zone "openlab.com" IN {
type master;
file "named.qq1.com";
notify yes;
};
};
配置named.qq.com和named.qq1.com文件
vim /var/named/named.qq.com
$TTL 1D
@ IN SOA @ admin.admin.com. (
2021071501
1D
1H
1W
3H )
IN NS dns.qq.com.
dns IN A 192.168.226.200
www IN A 192.168.226.111
vim /var/named/named.qq1.com
$TTL 1D
@ IN SOA @ admin.admin.com. (
2021071501
1D
1H
1W
3H )
IN NS dns.qq.com.
dns IN A 192.168.226.200
www IN A 192.168.226.222
重启服务
2.
在A主机上生成密钥对
ssh-keygen -t RSA -b 2048
在B主机家目录下创建.ssh目录,并在A主机上把A主机生成的公钥发送到该目录下
mkdir .ssh
scp /root/.ssh/id_rsa.pub root@192.168.226.129:/root/.ssh/authorized_keys
在A主机上实现免密登录B主机
ssh 192.168.226.129