vim '网卡配置文件' [ethernet] method=manual address1=10.4.220.100/24,10.4.220.1
在Ubuntu上测试连通性
root@WaitAyaka:/home/waitayaka/桌面# ping 10.4.220.100 PING 10.4.220.100 (10.4.220.100) 56(84) bytes of data. 64 bytes from 10.4.220.100: icmp_seq=1 ttl=63 time=1.66 ms 64 bytes from 10.4.220.100: icmp_seq=2 ttl=63 time=1.66 ms 64 bytes from 10.4.220.100: icmp_seq=3 ttl=63 time=1.62 ms 64 bytes from 10.4.220.100: icmp_seq=4 ttl=63 time=1.68 ms 64 bytes from 10.4.220.100: icmp_seq=5 ttl=63 time=1.73 ms
Ubuntu远程连接
比赛的时候PC是Ubuntu 所以我们还是要配置以下远程连接 使得可以在Ubuntu远程操控
Rocky上的配置
编辑/etc/ssh/sshd_conf文件 允许使用root用户进行SSH
40 PermitRootLogin yes
重启ssh服务
systemctl restart sshd
Ubuntu上的配置
root@WaitAyaka:/home/waitayaka/桌面# ssh 10.4.220.100 root@10.4.220.100's password: //输入root用户的密码 Activate the web console with: systemctl enable --now cockpit.socket Last failed login: Tue Apr 23 09:24:05 EDT 2024 on pts/0 There were 8 failed login attempts since the last successful login. Last login: Mon Mar 20 00:24:56 2023 from 10.4.11.100
[root@10-4-220-100 ~]#
配置网络源仓库
网络源仓库也是相当重要的这是我们KVM创建虚拟机的软件仓库 可以远程之后在Rocky上进行以下操作
下载相关软件包
yum install -y httpd*
将镜像挂载到/var/www/html/cdrom下面
mkdir /var/www//html/cdrom -p mount /opt/rocky9.2.iso /var/www/html/cdrom
编辑cdrom目录权限
vim /etc/httpd/conf/httpd.conf359 <Directory "/var/www/html"> · 最后添加以下参数 360 Require all granted 361 Options Indexes FollowSymLinks 362 AllowOverride ALL 363 </Directory>
vim /etc/NetworkManager/system-connections/bridge-slave-enp0s20f0u3u2.nmconnection 9 [ethernet] 10 method=auto //将method模式改为auto 表示自动获取IP
bridge 桥接网卡
vim /etc/NetworkManager/system-connections/bridge-br0.nmconnection 12 method=manual 13 address1=10.4.220.100/24,10.4.220.1 //这里设置为题目要求的IP 23国赛为10.4.220.100
重启网卡
[root@10-4-220-100 ~]# nmcli c up ens160 连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/10) [root@10-4-220-100 ~]# nmcli c up bridge-br0 连接已成功激活(master waiting for slaves)(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/11)
waitayaka@WaitAyaka:~/桌面$ ping 10.4.220.101 PING 10.4.220.102 (10.4.220.102) 56(84) bytes of data. 64 bytes from 10.4.220.101: icmp_seq=1 ttl=63 time=3.73 ms 64 bytes from 10.4.220.101: icmp_seq=2 ttl=63 time=2.09 ms 64 bytes from 10.4.220.101: icmp_seq=3 ttl=63 time=1.99 ms 64 bytes from 10.4.220.101: icmp_seq=4 ttl=63 time=2.09 ms