ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Port Forwarding to KVM Guest

    IT Discussion
    iptables linux kvm port forwarding
    3
    18
    3.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      Alex Sage
      last edited by scottalanmiller

      So I have my server running over at Wholesale Internet, and I need to start forwarding some port to KVM guests.

      Normally I would just setup KVM to use the local network, but clearly I can't in this situation 🙂

      So I am to ping the KVM Guest from the host no problem.

      Here is my firewall rules:

      public (active)
        target: default
        icmp-block-inversion: no
        interfaces: enp6s0f0
        sources: 
        services: dhcpv6-client ssh
        ports: 5901/tcp 2222/tcp
        protocols: 
        masquerade: yes
        forward-ports: port=2222:proto=tcp:toport=22:toaddr=192.168.100.234
        sourceports: 
        icmp-blocks: 
        rich rules: 
      

      This is just for testing! What am I missing?

      1 Reply Last reply Reply Quote 0
      • scottalanmillerS
        scottalanmiller
        last edited by

        Is it not working?

        A 1 Reply Last reply Reply Quote 0
        • A
          Alex Sage @scottalanmiller
          last edited by Alex Sage

          @scottalanmiller No. I just tried to install httpd on the KVM guest and forward port 80...

          No luck there ether... I can see what webpage on the host.

          1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller
            last edited by

            Did you add this command?

            firewall-cmd --zone=public --add-masquerade --permanent
            
            1 Reply Last reply Reply Quote 0
            • scottalanmillerS
              scottalanmiller
              last edited by

              Oh sorry, I see that you did.

              A 1 Reply Last reply Reply Quote 0
              • A
                Alex Sage @scottalanmiller
                last edited by

                @scottalanmiller @dafyre has been helping me out, but we aren't able to get it working...

                1 Reply Last reply Reply Quote 0
                • A
                  Alex Sage
                  last edited by

                  Hmmmm....

                  http://blog.adamspiers.org/2012/01/23/port-redirection-from-kvm-host-to-guest/

                  1 Reply Last reply Reply Quote 0
                  • dafyreD
                    dafyre
                    last edited by

                    The documentation on a page we were looking at (I don't have the URL right now) suggested to use the --zone=external . Could that be a potential hangup -- even though the interface itself is listed in the "public" zone?

                    scottalanmillerS 1 Reply Last reply Reply Quote 0
                    • scottalanmillerS
                      scottalanmiller @dafyre
                      last edited by

                      @dafyre said in Port Forwarding to KVM Guest:

                      The documentation on a page we were looking at (I don't have the URL right now) suggested to use the --zone=external . Could that be a potential hangup -- even though the interface itself is listed in the "public" zone?

                      That would absolutely be the problem. Only the zone that the interface is actually on will work.

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        Alex Sage @scottalanmiller
                        last edited by

                        @scottalanmiller so your saying move the interface to external?

                        1 Reply Last reply Reply Quote 0
                        • dafyreD
                          dafyre
                          last edited by

                          @aaronstuder try:

                          firewall-cmd --get-active-zones
                          

                          And see which one shows up... Also, are you able to SSH to the guest VM from your KVM host?

                          A 2 Replies Last reply Reply Quote 0
                          • A
                            Alex Sage @dafyre
                            last edited by

                            @dafyre ill try 🙂

                            1 Reply Last reply Reply Quote 0
                            • A
                              Alex Sage @dafyre
                              last edited by Alex Sage

                              @dafyre said in Port Forwarding to KVM Guest:

                              are you able to SSH to the guest VM from your KVM host?

                              Yes 🙂

                              dafyreD 1 Reply Last reply Reply Quote 0
                              • dafyreD
                                dafyre @Alex Sage
                                last edited by

                                @aaronstuder said in Port Forwarding to KVM Guest:

                                @dafyre said in Port Forwarding to KVM Guest:

                                are you able to SSH to the guest VM from your KVM host?

                                Yes 🙂

                                And what about the other command above?

                                A 1 Reply Last reply Reply Quote 0
                                • A
                                  Alex Sage @dafyre
                                  last edited by Alex Sage

                                  @dafyre

                                  public
                                     interfaces: enp6s0f0
                                  
                                  dafyreD 1 Reply Last reply Reply Quote 0
                                  • dafyreD
                                    dafyre @Alex Sage
                                    last edited by

                                    @aaronstuder said in Port Forwarding to KVM Guest:

                                    @dafyre

                                    public
                                       interfaces: enp6s0f0
                                    

                                    Can you post the whole output of that section?

                                    A 1 Reply Last reply Reply Quote 0
                                    • A
                                      Alex Sage @dafyre
                                      last edited by Alex Sage

                                      I moved the interface to external

                                      external (active)
                                        target: default
                                        icmp-block-inversion: no
                                        interfaces: enp6s0f0
                                        sources: 
                                        services: ssh
                                        ports: 
                                        protocols: 
                                        masquerade: yes
                                        forward-ports: port=2222:proto=tcp:toport=22:toaddr=192.168.100.234
                                        sourceports: 
                                        icmp-blocks: 
                                        rich rules:
                                      

                                      Still not working 😞

                                      1 Reply Last reply Reply Quote 0
                                      • A
                                        Alex Sage
                                        last edited by

                                        KVM Networking was set to NAT not Routed 😞

                                        I guess I am learning?........

                                        1 Reply Last reply Reply Quote 1
                                        • 1 / 1
                                        • First post
                                          Last post