route traffic of all connected wireless clients to one particular IP and port












-1















I've successfully set up access point on my server using wifi-ap snap



wakatana@server:~$ sudo wifi-ap.config get
debug: false
dhcp.lease-time: 12h
dhcp.range-start: 10.0.60.2
dhcp.range-stop: 10.0.60.199
disabled: false
share.disabled: false
share.network-interface: eth0
wifi.address: 10.0.60.1
wifi.channel: 6
wifi.country-code:
wifi.hostapd-driver: nl80211
wifi.interface: wlan0
wifi.interface-mode: direct
wifi.netmask: 255.255.255.0
wifi.operation-mode: g
wifi.security: wpa2
wifi.security-passphrase: passwordpassword
wifi.ssid: Ubuntu


Now I would like to route all traffic from connected clients to one particular IP_ADDRESS:PORT (at the time it is the same machine as AP runs on). It should work like if client goes e.g. to www.google.sk it will be redirected to 127.0.0.1:555



If I understand correctly there are at least two possible solutions for this but I do not know how to make it work in practice:




  1. dnsmasq + nginx - I've never did that before so it seems over complicated to me and I do not know if it wont broke my current DNS

  2. iptables - here I have basic iptables experiences but I'm lost in PREROUING, POSTROUTING, DNAT, SNAT etc.










share|improve this question

























  • Please detail what you have done until now. The question is overly broad, and denotes a lack of effort, there are many questions in our group how to intercept traffic using iptables. Please see our faq.

    – Rui F Ribeiro
    36 mins ago


















-1















I've successfully set up access point on my server using wifi-ap snap



wakatana@server:~$ sudo wifi-ap.config get
debug: false
dhcp.lease-time: 12h
dhcp.range-start: 10.0.60.2
dhcp.range-stop: 10.0.60.199
disabled: false
share.disabled: false
share.network-interface: eth0
wifi.address: 10.0.60.1
wifi.channel: 6
wifi.country-code:
wifi.hostapd-driver: nl80211
wifi.interface: wlan0
wifi.interface-mode: direct
wifi.netmask: 255.255.255.0
wifi.operation-mode: g
wifi.security: wpa2
wifi.security-passphrase: passwordpassword
wifi.ssid: Ubuntu


Now I would like to route all traffic from connected clients to one particular IP_ADDRESS:PORT (at the time it is the same machine as AP runs on). It should work like if client goes e.g. to www.google.sk it will be redirected to 127.0.0.1:555



If I understand correctly there are at least two possible solutions for this but I do not know how to make it work in practice:




  1. dnsmasq + nginx - I've never did that before so it seems over complicated to me and I do not know if it wont broke my current DNS

  2. iptables - here I have basic iptables experiences but I'm lost in PREROUING, POSTROUTING, DNAT, SNAT etc.










share|improve this question

























  • Please detail what you have done until now. The question is overly broad, and denotes a lack of effort, there are many questions in our group how to intercept traffic using iptables. Please see our faq.

    – Rui F Ribeiro
    36 mins ago
















-1












-1








-1








I've successfully set up access point on my server using wifi-ap snap



wakatana@server:~$ sudo wifi-ap.config get
debug: false
dhcp.lease-time: 12h
dhcp.range-start: 10.0.60.2
dhcp.range-stop: 10.0.60.199
disabled: false
share.disabled: false
share.network-interface: eth0
wifi.address: 10.0.60.1
wifi.channel: 6
wifi.country-code:
wifi.hostapd-driver: nl80211
wifi.interface: wlan0
wifi.interface-mode: direct
wifi.netmask: 255.255.255.0
wifi.operation-mode: g
wifi.security: wpa2
wifi.security-passphrase: passwordpassword
wifi.ssid: Ubuntu


Now I would like to route all traffic from connected clients to one particular IP_ADDRESS:PORT (at the time it is the same machine as AP runs on). It should work like if client goes e.g. to www.google.sk it will be redirected to 127.0.0.1:555



If I understand correctly there are at least two possible solutions for this but I do not know how to make it work in practice:




  1. dnsmasq + nginx - I've never did that before so it seems over complicated to me and I do not know if it wont broke my current DNS

  2. iptables - here I have basic iptables experiences but I'm lost in PREROUING, POSTROUTING, DNAT, SNAT etc.










share|improve this question
















I've successfully set up access point on my server using wifi-ap snap



wakatana@server:~$ sudo wifi-ap.config get
debug: false
dhcp.lease-time: 12h
dhcp.range-start: 10.0.60.2
dhcp.range-stop: 10.0.60.199
disabled: false
share.disabled: false
share.network-interface: eth0
wifi.address: 10.0.60.1
wifi.channel: 6
wifi.country-code:
wifi.hostapd-driver: nl80211
wifi.interface: wlan0
wifi.interface-mode: direct
wifi.netmask: 255.255.255.0
wifi.operation-mode: g
wifi.security: wpa2
wifi.security-passphrase: passwordpassword
wifi.ssid: Ubuntu


Now I would like to route all traffic from connected clients to one particular IP_ADDRESS:PORT (at the time it is the same machine as AP runs on). It should work like if client goes e.g. to www.google.sk it will be redirected to 127.0.0.1:555



If I understand correctly there are at least two possible solutions for this but I do not know how to make it work in practice:




  1. dnsmasq + nginx - I've never did that before so it seems over complicated to me and I do not know if it wont broke my current DNS

  2. iptables - here I have basic iptables experiences but I'm lost in PREROUING, POSTROUTING, DNAT, SNAT etc.







iptables wifi nginx dnsmasq snap






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 39 mins ago









Rui F Ribeiro

40.1k1479135




40.1k1479135










asked 46 mins ago









Wakan TankaWakan Tanka

375515




375515













  • Please detail what you have done until now. The question is overly broad, and denotes a lack of effort, there are many questions in our group how to intercept traffic using iptables. Please see our faq.

    – Rui F Ribeiro
    36 mins ago





















  • Please detail what you have done until now. The question is overly broad, and denotes a lack of effort, there are many questions in our group how to intercept traffic using iptables. Please see our faq.

    – Rui F Ribeiro
    36 mins ago



















Please detail what you have done until now. The question is overly broad, and denotes a lack of effort, there are many questions in our group how to intercept traffic using iptables. Please see our faq.

– Rui F Ribeiro
36 mins ago







Please detail what you have done until now. The question is overly broad, and denotes a lack of effort, there are many questions in our group how to intercept traffic using iptables. Please see our faq.

– Rui F Ribeiro
36 mins ago












0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500782%2froute-traffic-of-all-connected-wireless-clients-to-one-particular-ip-and-port%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500782%2froute-traffic-of-all-connected-wireless-clients-to-one-particular-ip-and-port%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Loup dans la culture

How to solve the problem of ntp “Unable to contact time server” from KDE?

ASUS Zenbook UX433/UX333 — Configure Touchpad-embedded numpad on Linux