Access the VMs on a KVM host from outside
Access the VMs on a KVM host from outside
jenningsloy318 发表于1年前
Access the VMs on a KVM host from outside
  • 发表于 1年前
  • 阅读 5
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 新注册用户 域名抢购1元起>>>   

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

共有 人打赏支持
粉丝 0
博文 20
码字总数 4515
×
jenningsloy318
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: