此内容没有您所选择的语言版本。

11.15.4. Port Forwarding on Mac OS X


Currently, out of the box, Mac OS X only provides the following interfaces for loopback addresses:
  • localhost
  • 127.0.0.1
Therefore, port forwarding on Mac OS X may not work correctly. The following example shows error messages that can occur when attempting to configure port forwarding using the IP address of an application.

Example 11.23. Error Messages When Port Forwarding on Mac OS X

$ rhc port-forward myapp
Checking available ports...
Error trying to forward ports. You can try to forward manually by running:
ssh -N 70277280b8534c8a9fc76d2734393dfa@myapp-domain.example.com
Copy to Clipboard Toggle word wrap
The current workaround to enable port forwarding on Mac OS X is to manually configure an alias for each IP address used by the application:
$ sudo ifconfig lo0 alias application_IP_address sudo ifconfig lo0 alias application_IP_address
Copy to Clipboard Toggle word wrap

Example 11.24. Manually Configured IP Address

$ sudo ifconfig lo0 alias 127.10.51.129
Copy to Clipboard Toggle word wrap

Note

Root or administrative privileges are required to run the ifconfig command on Mac OS X.
If the application uses multiple IP addresses, you must configure an alias for each IP address. For example, suppose a PHP application has both MySQL and phpMyAdmin cartridges added, and it uses the IP addresses 127.11.25.1 and 127.11.25.2. For port forwarding to work correctly, configure an alias for each IP address as shown in the following example:

Example 11.25. Configuring Aliases for Multiple IP Addresses

$ sudo ifconfig lo0 alias 127.11.25.1
$ sudo ifconfig lo0 alias 127.11.25.2
Copy to Clipboard Toggle word wrap
Finally, enable port forwarding with the rhc port-forward command.

Important

The IP address alias configured for an application is not persistent through system reboots. If the system is rebooted, you must repeat these steps to correctly enable port forwarding on Mac OS X.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat