linux day06作业

作业:

1).在server主机上搭建dhcp服务,使得desktop主机可以动态获取ip

(ip范围为172.25.254.100-172.25.254.110之间);

-server主机操作:

systemctl stop firewalld

yum install dhcp -y

cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf

vim /etc/dhcp/dhcpd.conf

@@@

option domain-name "baidu.com";

option domain-name-server 172.25.254.11;

default-lease-time 600;

max-lease-time 7200;

log-facility loacl7;

subnet 172.25.254.0 netmask 255.255.255.0{

    range 172.25.254.210 172.25.254.220;

    option routers 172.25.254.11;

}

@@@

systemctl start dhcpd

systemctl status dhcpd

-desktop主机操作:

vim /etc/svsconfig/network-scrips/ifcfg-eth0

@@@

TYPE=Ethernet

BOOTPROTO=dhcp

NAME=eth0

DEVICE=eth0

ONBOOT=yes

@@@

systemctl restart network

ifconfig

2).在真机上搭建网络yum仓库,使得真机,desktop虚拟机,server虚拟机均可安装软件;

3).搭建的网络yum仓库,分别包含redhat7.0和redhat7.2版本;

-真机root用户

hostnamectl

mount rhel-server-7.0-x86_64-dvd.iso /rhel7.0

rm -fr /etc/yum.repos.d/*

vim /etc/yum.repos.d/rhel70.repo

@@@

[rhel7.0]

name=localsoftware

baseurl=file://rhel7.0

gpgcheck=0

@@@

yum clean all

yum repolist

yum install httpd -y

systemctl stop firewalld

systemctl start httpd

umount /rhel7.0

mkdir /var/www/html/rhel7/rhel7.0

mount rhel-server-7.0-x86_64-dvd.iso /var/www/html/rhel7/rhel7.0

mkdir /var/www/html/rhel7/rhel7.2

mount rhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7/rhel7.2

检测是否访问成功:firefox访问http://真机ip/rhel7/rhel7.0或http://真机ip/rhel7/rhel7.2

vim /etc/yum.repos.d/yum70.repo

@@@

[rhel7.0]

name=localsoftware

baseurl=http://真机ip/rhel7/rhel7.0

gpgcheck=0

@@@

vim /etc/yum.repos.d/yum72.repo

@@@

[rhel7.2]

name=localsoftware

baseurl=http://真机ip/rhel7/rhel7.2

gpgcheck=0

@@@

systemctl disable firewalld

systemctl enable httpd

vim /etc/fstab

/iso/rhel-server-7.0-x86_64-dvd.iso /var/www/html/rhel7/rhel7.0 iso9660 defaults 0 0

/iso/rhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7/rhel7.2 iso9660 defaults 0 0

mount -a

desktop和server主机的操作

hostnamectl

rm -fr /etc/yum.repos.d/*

vim /etc/yum.repos.d/rhel70.repo

vim /etc/yum.repos.d/yum70.repo

@@@

[rhel7.0]

name=localsoftware

baseurl=http://真机ip/rhel7/rhel7.0

gpgcheck=0

@@@

vim /etc/yum.repos.d/yum72.repo

@@@

[rhel7.2]

name=localsoftware

baseurl=http://真机ip/rhel7/rhel7.2

gpgcheck=0

@@@

4).desktop主机上查找ifconfig命令是由哪个软件包提供的,并将结果保存至/mnt/answer文件中;

desktop主机:

touch /mnt/answer

yum search ifconfig >> /mnt/answer

5).desktop将/mnt/answer文件无密码传输到真机kiosk用户的桌面;

desktop:172.25.254.142 desktop142.example.com

kiosk:172.25.254.42 kiosk42.example.com

desktop主机操作:

ssh -keygen

ls /root/.ssh/

ssh-copy-id-i /home/kiosk/.ssh/id_rsa.pub kiosk@172.25.254.42

ssh root@172.25.254.146

ctrl+d

ssh-copy-id -i /mnt/answer kiosk@172.25.254.42

kiosk真机操作:

cat /home/kiosk/.ssh/authorized_keys

6).以上操作系统重启后依旧生效;




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值