在我的服务器上,我想通过我的eth0:2别名路由我的互联网stream量。 当我使用这个命令时:
sudo iptables -t nat -A POSTROUTING -s 10.8.0.4 -o eth0:2 -j MASQUERADE
它返回这个:
Warning: weird character in interface `eth0:2' (No aliases, :, ! or *).
有没有什么办法路由从openvpn IP 10.8.0.4通过单一的IPstream量?
感谢您的帮助,
你应该在这里使用SNAT而不是MASQUERADE。
MASQUERADE This target is only valid in the nat table, in the POSTROUTING chain. It should only be used with dynamically assigned IP (dialup) connec‐ tions: if you have a static IP address, you should use the SNAT target.
假设你想要将来自10.8.0.4的任何stream量,通过eth0退出,到任何绑定到eth0:2的IP地址(我要在这里说“wxyz”),请尝试以下操作:
sudo iptables -t nat -A POSTROUTING -s 10.8.0.4 -o eth0 -j SNAT --to-source wxyz
其中wxyz是绑定到eth0的IP。