nerdexam
CompTIA

XK0-005 · Question #715

A Linux administrator needs to forward port 8000 on a remote server remote to port 8000 on a local server. Which of the following commands should the administrator run on the local server to achieve…

The correct answer is C. ssh -R 8000:localhost:8000 remote. SSH remote port forwarding (-R) is the correct tool here. The syntax ssh -R 8000:localhost:8000 remote tells the remote server to listen on port 8000 and tunnel incoming connections back to port 8000 on the local machine (localhost). This is run on the local server, which…

System Management

Question

A Linux administrator needs to forward port 8000 on a remote server remote to port 8000 on a local server. Which of the following commands should the administrator run on the local server to achieve this goal?

Options

  • Afirewall-cmd --add-forward-port=port=8000:proto=tcp:toport=8000:toaddr=remote
  • Biptables -A FORWARD -m state -p tcp -d remote --dport 8000 -j accept
  • Cssh -R 8000:localhost:8000 remote
  • Dsocat TCP4-LISTEN:8000,fork TCP4:remote:8000

How the community answered

(37 responses)
  • A
    8% (3)
  • B
    3% (1)
  • C
    78% (29)
  • D
    11% (4)

Explanation

SSH remote port forwarding (-R) is the correct tool here. The syntax ssh -R 8000:localhost:8000 remote tells the remote server to listen on port 8000 and tunnel incoming connections back to port 8000 on the local machine (localhost). This is run on the local server, which initiates the SSH connection to the remote. Option A (firewall-cmd) manages local firewall rules, not cross-host tunnels. Option B has incorrect iptables syntax (ACCEPT must be uppercase) and does not create a tunnel. Option D (socat) would listen locally and forward TO the remote - the opposite direction - and provides no encryption.

Topics

#SSH#Port Forwarding#Remote Access#Networking

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice