侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

Access the VMs on a KVM host from outside

2023-12-12 星期二 / 0 评论 / 0 点赞 / 99 阅读 / 667 字

Scenirio: one KVM host(192.168.86.121) has configured KVM hypervisior which have some VMs(10.33.2.0/

Scenirio: one KVM host(192.168.86.121) has configured KVM hypervisior which have some VMs(10.33.2.0/24) running on top of it. we need other hosts (192.168.86.0/23) can access the KVM VMs. we need to Forward and PREROUTING.

1. enable the kernel forwarding

echo "1" > /proc/sys/net/ipv4/ip_forward

2. add the prerouting and forward.

iptables -t nat -I PREROUTING -d 192.168.86.121 -p tcp --dport 9022 -j DNAT --to-destination 10.33.2.50:22
iptables -I FORWARD -p tcp -d 10.33.2.50 --dport 22 -j ACCEPT

now we can access the 10.88.2.50:22 via 192.168.86.121:9000

广告 广告

评论区