Doesn't allow forwarding a range of ports through the UI

I recently had to forward a range of ports to a VirtualBox instance. The VirtualBox GUI doesn’t provide a method for forwarding a range of ports. The VirtualBox Manual describes a way for adding the rule via the command-line:

VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22"

This forwards any traffic arriving on port 2222 to port 22 on the virtual instance. We can use this to create a short bash loop. In the example below, we’re forwarding ports 2300-2400 to ports 2300-2400 on the virtual instance (both TCP and UDP):

for i in {2300..2400}; do
VBoxManage modifyvm "windows" --natpf1 "tcp-port$i,tcp,,$i,,$i";
VBoxManage modifyvm "windows" --natpf1 "udp-port$i,udp,,$i,,$i";
done

You can verify this by going back into the VirtualBox port forwarding page and seeing the newly configured ports. It’s just as easy to delete them:

for i in {2300..2400}; do
VBoxManage modifyvm "windows" --natpf1 delete "tcp-port$i"; 
VBoxManage modifyvm "windows" --natpf1 delete "udp-port$i"; 
done

This should suffice until the capability is added to the VirtualBox UI.

 

Forwarding a Range of Ports in VirtualBox的更多相关文章

  1. 服务器上安装FileZilla Server连接时报You appear to be behind a NAT router. Please configure the passive mode settings and forward a range of ports in your router.

    官方资源下载链接:客户端,或者直接点击下载“FileZilla_3.24.0_win64-setup.exe”:服务端,或者直接点击下载“FileZilla_Server-0_9_60_2.exe”: ...

  2. 路由器port触发与转发---Port Forwarding & Port Triggering

    What is Port Triggering? If you have not read my explanation of port forwarding do so now. You can f ...

  3. squid对http range的处理以及range_offset_limit

    range_offset_limit A range request comes from a client that wants only some subset of an HTTP respon ...

  4. vyatta的fork开源版本

    https://www.reddit.com/r/networking/comments/3dvwfy/who_here_is_using_vyos/ Vyatta came in two flavo ...

  5. dhcpsrv:windows系统的优秀开源免费dhcp serve软件

    概述: 官方网站 :http://www.dhcpserver.de/ 写博客时的可免费下载版本  2.52, 或者在cnblogs 本地下载 --========================== ...

  6. vyatta的fork开源版本vyos

    vyatta的fork开源版本vyos 来源: https://www.reddit.com/r/networking/comments/3dvwfy/who_here_is_using_vyos/ ...

  7. 【转】刚发现一个linux在线文档库。很好很强大。

    原文网址:http://blog.csdn.net/longxibendi/article/details/6048231 1.网址: http://www.mjmwired.net 2.比如查看这个 ...

  8. Ettercap 帮助文档

    Ettercap(8)帮助 (翻译来自百度翻译,原文附于文后,个人润色) 1.概述 Ettercap-多用途嗅探器/内容过滤器,用于中间人攻击 重要提示 自Ettercap Ng(以前为0.7.0)以 ...

  9. useful commands for docker beginner

    You may want to add my wechat public account or add my technical blog's RSS feed This list is meant ...

随机推荐

  1. 用pip爽久了,竟然完了easy install安装过程了

    新换了mac,装python环境时才发现,一直用pip,反而忘了easy_install的安装方法了.这里记录一下: 1.下载ez_install.py文件:https://bootstrap.pyp ...

  2. HDU 1074 Doing Homework(状态压缩DP)

    题意:有n门课,每门课有截止时间和完成所需的时间,如果超过规定时间完成,每超过一天就会扣1分,问怎样安排做作业的顺序才能使得所扣的分最小 思路:二进制表示. #include<iostream& ...

  3. Node.js也分裂了-开源社区动态

    继CoreOS与Docker分道扬镳继而推出自己的容器引擎Rocket后不久,又传来了Node.js分裂的消息.由于Node.js的贡献者因对负责Node.js开发的公司Joyent在对Node.js ...

  4. CDR绘制绚丽五角星※※

    CDR绘制绚丽五角星 1.绘制一个五角星,在多边形工具下拉的第二个就是 2.选中五角星,点击颜色即可.给五角星加上颜色 3.用立体化工具进行延伸. 4.点击图形中心向下拉. 看到了中间的一个长方条了没 ...

  5. HW7.2

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  6. HW6.18

    public class Solution { public static void main(String[] args) { double[] array = {6.0, 4.4, 1.9, 2. ...

  7. mac 学习

    1. 下载下来的eclipse,想把eclipse的图标放到applications目录里 做法:将下载的eclipse 的gz 文件直接移动到 /Applications 文件夹下 ,解压后即可在 ...

  8. poj1743--Musical Theme(后缀数组)

    题意:求一列数字中走向相同的两个字序列,长度要求大于5 题解:相邻数字求差,原题就变成求相同的长度大于4的子串. [存疑:在保证两个子串不相交时觉得限定条件应该是大于x,但是wa了= = 不是很理解] ...

  9. JPA主键策略

    JPA 自带的主键策略有 4 种,在枚举 javax.persistence.GenerationType 中,分别是:TABLE.SEQUENCE.IDENTITY.AUTO. TABLE:通过表产 ...

  10. CSS边框与边界

    (上右下左依次体现)à边框的同一属性名称可以同时使用多个属性值 简化方案:border: 长度 形态 颜色 例如 border:1px solid black; 16.2 CSS中边界的使用 padd ...