AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / ubuntu / Perguntas / 1378968
Accepted
nightwatch
nightwatch
Asked: 2021-12-04 00:34:08 +0800 CST2021-12-04 00:34:08 +0800 CST 2021-12-04 00:34:08 +0800 CST

UFW Desbloquear Host para Tráfego de Convidado

  • 772

Estou no Ubuntu 20.04 e habilitei o UFW como killswitch para trabalhar com minha vpn wireguard. Minhas regras atuais funcionam perfeitamente, exceto que o tráfego entre meu host ubuntu e meu convidado da caixa virtual do debian 10.5 está bloqueado.

Como posso desbloquear o tráfego de host/convidado?

Minhas regras atuais do UFW são:

[ 1] 22/tcp                     ALLOW IN    Anywhere                  
[ 2] Anywhere                   ALLOW OUT   Anywhere on wg-client1     (out)
[ 3] 80/tcp                     ALLOW IN    Anywhere                  
[ 4] 443/tcp                    ALLOW IN    Anywhere                  
[ 5] Anywhere on wg-client1     ALLOW IN    Anywhere                  
[ 6] 94.121.83.88               ALLOW OUT   Anywhere                   (out)
[ 7] 21/tcp                     ALLOW IN    Anywhere                  
[ 8] 53                         ALLOW OUT   Anywhere                   (out)
[ 9] 9418/tcp                   ALLOW IN    Anywhere                  

Eu tentei anteriormente o seguinte que todos falharam (ou seja, quando eu pingo convidado ip192.168.0.84, recebo ping: sendmsg: Operation not permitted)

[10] 22/tcp                     ALLOW IN    10.10.10.2                
[11] 22/tcp                     ALLOW IN    192.168.0.0/24            
[12] Anywhere                   ALLOW IN    192.168.0.0/24            
[13] 192.168.0.0/24             ALLOW IN    Anywhere                  
[14] 192.168.0.0/24 22          ALLOW IN    Anywhere                  
[15] Anywhere                   ALLOW IN    192.168.0.0/24 22 

Eu também uso masquerade para colocar todo o tráfego pela vpn. Minha ifconfig -asaída é:

enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.18  netmask 255.255.255.0  broadcast 192.168.0.255
        ether b4:a9:fc:b0:b0:d1  txqueuelen 1000  (Ethernet)
        RX packets 668474  bytes 477052588 (477.0 MB)
        RX errors 0  dropped 1  overruns 0  frame 0
        TX packets 945227  bytes 553827446 (553.8 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2106  bytes 198789 (198.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2106  bytes 198789 (198.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vboxnet0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 0a:00:27:00:00:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vboxnet1: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 0a:00:27:00:00:01  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wg-client1: flags=209<UP,POINTOPOINT,RUNNING,NOARP>  mtu 1420
        inet 10.10.10.2  netmask 255.255.255.255  destination 10.10.10.2
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 565766  bytes 350115976 (350.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 451704  bytes 440547648 (440.5 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp0s10f2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.6  netmask 255.255.255.0  broadcast 192.168.0.255
        ether 34:cf:f6:61:c0:38  txqueuelen 1000  (Ethernet)
        RX packets 433847  bytes 102427035 (102.4 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 94319  bytes 29872001 (29.8 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Deve-se notar que meu convidado debian tem duas interfaces de rede, 1 estática 192.168.0.84 e uma dinâmica para que eu possa usar várias redes wifi.

# The primary network interface
auto enp0s3
iface enp0s3 inet static
        address 192.168.0.84
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
       
#dynamic gateway for Internet access on random networks
auto enp0s8
iface enp0s8 inet dhcp

THX

ATUALIZAÇÃO Finalmente descobri meus logs do sistema e notei isso:
[UFW BLOCK] IN= OUT=wlp0s10f2 SRC=192.168.0.255 DST=192.168.0.84 ....

Então, é claro, verifiquei o gerenciador vbox e, para meus adaptadores de conexão em ponte, tenho apenas 2 opções: wlp0s10f2ou enp3s0(ethernet)

Apesar de ifocnfig -amostrar wg-client1como interface de rede, não tenho wg-client1como interface disponível no virtualbox.

Joguei com regras diferentes para permitir 22/tcp a partir wlp0s10f2de wg-client1, mas não tive sucesso.

Alguma dica?

networking
  • 1 1 respostas
  • 153 Views

1 respostas

  • Voted
  1. Best Answer
    nightwatch
    2021-12-06T02:16:00+08:002021-12-06T02:16:00+08:00

    Um pouco embaraçoso, mas menos de 5 minutos depois de iniciar a recompensa, resolvi o problema com um palpite:

    sudo ufw allow out on wlp0s10f2 from any to 192.168.0.84

    Agora minha nova instalação funciona perfeitamente. Meu erro foi usar o ip da vpn como o endereço de saída. Mudando isso para o endereço IP da máquina vbox. Me colocou de volta nos trilhos.

    • 0

relate perguntas

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Existe um comando para listar todos os usuários? Também para adicionar, excluir, modificar usuários, no terminal?

    • 9 respostas
  • Marko Smith

    Como excluir um diretório não vazio no Terminal?

    • 4 respostas
  • Marko Smith

    Como descompactar um arquivo zip do Terminal?

    • 9 respostas
  • Marko Smith

    Como instalo um arquivo .deb por meio da linha de comando?

    • 11 respostas
  • Marko Smith

    Como instalo um arquivo .tar.gz (ou .tar.bz2)?

    • 14 respostas
  • Marko Smith

    Como listar todos os pacotes instalados

    • 24 respostas
  • Martin Hope
    Flimm Como posso usar o docker sem sudo? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    led-Zepp Como faço para salvar a saída do terminal em um arquivo? 2014-02-15 11:49:07 +0800 CST
  • Martin Hope
    ubuntu-nerd Como descompactar um arquivo zip do Terminal? 2011-12-11 20:37:54 +0800 CST
  • Martin Hope
    TheXed Como instalo um arquivo .deb por meio da linha de comando? 2011-05-07 09:40:28 +0800 CST
  • Martin Hope
    Ivan Como listar todos os pacotes instalados 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    David Barry Como determino o tamanho total de um diretório (pasta) na linha de comando? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher "Os seguintes pacotes foram retidos:" Por que e como resolvo isso? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford Como os PPAs podem ser removidos? 2010-07-30 01:09:42 +0800 CST

Hot tag

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve