Задать вопрос
@historydev
Редактирую файлы с непонятными расширениями

Почему при включённом впн нет интернета на виртуалках?

Сеть pve:
65a5429079188998464316.png

rules.v4

# Generated by iptables-save v1.8.9 on Mon Jan 15 05:25:22 2024
*filter
:INPUT ACCEPT [485:79687]
:FORWARD ACCEPT [10:840]
:OUTPUT ACCEPT [514:79762]
#-A INPUT -d 10.0.0.0/8 -i vmbr1 -j DROP
#-A FORWARD -s 10.0.0.0/8 -d 10.0.0.1/32 -j DROP
COMMIT
# Completed on Mon Jan 15 05:25:22 2024
# Generated by iptables-save v1.8.9 on Mon Jan 15 05:25:22 2024
*raw
:PREROUTING ACCEPT [756:119641]
:OUTPUT ACCEPT [773:117072]
COMMIT
# Completed on Mon Jan 15 05:25:22 2024
# Generated by iptables-save v1.8.9 on Mon Jan 15 05:25:22 2024
*nat
:PREROUTING ACCEPT [1:353]
:INPUT ACCEPT [1:353]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -d 10.0.0.2/32 -p tcp -m tcp --dport PORT -j DNAT --to-destination 10.1.0.2:PORT
-A PREROUTING -d 10.0.0.2/32 -p tcp -m tcp --dport PORT -j DNAT --to-destination 10.1.0.2:PORT
-A PREROUTING -d 10.0.0.2/32 -p tcp -m tcp --dport PORT -j DNAT --to-destination 10.1.0.4:PORT
-A POSTROUTING -s 10.1.0.0/16 -o vmbr0 -j MASQUERADE
-A POSTROUTING -s 10.1.0.0/16 -o tun0 -j MASQUERADE
COMMIT
# Completed on Mon Jan 15 05:25:22 2024



netplan на виртуалке

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens18:
      addresses:
      - 10.1.0.2/16
      nameservers:
        addresses:
        - 8.8.8.8
        search:
        - .
      routes:
      - to: default
        via: 10.1.0.1
  version: 2



ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr0 state UP group default qlen 1000
    link/ether d8:5e:d3:a1:11:83 brd ff:ff:ff:ff:ff:ff
3: vmbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether d8:5e:d3:a1:11:83 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.2/8 scope global vmbr0
       valid_lft forever preferred_lft forever
    inet6 fe80::da5e:d3ff:fea1:1183/64 scope link 
       valid_lft forever preferred_lft forever
4: vmbr1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 32:23:5a:04:9f:b5 brd ff:ff:ff:ff:ff:ff
    inet 10.1.0.1/16 scope global vmbr1
       valid_lft forever preferred_lft forever
    inet6 fe80::ccf6:ff:fef9:5366/64 scope link 
       valid_lft forever preferred_lft forever
5: tap100i0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master fwbr100i0 state UNKNOWN group default qlen 1000
    link/ether 5a:76:07:9f:d2:00 brd ff:ff:ff:ff:ff:ff
6: fwbr100i0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 72:04:f3:e0:e5:2d brd ff:ff:ff:ff:ff:ff
7: fwpr100p0@fwln100i0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master vmbr1 state UP group default qlen 1000
    link/ether 32:23:5a:04:9f:b5 brd ff:ff:ff:ff:ff:ff
8: fwln100i0@fwpr100p0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master fwbr100i0 state UP group default qlen 1000
    link/ether 72:04:f3:e0:e5:2d brd ff:ff:ff:ff:ff:ff
9: tap102i0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master fwbr102i0 state UNKNOWN group default qlen 1000
    link/ether 7a:e8:bd:cb:d8:e7 brd ff:ff:ff:ff:ff:ff
10: fwbr102i0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether a6:ac:82:03:d0:9a brd ff:ff:ff:ff:ff:ff
11: fwpr102p0@fwln102i0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master vmbr1 state UP group default qlen 1000
    link/ether 7e:62:f7:03:bd:fa brd ff:ff:ff:ff:ff:ff
12: fwln102i0@fwpr102p0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master fwbr102i0 state UP group default qlen 1000
    link/ether a6:ac:82:03:d0:9a brd ff:ff:ff:ff:ff:ff
17: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 500
    link/none 
    inet 192.168.104.6/22 scope global tun0
       valid_lft forever preferred_lft forever
    inet6 fe80::39eb:86ae:6f30:32b0/64 scope link stable-privacy 
       valid_lft forever preferred_lft forever



iptables -t nat -L -n -v

Chain PREROUTING (policy ACCEPT 150 packets, 12669 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DNAT       6    --  *      *       0.0.0.0/0            10.0.0.2             tcp dpt:PORT to:10.1.0.2:PORT
    0     0 DNAT       6    --  *      *       0.0.0.0/0            10.0.0.2             tcp dpt:PORT to:10.1.0.2:PORT
    0     0 DNAT       6    --  *      *       0.0.0.0/0            10.0.0.2             tcp dpt:PORT to:10.1.0.4:PORT

Chain INPUT (policy ACCEPT 12 packets, 3961 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 64 packets, 4064 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 64 packets, 4064 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 MASQUERADE  0    --  *      vmbr0   10.1.0.0/16          0.0.0.0/0           
   76  5104 MASQUERADE  0    --  *      tun0    10.1.0.0/16          0.0.0.0/0



На хосте интернет работает, до переустановки системы с этим конфигом, но другой подсетью работал инет на виртуалках.

tun0 присутствует.

Пробовал так-же убрать подсеть:
-A POSTROUTING -o vmbr0 -j MASQUERADE
-A POSTROUTING -o tun0 -j MASQUERADE


ping 8.8.8.8 с виртуалки не работает, с хоста работает, при включённом впн.

Без впн на вм есть инет.

Используется openvpn.
  • Вопрос задан
  • 565 просмотров
Подписаться 3 Простой 23 комментария
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы