Redirect all devices connected to AP of RPI to the IP address of RPI
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have a Pi with AP and static ip address 192.168.1.2. Devices connecting to the pi will have IP addresses between the range 192.168.1.2 to 192.168.1.20. I want to redirect all incoming web requests to redirect to the ip address of PI using iptables.
I have tried:
iptables -t nat -A PRETROUTING -p tcp --dport -j DNAT --to-destination 192.168.1.2
iptables iptables-redirect
 |Â
show 4 more comments
up vote
0
down vote
favorite
I have a Pi with AP and static ip address 192.168.1.2. Devices connecting to the pi will have IP addresses between the range 192.168.1.2 to 192.168.1.20. I want to redirect all incoming web requests to redirect to the ip address of PI using iptables.
I have tried:
iptables -t nat -A PRETROUTING -p tcp --dport -j DNAT --to-destination 192.168.1.2
iptables iptables-redirect
1
why not just assign a different IP subnet to the wlan interface? (and route that subnet to the rpi, of course)
â cas
Jan 13 at 7:06
ok. I will look into assigning a different IP subnet to the wlan interface. but how to route that subnet to the rpi? newbie to the linux here :(
â AB pacino
Jan 13 at 7:11
depends on what you're using for a router. if it's the rpi itself, you don't need to do anything else. otherwise just add a static route on your router for that IP subnet to the rpi's address. btw, you havePRETROUTING
in your iptables command above...useful for fishing perhaps, but not routing :)
â cas
Jan 13 at 7:35
Google "transparent proxy".
â dirkt
Jan 13 at 9:28
@cas Thanks for your reply. I am using rpi itself as the router. i added address=/#/192.168.1.2 in dnsmasq.conf for redirection and for most of the requests, it works except for facebook and youtube. I think that is because of SSL certificate. If that's the case, it shouldn't work for google.com too but it does. Any idea what could be done. ? and about iptables, is there any command which can meet my needs?
â AB pacino
Jan 14 at 5:01
 |Â
show 4 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a Pi with AP and static ip address 192.168.1.2. Devices connecting to the pi will have IP addresses between the range 192.168.1.2 to 192.168.1.20. I want to redirect all incoming web requests to redirect to the ip address of PI using iptables.
I have tried:
iptables -t nat -A PRETROUTING -p tcp --dport -j DNAT --to-destination 192.168.1.2
iptables iptables-redirect
I have a Pi with AP and static ip address 192.168.1.2. Devices connecting to the pi will have IP addresses between the range 192.168.1.2 to 192.168.1.20. I want to redirect all incoming web requests to redirect to the ip address of PI using iptables.
I have tried:
iptables -t nat -A PRETROUTING -p tcp --dport -j DNAT --to-destination 192.168.1.2
iptables iptables-redirect
asked Jan 13 at 7:00
AB pacino
1
1
1
why not just assign a different IP subnet to the wlan interface? (and route that subnet to the rpi, of course)
â cas
Jan 13 at 7:06
ok. I will look into assigning a different IP subnet to the wlan interface. but how to route that subnet to the rpi? newbie to the linux here :(
â AB pacino
Jan 13 at 7:11
depends on what you're using for a router. if it's the rpi itself, you don't need to do anything else. otherwise just add a static route on your router for that IP subnet to the rpi's address. btw, you havePRETROUTING
in your iptables command above...useful for fishing perhaps, but not routing :)
â cas
Jan 13 at 7:35
Google "transparent proxy".
â dirkt
Jan 13 at 9:28
@cas Thanks for your reply. I am using rpi itself as the router. i added address=/#/192.168.1.2 in dnsmasq.conf for redirection and for most of the requests, it works except for facebook and youtube. I think that is because of SSL certificate. If that's the case, it shouldn't work for google.com too but it does. Any idea what could be done. ? and about iptables, is there any command which can meet my needs?
â AB pacino
Jan 14 at 5:01
 |Â
