Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-23-2013, 03:47 PM
|
#1
|
Senior Member
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,859
|
Connecting subnets with Raspberry Pi wireless access point
So, I am using a Raspberry PI Model B (256) with the latest raspbian image as a wireless bridge for an entertainment center with an ethernet port. The Pi connects to the LAN wirelessly and the eth0 port is "shared with other computers" via NetworkManager.
From ps aux | grep dnsmasq, I see that dnsmasq (apparently started by NetworkManager) provides an IP of 10.x.x.x to the entertainment center. The LAN has the usual 192.168.x.x IP space, provided via DHCP from a router.
So far so good, the entertainment center can get internet radio and connects to the internet. From the Pi, I can ping the entertainment center and anyone on the LAN.
But I cannot ping the entertainment center from anyone else on the LAN. What I would like is to drop the NAT on the Pi so that the entertainment center is visible to the entire LAN. Any ideas?
There are google results for achieving this result for various routers, but I'm not sure how to do it with the Pi/using debian and NetworkManager.
|
|
|
07-27-2013, 03:14 AM
|
#2
|
LQ Newbie
Registered: Jun 2013
Location: Worcestershire, UK
Distribution: Ubuntu,lubuntu,raspbian
Posts: 17
Rep:
|
Did you set up NAT on the Pi yourself? I don't think it's enabled by default.
|
|
|
07-27-2013, 11:02 AM
|
#3
|
Senior Member
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,859
Original Poster
|
Hey, thanks for responding!
I went to NetworkManager and enabled "shared with other computers" on eth0, which apparently starts dnsmasq. I presume that NAT is set up by default.
ps aux | grep dns gives the following:
Code:
nobody 3727 0.0 0.4 3208 780 ? S Jul20 0:00 /usr/sbin/dnsmasq --conf-file --no-hosts --keep-in-foreground --bind-interfaces --except-interface=lo --clear-on-reload --strict-order --listen-address=10.42.0.1 --dhcp-range=10.42.0.10,10.42.0.100,60m --dhcp-option=option:router,10.42.0.1 --dhcp-lease-max=50 --pid-file=/var/run/nm-dnsmasq-eth0.pid
wheras ifconfig is
Code:
eth0 Link encap:Ethernet HWaddr b8:27:eb:de:71:3a
inet addr:10.42.0.1 Bcast:10.42.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:245479 errors:0 dropped:0 overruns:0 frame:0
TX packets:245287 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:11472453 (10.9 MiB) TX bytes:336961177 (321.3 MiB)
wlan0 Link encap:Ethernet HWaddr 08:86:3b:f4:36:53
inet addr:192.168.1.19 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2519345 errors:0 dropped:2524602 overruns:0 frame:0
TX packets:394934 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:838731227 (799.8 MiB) TX bytes:49001496 (46.7 MiB)
So you see I ssh into the pi at 192.168.1.19, where I can ping everyone, including folks on 10.42.0.x and 192.168.1.x, however I can't ping 10.42.0.x from 192.168.1.199 (another computer)
I got the instructions at http://www.raspberrypi.org/phpBB3/vi...25268&p=270912
I tried setting up a bridge in the past on the pi (not on this install) but it didn't work consistently and didn't allow me to ssh in. Obviously I had something not right or my wifi adapter was incapable of bridging, so I used the suggestion above which seems to work great, except for the part where I don't know how to connect the subnets.
|
|
|
07-27-2013, 05:56 PM
|
#4
|
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290
|
You'll need to set the Pi up to be a router and configure the routing tables on your other machines to use 192.168.1.19 as their gateway to access the 10.42.0.0/24 subnet. If you Google around for Linux router or the like, the instructions are pretty easy to find (since you're not doing NAT, it will be easy -- basically just set net.ipv4.ip_forward = 1 in your sysctl variables, IIRC). Then you'll need to use the "route" command on your other machines, something like:
Code:
route add -net 10.42.0.0 netmask 255.255.255.0 gw 192.168.1.19
This assumes your other machines are running Linux. The command is slightly different under Windows as per this Microsoft documentation page. If you want to add the route permanently, there are ways to do it (they vary by distro, but you can always just put the route command in your /etc/rc.local script.
|
|
|
07-27-2013, 07:20 PM
|
#5
|
Senior Member
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,859
Original Poster
|
Well OK, I'll try again.. the problem is, there are so many different instructions of so many different eras, most using iptables or outdated and not using NetworkManager. I'm kind of a network idiot, and have tried googling and trying a dozen different "solutions" so far without success using iptables... the thing is, most instructions assume the machine will be the router for the network and handling the internet connection, but I have a router that does that job and provides DHCP already. So I was hoping someone had a simple answer to this. [/end of whining]
BTW, I did try adding the route to my main desktop, and it certainly sends the appropriate path to 192.168.1.19 when I try to ping 10.42.0.x, so I tried adding echo "1"> /proc/sys/net/ipv4/ip_forward to my pi, but that didn't help get rid of Destination Port Unreachable. I didn't think it would, as I'm not using iptables. What I'd really like to do is make the 10.42.0.x machine, which is an entertainment center, visible on the network so my iphone's (on 192.168.1.x) app which controls it can see it. So the solution can't involve changing the route on every machine, as that will be impossible on the iphone. The solution has to involve just the pi.
Last edited by mostlyharmless; 07-27-2013 at 07:21 PM.
|
|
|
08-03-2013, 12:43 PM
|
#6
|
Member
Registered: Apr 2013
Location: Arlington, WA
Distribution: Slackware
Posts: 96
Rep:
|
I don't see the need for the Pi to be in between the entertainment center and the rest of your network. Just plug your entertainment center into your switch and plug your Pi into your switch. This will solve half of your problem; the rest of your network will have access to the entertainment center since everything will be in the same broadcast domain.
The second half of the problem is to provide a wireless access point. You could use a commercial AP in bridged mode, your modem/gateway may already have wireless enabled, or you could setup your Pi to be an access point.
'"shared with other computers" via NetworkManager' is starting dnsmasq and configuring NAT. You don't want that for a bridge. The most common mistake I see when people try to setup bridging on Linux is they configure the individual interfaces (eth0, wlan0, or ???) which you should not do. If you must enter something in NetworkManager use all zeros for address/netmask for the physical interfaces (0.0.0.0/0.0.0.0). Create the bridge and include the 2 interfaces. Then configure the bridge interface (ie. br0) to get an address, either via dhcp or statically. I can't help you with the details of NetworkManager as I don't use it, but the fundamental info here should get you started in the right direction.
|
|
|
08-04-2013, 11:21 AM
|
#7
|
Senior Member
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,859
Original Poster
|
Thanks for pitching in. However, I'm not sure I explained the problem correctly. The entertainment center is nowhere near the switch, in fact, there is no switch, nor is the router (which could act as a switch) accessible by or relocatable to the entertainment center. The only reason the pi is connected to the entertainment center is to provide a connection to the network, via the only route available, wireless. I'm trying to get the pi to behave like a wireless extender; ie make an existing wireless network available to a wired connection.
I could just buy a wireless extender with a built in switch (eg an Amped wireless extender SR30000), but I have the pi already there; it should be able to do the job... and it is much cheaper.
A wireless access point, which makes a wired network available to wireless devices, is unnecessary; I have a wireless router which already covers the area sufficiently.
The bridge idea using bridge utils and br0 is a good idea; I previously followed the tutorial in LinuxPro that was published a few months ago, but it did not work (i.e. no connection) and gorked up ssh access to the pi also, making diagnosis of the problem difficult. I'm not sure why; I have tried other "simple" tutorials on bridges and none of them work as advertised... perhaps there's an incompatibility with my wireless adapter. That is why I finally used NetworkManager: it actually worked.. except that as you point out, it configures NAT, which I don't want.
If anyone has successfully used a bridge on a pi, and has a link to the instructions on how they did it, let me know. I am running raspbian with xbmc.
[EDIT: I added a static path to 10.42.0.0 to my router; so I can ping the 10.42 network; still no joy on pinging the entertainment center though.]
Last edited by mostlyharmless; 08-04-2013 at 11:25 AM.
|
|
|
08-04-2013, 07:32 PM
|
#8
|
Member
Registered: Jul 2013
Distribution: Mint KDE
Posts: 74
Rep:
|
I'm not familiar with all your hardware but if you're looking for a cheap hardware bridge check out "wireless game adapters." I boolshiat you not. My Netgear setup is via simple web interface, then you just plug into the entertainment center and it'll connect wireless to your PI or AP or whatever device is running your wireless LAN. Works great with IP printers too.
|
|
|
All times are GMT -5. The time now is 03:21 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|