Amidst configuration for X11 forwarding thru ssh, it is required to add AddressFamily inet option in /etc/ssh/sshd_config as per this answer, to work.

On RHEL 7.x box, that is used in our case, X11 forwarding thru ssh works only after this configuration change.

Without this configuration change, a simple ssh connection between ssh client and ssh server works, but X11 forwarding through ssh doesn't work.

Reason mentioned, for this configuration change is: it attempts to connect via ipv6 and ends up falling back to ipv4

Under the hood, I can understand that ssh server would socket(AF_INET6, ,,) and then fall back to socket(AF_INET,,), without this configuration change.

Why does this configuration change help ssh server do X11 forwarding?

  • The key phrase in the answer is if it has ipv6 disabled. AddressFamily inet avoids using IPv6. – dirkt Sep 23 '18 at 18:57
  • @dirkt avoids using ... I understand that.. what was the problem in using it and falling back to ipv4? Why x11 forwarding doesn't work? – overexchange Sep 24 '18 at 1:51
  • I don't know what the problem was in these cases, because I don't run RHEL with IPv6 disabled, nor do I know the complete environment of those cases. But in general, setups are possible (and not unlikely) where IPv6 will appear to work, so ssh never falls back to IPv4. Unless you tell it to just use IPv4 right from the start. But that is a conjecture. – dirkt Sep 24 '18 at 5:59
  • @dirkt yes.. inet in box1 cannot talk to inet6 in box2. Do you think, in RHEL 7.x, ssh is never falling back to ipv4? in case of ipv6(inet6) disabled.. – overexchange Sep 26 '18 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.