再虚拟机内 rhc port-forward <app-name>
此时,可以在本机 访问 127.0.0.1:8080 登陆 网页, 3306连接sql
https://unix.stackexchange.com/questions/111433/iptables-redirect-outside-requests-to-127-0-0-1
https://serverfault.com/questions/551361/redirect-incoming-packets-to-loopback/702685
按上述将
sysctl -w net.ipv4.conf.eth0.route_localnet=1
然后 http://forums.justlinux.com/showthread.php?136144-SOLVED-hosts-file-redirecting-a-outgoing-ip-address-to-localhost
sudo iptables -t nat -A PREROUTING -d 192.168.252.30 -j DNAT --to-destination 127.0.0.1
sudo iptables -t nat -A OUTPUT -d 192.168.252.130 -j DNAT --to-destination 127.0.0.1
发现 可以在虚拟机内 用 虚拟机的eth0 的ip 地址:8080 访问了,,但主机上仍然不行 http://192.168.252.130:8080/
时间: 2024-10-20 03:46:45