show 4 more comments
1
why not just assign a different IP subnet to the wlan interface? (and route that subnet to the rpi, of course)
â cas
Jan 13 at 7:06
ok. I will look into assigning a different IP subnet to the wlan interface. but how to route that subnet to the rpi? newbie to the linux here :(
â AB pacino
Jan 13 at 7:11
depends on what you're using for a router. if it's the rpi itself, you don't need to do anything else. otherwise just add a static route on your router for that IP subnet to the rpi's address. btw, you havePRETROUTING
in your iptables command above...useful for fishing perhaps, but not routing :)
â cas
Jan 13 at 7:35
Google "transparent proxy".
â dirkt
Jan 13 at 9:28
@cas Thanks for your reply. I am using rpi itself as the router. i added address=/#/192.168.1.2 in dnsmasq.conf for redirection and for most of the requests, it works except for facebook and youtube. I think that is because of SSL certificate. If that's the case, it shouldn't work for google.com too but it does. Any idea what could be done. ? and about iptables, is there any command which can meet my needs?
â AB pacino
Jan 14 at 5:01
1
1
why not just assign a different IP subnet to the wlan interface? (and route that subnet to the rpi, of course)
â cas
Jan 13 at 7:06
why not just assign a different IP subnet to the wlan interface? (and route that subnet to the rpi, of course)
â cas
Jan 13 at 7:06
ok. I will look into assigning a different IP subnet to the wlan interface. but how to route that subnet to the rpi? newbie to the linux here :(
â AB pacino
Jan 13 at 7:11
ok. I will look into assigning a different IP subnet to the wlan interface. but how to route that subnet to the rpi? newbie to the linux here :(
â AB pacino
Jan 13 at 7:11
depends on what you're using for a router. if it's the rpi itself, you don't need to do anything else. otherwise just add a static route on your router for that IP subnet to the rpi's address. btw, you have
PRETROUTING
in your iptables command above...useful for fishing perhaps, but not routing :)â cas
Jan 13 at 7:35
depends on what you're using for a router. if it's the rpi itself, you don't need to do anything else. otherwise just add a static route on your router for that IP subnet to the rpi's address. btw, you have
PRETROUTING
in your iptables command above...useful for fishing perhaps, but not routing :)â cas
Jan 13 at 7:35
Google "transparent proxy".
â dirkt
Jan 13 at 9:28
Google "transparent proxy".
â dirkt
Jan 13 at 9:28
@cas Thanks for your reply. I am using rpi itself as the router. i added address=/#/192.168.1.2 in dnsmasq.conf for redirection and for most of the requests, it works except for facebook and youtube. I think that is because of SSL certificate. If that's the case, it shouldn't work for google.com too but it does. Any idea what could be done. ? and about iptables, is there any command which can meet my needs?
â AB pacino
Jan 14 at 5:01
@cas Thanks for your reply. I am using rpi itself as the router. i added address=/#/192.168.1.2 in dnsmasq.conf for redirection and for most of the requests, it works except for facebook and youtube. I think that is because of SSL certificate. If that's the case, it shouldn't work for google.com too but it does. Any idea what could be done. ? and about iptables, is there any command which can meet my needs?
â AB pacino
Jan 14 at 5:01
 |Â
show 4 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f416755%2fredirect-all-devices-connected-to-ap-of-rpi-to-the-ip-address-of-rpi%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
why not just assign a different IP subnet to the wlan interface? (and route that subnet to the rpi, of course)
â cas
Jan 13 at 7:06
ok. I will look into assigning a different IP subnet to the wlan interface. but how to route that subnet to the rpi? newbie to the linux here :(
â AB pacino
Jan 13 at 7:11
depends on what you're using for a router. if it's the rpi itself, you don't need to do anything else. otherwise just add a static route on your router for that IP subnet to the rpi's address. btw, you have
PRETROUTING
in your iptables command above...useful for fishing perhaps, but not routing :)â cas
Jan 13 at 7:35
Google "transparent proxy".
â dirkt
Jan 13 at 9:28
@cas Thanks for your reply. I am using rpi itself as the router. i added address=/#/192.168.1.2 in dnsmasq.conf for redirection and for most of the requests, it works except for facebook and youtube. I think that is because of SSL certificate. If that's the case, it shouldn't work for google.com too but it does. Any idea what could be done. ? and about iptables, is there any command which can meet my needs?
â AB pacino
Jan 14 at 5:01