Ir ao conteúdo

Redirecionando portas para VirtualBox.

Boa tarde,

Alguns dias atrás estava pensando em rodar serviços dentro de máquinas virtuais. O que me deixava com a pulga atrás da orelha era como eu iria fazer o redirecionamento de portas. Então utilizei o Grande Oraculo e pesquisei durante bastante tempo para conseguir que funcionasse. Utilizei o “VBoxManage setextradata”, mas não tive sucesso. Caso você queira tentar, veja como configurar redirecionamento de portas para virtualbox usando VBoxManage.

Inicialmente você deve criar uma interface “tap”

#sudo tunctl -u $USER

Definir o IP da interface tap

#sudo ip addr add 192.168.0.20/32 dev tap0
# sudo ip link set tap0 up

Habilitar ip forward

# sudo sysctl net.ipv4.ip_forward=1

Adicionar Rota

#sudo route add -host 192.168.0.150 dev tap0

NAT:

# sudo iptables –flush
#sudo iptables -t nat –flush
#sudo iptables -t nat -A POSTROUTING –out-interface eth1 -j MASQUERADE
#sudo iptables -A FORWARD –in-interface eth1 -j ACCEPT

Redirecionando a porta 3333 para 3389:

#iptables -t nat -A PREROUTING -i eth1 -p tcp -d 192.168.0.100 –dport 3333 -j DNAT –to 192.168.0.150:3389

eth1 – Minha placa de rede conectada ao meu roteador.
192.168.0.150 – IP da Máquina Virtual (configurada manualmente)
192.168.0.20 – IP da tap
192.168.0.100 – IP da minha máquina real que recebera conexões na porta 3333

Após este processo, está “tudo” pronto para você rodar um serviço na porta 3389 da sua máquina virtual. Você deve mudar as suas configurações do VirtualBox. Acesse “Settings – Network – Attached to – Selecione Bridged Adpater”, logo em seguida selecione o “Name” para tap0. Inicie sua máquina virtual e configure o ip da mesma manualmente da seguinte maneira:

IP: 192.168.0.150
Subnet Mask: 255.255.255.0 (verifique se a sua é essa na sua maquina real)
Default Gateway: 192.168.0.100 (ip da maquina real)

Agora sua Maquina virtual está com acesso normal a internet e também com a sua porta 3389 aberta, sendo que a mesma será acessada externamente por 3333.

Já que tive problemas com o ‘–‘ estou disponibilizando um link para download do mesmo. Arquivo para liberação de portas em firewall.

Espero que seja útil,
Matheus Bratfisch

PS: Não sei porque diabos em vez de ficar –flush por exemplo está ficando -flush. Então caso você tenha problemas com os comandos, tente adicionar o — na frente do FLUSH, do out-interface, do in-interface, do dport e do “to”. Foram nesses que eu encontrei problema, caso você tenha algum outro, avise-me.

Referencias:
IPtables Tutorial
IPTables Port Redirect
VirtualBox, com nat
VBoxManage Port Forward

Publicado emLinux

