1

I need some.domain.com:8000 to be linked to 162.251.150.150:80.

So when I load some.domain.com:8000 in my browser - an actual request should be going to 162.251.150.150:80.

I was trying to use pf.conf for that with different settings, but without success:

pass out proto tcp from  some.domain.com port 8000 to 162.251.150.150 port 80
nat pass on lo0 inet proto tcp from any to some.domain.com port 8000 -> 162.251.150.150 port 80

(I've created an alias for some.domain.com in hosts file along with that)

I have MacOS 10.12.3

p.s. I made that working in Ubuntu with following command:

sudo iptables -t nat -A OUTPUT -p tcp --dport 8000 -d some.domain.com  -j DNAT --to-destination 162.251.150.150:80

p.p.s. I saw following question

What is the modern way to do port-forwarding on El Capitan? (forward port 80 to 8080)

My question is specific because of domain name need to be specified

  • Related and almost duplicate: Murus firewall - redirect an ip to localhost web server. If you have questions or don't get this to work make a comment @klanomath here and I will write an answer. – klanomath Feb 27 '17 at 21:15
  • @klanomath tried rdr pass log on lo0 proto tcp from en1 to 10.0.0.1 port 8000 -> 162.251.150.150 port 80 pass out on en1 route-to lo0 proto tcp from en1 to 10.0.0.1 port 8000 keep state with some.domain.com linked to 10.0.0.1 in hosts file - didn't work. Could you please help me? (edited - didn't finish comment) – andrfas Feb 27 '17 at 22:45
  • Tried and doesn't work for you? – klanomath Feb 27 '17 at 22:46
  • @klanomath sorry, just finished comment, please see above – andrfas Feb 27 '17 at 22:50

You must log in to answer this question.

Browse other questions tagged .