Siduction Forum > Software - Support

[DE] iptables - portforward

(1/1)

hsp:
Ich habe mir nach dieser Anleitung für libvirt ein hookscript angelegt für qemu zum portforward für ssh (NAT Network). Funktioniert auch bestens. Aber was nicht geht ist eine Verbindung von localhost (ssh -p 2222 localhost). Ich habe keine Ahnung waum. Jemand eine Idee was fehlt oder falsch ist?

https://wiki.libvirt.org/Networking.html#forwarding-incoming-connections

Hier der hookscript

--- Code: ---#!/bin/bash
#
if [ "${1}" = "foobarbox" ]; then
#
# Update the following variables to fit your setup
GUEST_IP="192.168.122.19"
GUEST_PORT="22"
HOST_PORT="2222"
BRIDGE="virbr0"
#
    if [ "${2}" = "stopped" ] || [ "${2}" = "reconnect" ]; then
        /usr/sbin/iptables -D FORWARD -o $BRIDGE -d $GUEST_IP -j ACCEPT
        /usr/sbin/iptables -t nat -D PREROUTING -p tcp --dport $HOST_PORT -j DNAT --to $GUEST_IP:$GUEST_PORT
    fi
#
    if [ "${2}" = "start" ] || [ "${2}" = "reconnect" ]; then
        /usr/sbin/iptables -I FORWARD -o $BRIDGE -d $GUEST_IP -j ACCEPT
        /usr/sbin/iptables -t nat -I PREROUTING -p tcp --dport $HOST_PORT -j DNAT --to $GUEST_IP:$GUEST_PORT
    fi
fi

--- End code ---


Danke...

hsp:
*push*

Navigation

[0] Message Index

Go to full version
Powered by Advanced Topic Prefix Pro
Powered by SMFPacks WYSIWYG Editor