35 Comentários

  1. Yesterday, while I was at work, my sister stole my
    iphone and tested to see if it can survive a 40 foot drop,
    just so she can be a youtube sensation. My iPad is
    now destroyed and she has 83 views. I know this is entirely off topic but I had to share it with someone!

  2. Das Lied entstand in enger Zusammenarbeit zwischen Arnold und Cornell inmitten der Arbeiten zu
    Cornells zweitem Soloalbum Carry On. Die Musik schrieb – wie
    auch bereits für die drei Vorgängerfilme – David Arnold, unterstützt von seinem Orchestrator Nicholas Dodd.
    Mit einem direkten Rückgriff auf eine Romanhandlung von Fleming wurde
    vor allem dem Hauptdarsteller viel Raum gegeben, die Titelfigur eigenständig und möglichst nuanciert neu zu
    zeichnen. Hierzu setzte man auch viele Stilmittel ein, dank derer bereits Im Geheimdienst ihrer Majestät
    zu den populärsten Filmen der Reihe zählt. Dies konnte
    Filmverleih Sony schließlich überzeugen, auch mit Bond
    diese neue Richtung einzuschlagen, anstatt Massentauglichkeit
    durch ein immer exzessiveres Spektakel zu erzwingen. Mit realistischer Action war in der Zwischenzeit auch die Bourne-Reihe erfolgreich, während anderen Franchises ein kompletter Neuanfang mit Filmen wie Batman Begins gelang.

    Eigentlich rief die Produktionsfirma in seinem Casino an,
    da sie auf der Suche nach einem Croupier mit guten Englischkenntnissen waren, Daniel erkannte seine Chance schnell und meinte „nehmen Sie doch einfach
    mich“. Einen weiteren Kurzauftritt erkaufte sich Milliardär Richard
    Branson (Virgin), er ist im fertigen Film für einen kurzen Augenblick bei der
    Personenkontrolle am Miami International Airport zu sehen. CASINO ROYALE ist nicht, wie fälschlicherweise oft publiziert, der erste Bondfilm ohne Q, dieser ist auch
    in „Dr. Die Szene, in der Bond während der Verfolgungsjagd der auf
    dem Boden liegenden Vesper in letzter Sekunde mit seinem neuen Aston Martin DBS ausweicht,
    verschaffte dem Team rund um Stuntkoordinator Gary Powell mit 7
    3/4 Überschlägen einen Eintrag ins Guinnessbuch – Weltrekord!
    ‚M‘ weist Bond die verführerische VESPER LYND als
    Partnerin zu, damit sie ein wachsames Auge auf ihn hat.
    Bond findet heraus, dass Dimitrios mit LE CHIFFRE, dem Bankier einer weltweit
    operierenden Terrororganisation, unter einer Decke
    steckt.

    References:
    https://online-spielhallen.de/die-cobra-casino-mobile-app-dein-umfassender-leitfaden-fur-unterwegs/

  3. While Gmail’s features are secure enough for most users, some accounts may require additional layers of safety.
    Collaborate faster, from any device, anytime, all in one
    place. We never use your Gmail content to personalize ads.

    Gentle nudges help you stay on top of everything. Start a Chat, jump into a video call with Meet, or collaborate in a Doc,
    all right from Gmail. Gmail blocks 99.9% of spam,
    malware, and dangerous links from ever reaching your inbox.
    Gmail uses industry-leading encryption for all
    messages you receive and send. Gemini in Gmail can compose well-written drafts
    or replies for you to edit, personalize and quickly hit send.

    Once you’ve signed in, check your email by opening your inbox.

    We work hard to protect you from spam, phishing, and malware, before they reach your
    inbox. Google Workspace is a set of productivity and collaboration tools that helps
    individuals, teams, and businesses stay on top of everything.
    Gmail offline lets you read, reply, delete, and search your Gmail messages
    when you’re not connected to the internet.

    References:
    https://blackcoin.co/wazamba-premium-pokies-paradise-for-australian-players-in-2025/

  4. All staff are trained to assist with responsible
    gambling support, and Crown’s “Play Safe” program offers tools like time limits,
    self-exclusion, and counselling services. All games are conducted by experienced dealers in Crown’s vibrant and stylish setting.
    From casual players to high-rollers, the gaming
    floor caters to every taste with premium service and a high-energy atmosphere.
    Indulge in the most refined wellness experience in Sydney with holistic treatments,
    infinity pools, and private spa suites. Fully regulated and licensed by the NSW authorities, Crown Sydney
    offers high-stakes gaming in a safe, secure
    and VIP-only environment. Explore the unmatched benefits of
    Australia’s most prestigious six-star resort and casino.

    These offers are designed to cater to both new and regular patrons,
    encompassing a wide range of rewards from gaming credits to luxury experiences.
    Each location also offers Star Casino Gold Coast
    accommodations, diverse dining experiences, and
    access to sports bars, nightclubs, and theaters, catering to a broad spectrum of tastes
    and preferences. Beyond its gaming facilities, The Star Sydney
    is celebrated for its luxury accommodations, comprising several hotels and serviced apartments that
    cater to diverse guest preferences. With breathtaking views of Sydney Harbour from the floor to ceiling windows and spacious outdoor terraces, the Villas
    set the precedent for luxury hotel accommodation. Crown Sydney offers an uncompromising design that captures the essence of its harbourside setting,
    highly intuitive personalised service, and the finest dining and
    facilities, unlike anything the city has seen before. Hear from real guests who’ve experienced the luxury, entertainment, and gaming excitement
    of Crown Sydney.

    References:
    https://blackcoin.co/roulette-tutorial/

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *