sniproxy
sniproxy copied to clipboard
working with multiple ip
Hi,
I have setup an sniproxy server.
My ip a
output is:
root@test:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 56:00:01:4c:0d:c3 brd ff:ff:ff:ff:ff:ff
inet XX.XX.XX.192/23 brd XX.XX.XX.255 scope global ens3
valid_lft forever preferred_lft forever
inet YY.YY.YY.92/23 brd YY.YY.YY.255 scope global ens3:1
valid_lft forever preferred_lft forever
inet ZZ.ZZ.ZZZ.210/23 brd ZZ.ZZ.ZZZ.255 scope global ens3:2
valid_lft forever preferred_lft forever
I send a request to ifconfig.co through ZZ.ZZ.ZZZ.210
. However, the IP seems XX.XX.XX.192
on ifconfig.co
It is same when I send request through YY.YY.YY.92
. The IP seems ZZ.ZZ.ZZZ.210
on ifconfig.co
If the user come to server through YY.YY.YY.92
then his request should be proxied through YY.YY.YY.92
. Is there a way to keep the source interface's IP address?
@adililhan You can use multiple listeners, one for each IP you wish to bind to and a source directive on each indicating the outbound IP.