LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-24-2015, 01:12 PM   #1
RogueWarrior65
Member
 
Registered: Aug 2010
Posts: 48

Rep: Reputation: 0
Question Wifi-Ethernet bridge with an "off-ramp"


I'm looking for a way to configure a Linux single-board computer as both a bridge and yet still be accessible with its own IP address. Here's a rough sketch. wlan0 and eth0 are the names of the network ports on the SBC.

Wifi Router <==== [wlan0]=> Linux SBC (static IP 192.168.2.5) <=[eth0] ====> Ethernet Device (static IP 192.168.10.6)
^
|
|
|<===> Laptop (192.168.2.100)

The "Ethernet Device" might be something like an oscilloscope or an IP camera. It has a static IPv4 address and port number. The laptop needs to be able to see it using this address. Further, this device needs to talk to devices that are connected to the wifi router. And the Linux SBC need to be able to talk to this device as well, say to capture and store data & configure the ethernet device.

The Linux SBC also has a static IPv4 address and needs to be able to talk to devices connect to the wifi router.
The Laptop needs to be able to talk to the Linux SBC since this computer is doing other things like running analog-to-digital measurements.

So this is sort of a bridge but from what I've tried, using bridge-utils keeps wlan0 from being used independently.
I tried an iptables solution and the Ethernet Device can ping out but the laptop can't ping it. I used this method: http://www.glennklockwood.com/sa/rpi-wifi-bridge.php

So, is this doable? Is there something in my configuration that's set incorrectly?
 
Old 04-25-2015, 01:05 AM   #2
ttk
Senior Member
 
Registered: May 2012
Location: Sebastopol, CA
Distribution: Slackware64
Posts: 1,038
Blog Entries: 27

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
If you set up an IP alias on the device, say 192.168.2.6 on wlan0:1, then can you reach it while 192.168.2.5 on wlan0 is used for routing?
 
Old 04-25-2015, 09:07 AM   #3
RogueWarrior65
Member
 
Registered: Aug 2010
Posts: 48

Original Poster
Rep: Reputation: 0
How do you do this?

Quote:
Originally Posted by ttk View Post
If you set up an IP alias on the device, say 192.168.2.6 on wlan0:1, then can you reach it while 192.168.2.5 on wlan0 is used for routing?

FYI, the following method partially works:

sudo ifconfig eth0 up
sudo ifconfig eth0 192.168.2.1
sudo echo "1" > /proc/sys/net/ipv4/ip_forward
sudo iptables -t nat -A POSTROUTING -o wlan0 -s 192.168.2.0/24 -j MASQUERADE

It works in that the hardwired ethernet device can send traffic out (ping, browser requests, etc.) but nothing on the wifi side of the equation can see the hardwired device. So the question remains open.
 
Old 04-26-2015, 12:59 PM   #4
RogueWarrior65
Member
 
Registered: Aug 2010
Posts: 48

Original Poster
Rep: Reputation: 0
Apparently, you can re-purpose specific ports with a command like this:

iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 80 -j DNAT --to 192.168.2.3

So if you want to run a web server on the hardwired machine, this will do that.
However, this prevents traffic to port 80 from getting to the SBC machine. Plus, you still can't see 192.168.2.3 from the outside world. All this command is really doing is redirecting traffic to port 80 of 192.168.2.5 (the SBC) to port 80 of the hardwired machine.

Assuming that you can either specify a port for communicating with the hardwired machine and you don't need to use that port to talk to the SBC, this would work.
But the larger question is how you can effectively turn the SBC into a router while still being able to treat the SBC as a generic machine.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] LM13, How to setup bridge? USB wlan1 -->wireless eth1 / ad-hoc "hotspot"? / "ICS" ? Scott1265 Linux - Wireless Networking 1 05-08-2013 11:15 AM
Note about the "ethernet cable" q... what's "kernel" and what's "not" sundialsvcs Linux - Kernel 0 12-01-2012 11:45 PM
How to make my linux laptop a deticated wifi "adapter" (send all lan to wifi) Master_CAPS Linux - Laptop and Netbook 4 03-19-2012 04:17 PM
Is it possible to bridge ethernet and wifi? daishin Linux - Wireless Networking 1 10-06-2006 02:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration