cv大法好

  • 查看端口占用

  • 从test-vm到uswap-vm

       ssh root@10.206.133.97 -p 2222
    
  • uswap run sh

qemu-system-x86_64 -enable-kvm 
-name uswap,debug-threads=on 
-cpu host 
-smp 8 
-m 16G 
-kernel /home/shiyue/USWAP/uswap-dev/build/linux-install/vmlinuz-5.14.0+ 
-drive file=/home/shiyue/USWAP/uswap-dev/build/br2-uswap-vm/images/rootfs.ext2,if=virtio,format=raw 
-append "console=ttyS0 nokaslr initcall_debug root=/dev/vda uswapd_cfg=uswap.ini" 
-device virtio-net-pci,netdev=hostnet0,id=net0,bus=pci.0,addr=0x3 
-netdev user,id=hostnet0,hostfwd=tcp::2233-:2233,hostfwd=tcp::2222-:22 
-nographic 
-fsdev local,id=sharedfs0,path=/home/shiyue/USWAP/uswap-dev/build/br2-uswap-vm-rfs-overlay/usr,security_model=none 
-device virtio-9p-pci,fsdev=sharedfs0,mount_tag=sharedfs0 
-fsdev local,id=sharedfs1,path=/home/shiyue/USWAP/uswap-dev/build/br2-test-vm/images,security_model=none 
-device virtio-9p-pci,fsdev=sharedfs1,mount_tag=sharedfs1
  • qemu cmd running uswap-vm
qemu-system-x86_64 -enable-kvm -name uswap,debug-threads=on -cpu host -smp 8 -m 16G -kernel /home/shiyue/USWAP/uswap-dev/build/linux-install/vmlinuz-5.14.0+ -drive file=/home/shiyue/USWAP/uswap-dev/build/br2-uswap-vm/images/rootfs.ext2,if=virtio,format=raw -append "console=ttyS0 nokaslr initcall_debug root=/dev/vda uswapd_cfg=uswap.ini" -device virtio-net-pci,netdev=hostnet0,id=net0,bus=pci.0,addr=0x3 -netdev user,id=hostnet0,hostfwd=tcp::2233-:2233,hostfwd=tcp::2222-:22 -nographic -fsdev local,id=sharedfs0,path=/home/shiyue/USWAP/uswap-dev/build/br2-uswap-vm-rfs-overlay/usr,security_model=none -device virtio-9p-pci,fsdev=sharedfs0,mount_tag=sharedfs0 -fsdev local,id=sharedfs1,path=/home/shiyue/USWAP/uswap-dev/build/br2-test-vm/images,security_model=none -device virtio-9p-pci,fsdev=sharedfs1,mount_tag=sharedfs1
  • BENCHMARK STEPS

    1.run uswap-vm

      cd ~/USWAP/uswap-dev && ./scripts/run-uswap.sh
    
  1. in uswap-vm run test-vm and entering “root”(可以使用ssh)
test-vm start
  1. configure sshd and set passwd

    	echo PermitRootLogin yes >> /etc/ssh/sshd_config
    	/etc/init.d/S50sshd restart
    	设置密码为123 
    	
    	passwd
    

mount a filesystem

创建一个空目录,例如 /mnt/rootfs。

挂载 rootfs.ext2 文件到该目录:

sudo mount -o loop /home/shiyue/USWAP/uswap-dev/build/br2-uswap-vm/images/rootfs.ext2 /home/shiyue/USWAP/uswap-dev/build/br2-uswap-vm/host/x86_64-buildroot-linux-gnu/sysroot/mnt/rootfs

其中 ~/path/to/rootfs.ext2 是 rootfs.ext2 文件在主机中的路径。

进入挂载的文件系统并更新 sshd_config 文件。例如,如果您想启用root登录,则可以执行以下操作:

sudo chroot /home/shiyue/USWAP/uswap-dev/build/br2-uswap-vm/host/x86_64-buildroot-linux-gnu/sysroot/mnt/rootfs

然后就可以做你对文件系统的更改了
e.g

passwd root

卸载文件系统:

sudo umount /mnt/rootfs
  • 解决报错
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:CU/QWBrLCwOFgb0rZoB3v3mYdMIM1fxmtLLRD3YO9TM.
Please contact your system administrator.
Add correct host key in /home/shiyue/.ssh/known_hosts to get rid of this message.
Offending ED25519 key in /home/shiyue/.ssh/known_hosts:18
  remove with:
  ssh-keygen -f "/home/shiyue/.ssh/known_hosts" -R "[localhost]:2233"
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
UpdateHostkeys is disabled because the host key is not trusted.
root@localhost: Permission denied (publickey,password,keyboard-interactive).
  1. 如果你信任该主机并确认它的身份验证信息是正确的,可以手动将正确的主机密钥添加到 /home/shiyue/.ssh/known_hosts 文件中。可以使用以下命令将主机密钥添加到文件中:
ssh-keyscan -t ed25519 -p 2233 localhost >> /home/shiyue/.ssh/known_hosts

请确保将命令中的端口号和主机名(localhost)与你的实际情况匹配。

  • JUMPHOST TO TEST-VM
ssh -J root@localhost:2222 -o StrictHostKeyChecking=no root@localhost -p 2233 -o StrictHostKeyChecking=no
 ssh root@localhost -p 2233 -o StrictHostKeyChecking=no -L 9121:127.0.0.1:9121 "/usr/bin/redis_exporter </dev/null >/var/log/redis_exporter.out.txt 2> /var/log/redis_exporter.err.txt"
  • save redis_exporter into test-vm
scp -P 2233 /usr/local/bin/redis_exporter root@localhost:/usr/bin
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值