Я хочу перенаправить 0.0.0.0:22 на 192.168.122.179:22, который является виртуальной машиной. Таким образом, я могу получить доступ к своей виртуальной машине через SSH, набрав локальный IP-адрес хост-машины. Однако мне отказывают в соединении, если я пытаюсь выполнить ssh с хоста на vm или даже (очевидно) с локального компьютера на хост на vm,
root@z:/home/lz# iptables -t nat -A PREROUTING -i eth1 -d 0.0.0.0 -p tcp --dport 22 -j DNAT --to-destination 192.168.122.179:22
root@z:/home/lz# iptables -t nat -L -n -v
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 DNAT tcp -- eth1 * 0.0.0.0/0 0.0.0.0 tcp dpt:22 to:192.168.122.179:22
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
1161 89206 LIBVIRT_PRT all -- * * 0.0.0.0/0 0.0.0.0/0
Chain LIBVIRT_PRT (1 references)
pkts bytes target prot opt in out source destination
5 340 RETURN all -- * * 192.168.122.0/24 224.0.0.0/24
0 0 RETURN all -- * * 192.168.122.0/24 255.255.255.255
39 2340 MASQUERADE tcp -- * * 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535
6 456 MASQUERADE udp -- * * 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535
0 0 MASQUERADE all -- * * 192.168.122.0/24 !192.168.122.0/24