I want to use a router in a network with a proxy. Without the router, everything works if you open the proxy settings in Windows and enter the address and port. No additional actions are required. I want the WiFi network users not to have to manually enter these parameters.
The router has the following network interfaces:
br0 Link encap:Ethernet HWaddr C8:B3:73:2B:B9:6C
inet addr:192.168.1.120 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
br0:0 Link encap:Ethernet HWaddr C8:B3:73:2B:B9:6C
inet addr:169.254.255.1 Bcast:169.254.255.255 Mask:255.255.0.0
eth0 Link encap:Ethernet HWaddr C8:B3:73:2B:B9:6C
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth1 Link encap:Ethernet HWaddr C8:B3:73:2B:B9:6E
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
vlan1 Link encap:Ethernet HWaddr C8:B3:73:2B:B9:6C
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
vlan2 Link encap:Ethernet HWaddr C8:B3:73:2B:B9:6D
inet addr:10.134.4.122 Bcast:10.134.4.127 Mask:255.255.255.192
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
The router's IP address in the local network is 192.168.1.120.
The router's IP address in the proxy network is 10.134.4.122.
Proxy settings:
IP 10.128.0.90
PORT 8080
In the router settings, I have recorded the following command in the startup:
#!/bin/sh
PROXY_IP=10.128.0.90
PROXY_PORT=8080
LAN_IP=nvram get lan_ipaddr
LAN_NET=$LAN_IP/nvram get lan_netmask
iptables -t nat -A PREROUTING -i vlan1 -s $LAN_NET -d $LAN_NET -p tcp --dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -i vlan1 ! -s $PROXY_IP -p tcp --dport 80 -j DNAT --to $PROXY_IP:$PROXY_PORT
iptables -t nat -A PREROUTING -i vlan1 ! -s $PROXY_IP -p tcp --dport 443 -j DNAT --to $PROXY_IP:$PROXY_PORT
iptables -t nat -I POSTROUTING -o vlan1 -s $LAN_NET -d $PROXY_IP -p tcp -j SNAT --to $LAN_IP
iptables -I FORWARD -i vlan1 -o vlan1 -s $LAN_NET -d $PROXY_IP -p tcp --dport $PROXY_PORT -j ACCEPT
But the proxy is not working. What could be the problem?
Asked by Сергей Корягин
(1 rep)
May 2, 2024, 12:46 PM
Last activity: May 2, 2024, 02:43 PM
Last activity: May 2, 2024, 02:43 PM