Rasperry Pi as a WiFi Router, but without using Ethernet cables?












0















I have the Raspberry Pi 2, and the official WiFi dongle that comes from the makers of Pi. I'd like to mention that I'm very new to understanding technology, code, and how things work in general so I may be trying to do something that's entirely impossible.



I was wanting to set up a sort of private router on the Pi in my room nearby, but noticed that all the tutorials for setting up Pi routers are for when you're connected to the main router via eth0.
My question is: Is it possible for other devices to connect to the Pi like a router, and have all the traffic go through wlan0 to the main router and back?



I'm guessing that modifying the tutorials to apply to wlan0 could be what I'm asking, but I'm unsure if you can even have wlan0 as both an access point for other devices and the Pi's own connection to the internet at the same time. I feel like to someone with actual understanding of the topic, this may seem a very stupid question, so I apologise in advance.



Thanks










share|improve this question


















  • 1





    Are you trying to make the RasPi connect to two networks at the same time (one being the main network with the main router, the other being the private network for your other devices), or are you trying to connect all devices to the same network but make your "other devices" route their traffic through the Pi on its way to the outside world? Both are possible (though you may need to install a second WiFi adapter to your Pi for the first; I don't know how well Linux software for multiplexing a single adapter works) but they have tradeoffs. What are you actually trying to achieve here?

    – CBHacking
    Dec 30 '18 at 2:53











  • @CBHacking Sorry, let me try explain it better. The Pi's connected to my household wifi network. I want to then broadcast that connection as a seperate network from the Pi, which I know to be possible using connection to the main router via eth0 and then broadcasting through wlan0, unless I've entirely misinterpretted the tutorials I found online.

    – everways
    Dec 30 '18 at 12:08
















0















I have the Raspberry Pi 2, and the official WiFi dongle that comes from the makers of Pi. I'd like to mention that I'm very new to understanding technology, code, and how things work in general so I may be trying to do something that's entirely impossible.



I was wanting to set up a sort of private router on the Pi in my room nearby, but noticed that all the tutorials for setting up Pi routers are for when you're connected to the main router via eth0.
My question is: Is it possible for other devices to connect to the Pi like a router, and have all the traffic go through wlan0 to the main router and back?



I'm guessing that modifying the tutorials to apply to wlan0 could be what I'm asking, but I'm unsure if you can even have wlan0 as both an access point for other devices and the Pi's own connection to the internet at the same time. I feel like to someone with actual understanding of the topic, this may seem a very stupid question, so I apologise in advance.



Thanks










share|improve this question


















  • 1





    Are you trying to make the RasPi connect to two networks at the same time (one being the main network with the main router, the other being the private network for your other devices), or are you trying to connect all devices to the same network but make your "other devices" route their traffic through the Pi on its way to the outside world? Both are possible (though you may need to install a second WiFi adapter to your Pi for the first; I don't know how well Linux software for multiplexing a single adapter works) but they have tradeoffs. What are you actually trying to achieve here?

    – CBHacking
    Dec 30 '18 at 2:53











  • @CBHacking Sorry, let me try explain it better. The Pi's connected to my household wifi network. I want to then broadcast that connection as a seperate network from the Pi, which I know to be possible using connection to the main router via eth0 and then broadcasting through wlan0, unless I've entirely misinterpretted the tutorials I found online.

    – everways
    Dec 30 '18 at 12:08














0












0








0








I have the Raspberry Pi 2, and the official WiFi dongle that comes from the makers of Pi. I'd like to mention that I'm very new to understanding technology, code, and how things work in general so I may be trying to do something that's entirely impossible.



I was wanting to set up a sort of private router on the Pi in my room nearby, but noticed that all the tutorials for setting up Pi routers are for when you're connected to the main router via eth0.
My question is: Is it possible for other devices to connect to the Pi like a router, and have all the traffic go through wlan0 to the main router and back?



I'm guessing that modifying the tutorials to apply to wlan0 could be what I'm asking, but I'm unsure if you can even have wlan0 as both an access point for other devices and the Pi's own connection to the internet at the same time. I feel like to someone with actual understanding of the topic, this may seem a very stupid question, so I apologise in advance.



Thanks










share|improve this question














I have the Raspberry Pi 2, and the official WiFi dongle that comes from the makers of Pi. I'd like to mention that I'm very new to understanding technology, code, and how things work in general so I may be trying to do something that's entirely impossible.



I was wanting to set up a sort of private router on the Pi in my room nearby, but noticed that all the tutorials for setting up Pi routers are for when you're connected to the main router via eth0.
My question is: Is it possible for other devices to connect to the Pi like a router, and have all the traffic go through wlan0 to the main router and back?



I'm guessing that modifying the tutorials to apply to wlan0 could be what I'm asking, but I'm unsure if you can even have wlan0 as both an access point for other devices and the Pi's own connection to the internet at the same time. I feel like to someone with actual understanding of the topic, this may seem a very stupid question, so I apologise in advance.



Thanks







wireless-networking router raspberry-pi raspbian dhcp-server






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 29 '18 at 23:28









everwayseverways

1




1








  • 1





    Are you trying to make the RasPi connect to two networks at the same time (one being the main network with the main router, the other being the private network for your other devices), or are you trying to connect all devices to the same network but make your "other devices" route their traffic through the Pi on its way to the outside world? Both are possible (though you may need to install a second WiFi adapter to your Pi for the first; I don't know how well Linux software for multiplexing a single adapter works) but they have tradeoffs. What are you actually trying to achieve here?

    – CBHacking
    Dec 30 '18 at 2:53











  • @CBHacking Sorry, let me try explain it better. The Pi's connected to my household wifi network. I want to then broadcast that connection as a seperate network from the Pi, which I know to be possible using connection to the main router via eth0 and then broadcasting through wlan0, unless I've entirely misinterpretted the tutorials I found online.

    – everways
    Dec 30 '18 at 12:08














  • 1





    Are you trying to make the RasPi connect to two networks at the same time (one being the main network with the main router, the other being the private network for your other devices), or are you trying to connect all devices to the same network but make your "other devices" route their traffic through the Pi on its way to the outside world? Both are possible (though you may need to install a second WiFi adapter to your Pi for the first; I don't know how well Linux software for multiplexing a single adapter works) but they have tradeoffs. What are you actually trying to achieve here?

    – CBHacking
    Dec 30 '18 at 2:53











  • @CBHacking Sorry, let me try explain it better. The Pi's connected to my household wifi network. I want to then broadcast that connection as a seperate network from the Pi, which I know to be possible using connection to the main router via eth0 and then broadcasting through wlan0, unless I've entirely misinterpretted the tutorials I found online.

    – everways
    Dec 30 '18 at 12:08








1




1





Are you trying to make the RasPi connect to two networks at the same time (one being the main network with the main router, the other being the private network for your other devices), or are you trying to connect all devices to the same network but make your "other devices" route their traffic through the Pi on its way to the outside world? Both are possible (though you may need to install a second WiFi adapter to your Pi for the first; I don't know how well Linux software for multiplexing a single adapter works) but they have tradeoffs. What are you actually trying to achieve here?

– CBHacking
Dec 30 '18 at 2:53





Are you trying to make the RasPi connect to two networks at the same time (one being the main network with the main router, the other being the private network for your other devices), or are you trying to connect all devices to the same network but make your "other devices" route their traffic through the Pi on its way to the outside world? Both are possible (though you may need to install a second WiFi adapter to your Pi for the first; I don't know how well Linux software for multiplexing a single adapter works) but they have tradeoffs. What are you actually trying to achieve here?

– CBHacking
Dec 30 '18 at 2:53













@CBHacking Sorry, let me try explain it better. The Pi's connected to my household wifi network. I want to then broadcast that connection as a seperate network from the Pi, which I know to be possible using connection to the main router via eth0 and then broadcasting through wlan0, unless I've entirely misinterpretted the tutorials I found online.

– everways
Dec 30 '18 at 12:08





@CBHacking Sorry, let me try explain it better. The Pi's connected to my household wifi network. I want to then broadcast that connection as a seperate network from the Pi, which I know to be possible using connection to the main router via eth0 and then broadcasting through wlan0, unless I've entirely misinterpretted the tutorials I found online.

– everways
Dec 30 '18 at 12:08










1 Answer
1






active

oldest

votes


















0














This would infact be possible. If you strictly wanted to avoid using the physical network port, then you could have a second wireless adapater which would become wlan1.



If you think about your actual router, it has an Internet connection which is the WAN side, and internal network ports which are on the LAN side. (It may also have a wireless network card, connected to an antenna which is generally also on the LAN side.).




I'm unsure if you can even have wlan0 as both an access point for other devices and the Pi's own connection to the internet at the same time.




With two wireless adapters in the Pi, one could be the WAN side of your Pi router; the side that connects to the actual router, which in turn connects to the Internet. The other would be the LAN side; this is what your laptop or tablet connects to.





If you are able to connect the LAN cable you could still do the following with eth0 and wlan0:



The Raspberry Pi forum has a thread about two wifi adapters which should get you to the stage where you can ifconfig wlan0 && ifconfig wlan1.



One of these adapters, say wlan0, should get an IP address from the actual router. For testing the other should probably have a static IP which might connect to your laptop, also on a static IP.



To give the Pi some actual router functionality, check out the arch linux Internet Sharing Wiki. Even if you're not using arch these steps should be similar.



Another guide takes it down to a few steps:




First you need to tell your kernel that you want to allow IP forwarding.




echo 1 > /proc/sys/net/ipv4/ip_forward



Then you'll need to configure iptables to forward the packets from your internal network, on /dev/wlan1, to your external network on /dev/wlan0. You do this will the following commands:




# /sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
# /sbin/iptables -A FORWARD -i wlan0 -o wlan1 -m state
--state RELATED,ESTABLISHED -j ACCEPT
# /sbin/iptables -A FORWARD -i wlan1 -o wlan0 -j ACCEPT


You should now have full internet access from your laptop, provided the default gateway is set to the static address of wlan1.






share|improve this answer


























  • Sure, I'll try get my hands on another wireless adapter, thanks!

    – everways
    Dec 30 '18 at 12:10











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fsuperuser.com%2fquestions%2f1388852%2frasperry-pi-as-a-wifi-router-but-without-using-ethernet-cables%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














This would infact be possible. If you strictly wanted to avoid using the physical network port, then you could have a second wireless adapater which would become wlan1.



If you think about your actual router, it has an Internet connection which is the WAN side, and internal network ports which are on the LAN side. (It may also have a wireless network card, connected to an antenna which is generally also on the LAN side.).




I'm unsure if you can even have wlan0 as both an access point for other devices and the Pi's own connection to the internet at the same time.




With two wireless adapters in the Pi, one could be the WAN side of your Pi router; the side that connects to the actual router, which in turn connects to the Internet. The other would be the LAN side; this is what your laptop or tablet connects to.





If you are able to connect the LAN cable you could still do the following with eth0 and wlan0:



The Raspberry Pi forum has a thread about two wifi adapters which should get you to the stage where you can ifconfig wlan0 && ifconfig wlan1.



One of these adapters, say wlan0, should get an IP address from the actual router. For testing the other should probably have a static IP which might connect to your laptop, also on a static IP.



To give the Pi some actual router functionality, check out the arch linux Internet Sharing Wiki. Even if you're not using arch these steps should be similar.



Another guide takes it down to a few steps:




First you need to tell your kernel that you want to allow IP forwarding.




echo 1 > /proc/sys/net/ipv4/ip_forward



Then you'll need to configure iptables to forward the packets from your internal network, on /dev/wlan1, to your external network on /dev/wlan0. You do this will the following commands:




# /sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
# /sbin/iptables -A FORWARD -i wlan0 -o wlan1 -m state
--state RELATED,ESTABLISHED -j ACCEPT
# /sbin/iptables -A FORWARD -i wlan1 -o wlan0 -j ACCEPT


You should now have full internet access from your laptop, provided the default gateway is set to the static address of wlan1.






share|improve this answer


























  • Sure, I'll try get my hands on another wireless adapter, thanks!

    – everways
    Dec 30 '18 at 12:10
















0














This would infact be possible. If you strictly wanted to avoid using the physical network port, then you could have a second wireless adapater which would become wlan1.



If you think about your actual router, it has an Internet connection which is the WAN side, and internal network ports which are on the LAN side. (It may also have a wireless network card, connected to an antenna which is generally also on the LAN side.).




I'm unsure if you can even have wlan0 as both an access point for other devices and the Pi's own connection to the internet at the same time.




With two wireless adapters in the Pi, one could be the WAN side of your Pi router; the side that connects to the actual router, which in turn connects to the Internet. The other would be the LAN side; this is what your laptop or tablet connects to.





If you are able to connect the LAN cable you could still do the following with eth0 and wlan0:



The Raspberry Pi forum has a thread about two wifi adapters which should get you to the stage where you can ifconfig wlan0 && ifconfig wlan1.



One of these adapters, say wlan0, should get an IP address from the actual router. For testing the other should probably have a static IP which might connect to your laptop, also on a static IP.



To give the Pi some actual router functionality, check out the arch linux Internet Sharing Wiki. Even if you're not using arch these steps should be similar.



Another guide takes it down to a few steps:




First you need to tell your kernel that you want to allow IP forwarding.




echo 1 > /proc/sys/net/ipv4/ip_forward



Then you'll need to configure iptables to forward the packets from your internal network, on /dev/wlan1, to your external network on /dev/wlan0. You do this will the following commands:




# /sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
# /sbin/iptables -A FORWARD -i wlan0 -o wlan1 -m state
--state RELATED,ESTABLISHED -j ACCEPT
# /sbin/iptables -A FORWARD -i wlan1 -o wlan0 -j ACCEPT


You should now have full internet access from your laptop, provided the default gateway is set to the static address of wlan1.






share|improve this answer


























  • Sure, I'll try get my hands on another wireless adapter, thanks!

    – everways
    Dec 30 '18 at 12:10














0












0








0







This would infact be possible. If you strictly wanted to avoid using the physical network port, then you could have a second wireless adapater which would become wlan1.



If you think about your actual router, it has an Internet connection which is the WAN side, and internal network ports which are on the LAN side. (It may also have a wireless network card, connected to an antenna which is generally also on the LAN side.).




I'm unsure if you can even have wlan0 as both an access point for other devices and the Pi's own connection to the internet at the same time.




With two wireless adapters in the Pi, one could be the WAN side of your Pi router; the side that connects to the actual router, which in turn connects to the Internet. The other would be the LAN side; this is what your laptop or tablet connects to.





If you are able to connect the LAN cable you could still do the following with eth0 and wlan0:



The Raspberry Pi forum has a thread about two wifi adapters which should get you to the stage where you can ifconfig wlan0 && ifconfig wlan1.



One of these adapters, say wlan0, should get an IP address from the actual router. For testing the other should probably have a static IP which might connect to your laptop, also on a static IP.



To give the Pi some actual router functionality, check out the arch linux Internet Sharing Wiki. Even if you're not using arch these steps should be similar.



Another guide takes it down to a few steps:




First you need to tell your kernel that you want to allow IP forwarding.




echo 1 > /proc/sys/net/ipv4/ip_forward



Then you'll need to configure iptables to forward the packets from your internal network, on /dev/wlan1, to your external network on /dev/wlan0. You do this will the following commands:




# /sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
# /sbin/iptables -A FORWARD -i wlan0 -o wlan1 -m state
--state RELATED,ESTABLISHED -j ACCEPT
# /sbin/iptables -A FORWARD -i wlan1 -o wlan0 -j ACCEPT


You should now have full internet access from your laptop, provided the default gateway is set to the static address of wlan1.






share|improve this answer















This would infact be possible. If you strictly wanted to avoid using the physical network port, then you could have a second wireless adapater which would become wlan1.



If you think about your actual router, it has an Internet connection which is the WAN side, and internal network ports which are on the LAN side. (It may also have a wireless network card, connected to an antenna which is generally also on the LAN side.).




I'm unsure if you can even have wlan0 as both an access point for other devices and the Pi's own connection to the internet at the same time.




With two wireless adapters in the Pi, one could be the WAN side of your Pi router; the side that connects to the actual router, which in turn connects to the Internet. The other would be the LAN side; this is what your laptop or tablet connects to.





If you are able to connect the LAN cable you could still do the following with eth0 and wlan0:



The Raspberry Pi forum has a thread about two wifi adapters which should get you to the stage where you can ifconfig wlan0 && ifconfig wlan1.



One of these adapters, say wlan0, should get an IP address from the actual router. For testing the other should probably have a static IP which might connect to your laptop, also on a static IP.



To give the Pi some actual router functionality, check out the arch linux Internet Sharing Wiki. Even if you're not using arch these steps should be similar.



Another guide takes it down to a few steps:




First you need to tell your kernel that you want to allow IP forwarding.




echo 1 > /proc/sys/net/ipv4/ip_forward



Then you'll need to configure iptables to forward the packets from your internal network, on /dev/wlan1, to your external network on /dev/wlan0. You do this will the following commands:




# /sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
# /sbin/iptables -A FORWARD -i wlan0 -o wlan1 -m state
--state RELATED,ESTABLISHED -j ACCEPT
# /sbin/iptables -A FORWARD -i wlan1 -o wlan0 -j ACCEPT


You should now have full internet access from your laptop, provided the default gateway is set to the static address of wlan1.







share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 30 '18 at 3:04

























answered Dec 30 '18 at 2:55









v25v25

1562




1562













  • Sure, I'll try get my hands on another wireless adapter, thanks!

    – everways
    Dec 30 '18 at 12:10



















  • Sure, I'll try get my hands on another wireless adapter, thanks!

    – everways
    Dec 30 '18 at 12:10

















Sure, I'll try get my hands on another wireless adapter, thanks!

– everways
Dec 30 '18 at 12:10





Sure, I'll try get my hands on another wireless adapter, thanks!

– everways
Dec 30 '18 at 12:10


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • 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%2fsuperuser.com%2fquestions%2f1388852%2frasperry-pi-as-a-wifi-router-but-without-using-ethernet-cables%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

Plaza Victoria

Puebla de Zaragoza

Musa