V
V
Vasily Alibabaevich2021-02-06 12:49:18
FreeBSD
Vasily Alibabaevich, 2021-02-06 12:49:18

How to open 443 and 80 port through a specific interface?

Hello!

Tell me, please, who than can. The bottom line is this:
there is a gateway. 2 routers are connected to it to different interfaces: Router-1 and Router-2.

I want users who go through the gateway and open port 443 or 80 to go through Router-2 (bge1 interface)

here is a piece of the ipfw rule:

ipfw -q add 00041 allow tcp from 192.168.1.1/24 to any 80 out via bge1
ipfw -q add 00041 allow tcp from any to 192.168.1.1/24 80 in via bge1
ipfw -q add 00042 allow tcp from 192.168.1.1/24 to any 443 out via bge1
ipfw -q add 00042 allow tcp from any to 192.168.1.1/24 443 in via bge1


Applied rules - but does not work. I go to 2ip.ru - all the same, IP shows the wrong network interface.

Help me to understand.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AUser0, 2021-02-06
@dimitrius86

This is how you _allow_ traffic to pass through the specified interface, rather than directing traffic to the correct interface.
The command "iptables -A FORWARD -s 192.168.1.0/24 -m multiport --dports 80,443 -j SNAT --to [IP-address bge1] " will help.
Remove this setting with the command: "iptables -D FORWARD -s 192.168.1.0/24 -m multiport --dports 80,443".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question