element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Sci Fi Your Pi
  • Challenges & Projects
  • Design Challenges
  • Sci Fi Your Pi
  • More
  • Cancel
Sci Fi Your Pi
Blog Meditech: Creating a Pi Bridge
  • Blog
  • Forum
  • Documents
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: balearicdynamics
  • Date Created: 8 May 2015 3:58 PM Date Created
  • Views 1245 views
  • Likes 2 likes
  • Comments 6 comments
  • meditech_project
  • wifi
  • nat
  • ethernet
  • lan
  • raspberry-pi
  • networking
  • sci_fi_your_pi
  • router
  • bridge
Related
Recommended

Meditech: Creating a Pi Bridge

balearicdynamics
balearicdynamics
8 May 2015

The software solution to create a bridge in the main device, able to manage the internal network and the external WiFi connection convinced me that this was probably the best solution to deliver all the needed features:

 

  1. All the Meditech RPI can be accessible logging to the Master RPI via ssh or from the graphical desktop
  2. The internal devices can access the Master RPI device via the internal LAN sending their data to the storage database (MySQL based) via http / https and PHP
  3. The internal devices if needed can access the external network via the routed WiFi on the Master RPI
  4. Only one unit should access physically the Internet
  5. The system is open to more advanced security protocols, i.e. proxy, not implemented at the moment.
  6. Every wired Ethernet connected RPI device can act as an independent unit
  7. The Meditech unit should connect to the Internet via the Display Units acting also as a mobile access point
  8. Some new feature will be ...

 

The inspiring source for this solution after many tests and discarding other more complex and less performing variants come from an article on hackhappy.orghttp://hackhappy.org/uncategorized/how-to-use-a-raspberry-pi-to-create-a-wireless-to-wired-network-bridge/ site. Seeing in detail the procedure is almost simple and is covered by few steps:

 

1. Install the needed components

 

apt-get -y install isc-dhcp-server iptables


In this case the dhcp server is not an essential element as all the connected RPI has a static IP address but will be useful for further - possible - external units connected to the system

 

2. Set the network interfaces configuration for nat

 

This part of the script remained untouched: edit the /etc/network/interfaces

 

auto lo eth0
  iface lo inet loopback
  iface [Device] inet static
  address [IP]
  netmask [Netmask]

  auto [Device]
  iface [Device] inet dhcp
  wpa-ssid "[SSID]"
  wpa-psk "[Password]"

  up iptables-restore > /etc/iptables.ipv4.nat


Note that the second interface is set in DHCP mode; it is the wifi (usually wlan0) that will connect to the access point for the Internet connection. For a elementary security connection role the Display Unit of Meditech (aka the tablet) will be connected via tethering with the rest of the network with a fixed pre-defined AP name that will be reported as wired information in the RPI settings. This will grant that only that particual device set as a WiFi AP can connect to the rest of the network.


3. Set the DHCP configuration

 

option domain-name "[Domain]";
  option domain-name-servers 8.8.8.8, 8.8.4.4;
  subnet [Subnet] netmask [Netmask] {
  range [IP Range Start] [IP Range End];
 option routers [IP];


The only DHCP set is for the external access, while the internal ethernet settings (on eth0) will be static IP addresses


After these settings you should execute the following commands (as root, so use sudo)


echo "INTERFACES=\"eth0\"" > /etc/default/isc-dhcp-server
 service isc-dhcp-server restart
 update-rc.d isc-dhcp-server enable
 echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
 echo "1" > /proc/sys/net/ipv4/ip_forward
 iptables -t nat -A POSTROUTING -o [wlan0] -j MASQUERADE
 iptables -A FORWARD -i $wifid -o [eth0] -m state --state RELATED,ESTABLISHED -j ACCEPT
 iptables -A FORWARD -i [eth0] -o [wlan0] -j ACCEPT
 iptables-save > /etc/iptables.ipv4.nat
 /etc/init.d/networking restart


For those interested on the complete parametrised command from the original article it is in attach to this post.

 



Attachments:
w2l-install.sh.zip
  • Sign in to reply

Top Comments

  • DAB
    DAB over 10 years ago in reply to balearicdynamics +2
    You might check the RPi blog area, they might have already done what I am asking for. Mostly I just wanted to raise the issue so that in future blogs you and others take some time to explain what you are…
  • DAB
    DAB over 10 years ago +1
    Could you spend some time explaining the code inputs? A lot of us are not as knowledgeable on Linux as you are. So we could use some guidance on what you did and why. Use words like you would teach your…
  • DAB
    DAB over 10 years ago in reply to balearicdynamics +1
    Hi Enrico, I meant the commands and parameter inputs you enter. I know I have not memorized many of the Linux commands and am lost when it comes to all of the interesting little parameters you can add…
Parents
  • DAB
    DAB over 10 years ago

    Could you spend some time explaining the code inputs?

     

    A lot of us are not as knowledgeable on Linux as you are.

     

    So we could use some guidance on what you did and why.  Use words like you would teach your mother, assuming that she is not a Linux Guru. image

     

    Thanks

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 10 years ago in reply to DAB

    Hi DAB,

     

    sure I'll be happy if this can be helpful. But I will put it out of the Meditech project blog. There it is already full of - needed - technical details and information so I try to keep as much as possible only the information related to the effective project. Maybe the better way is to make a specific blog post on my personal blog that is shared with all.

     

    Please let me know what do you mean with "code input". Just to be sure. Thanks.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 10 years ago in reply to balearicdynamics

    Hi Enrico,

     

    I meant the commands and parameter inputs you enter.

    I know I have not memorized many of the Linux commands and am lost when it comes to all of  the interesting little parameters you can add to get the right output and data formats.

     

    Just take it one step at a time and let us know what your are trying to do and how each command sequence gives you what you want.

     

    I know a lot of members could really appreciate the details.

     

    Thanks

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • DAB
    DAB over 10 years ago in reply to balearicdynamics

    Hi Enrico,

     

    I meant the commands and parameter inputs you enter.

    I know I have not memorized many of the Linux commands and am lost when it comes to all of  the interesting little parameters you can add to get the right output and data formats.

     

    Just take it one step at a time and let us know what your are trying to do and how each command sequence gives you what you want.

     

    I know a lot of members could really appreciate the details.

     

    Thanks

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • balearicdynamics
    balearicdynamics over 10 years ago in reply to DAB

    Ok DAB,

     

    I think that it is the case to open a sort of thread of posts avoiding the bare obvious things that anyone can find everywhere and moving a bit on what can be a real relieft, especially with the WIndows users, against the scare of the linux things. What do you suggest it is best to post these stuff ? May blog on Element14 maybe the right place or there is some section in other blogs that maybe more useful ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 10 years ago in reply to balearicdynamics

    You might check the RPi blog area, they might have already done what I am asking for.

     

    Mostly I just wanted to raise the issue so that in future blogs you and others take some time to explain what you are doing for those of us at a lower level of experience and comprehension.

     

    Thanks

    DAB

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 10 years ago in reply to DAB

    DAB,

     

    I am used working with the Qt development forum and other platforms that it is normal to give the essential - the eventually creative part I mean - than this will be a source of new understanding opportunities: if I read something that implies something else that I don't know I go to search and document myself about this. For example I am not a guru in Linux, but when I need a specific thing I search for it.

     

    The big problem that not rarely occurs - that is the value added of some posts like the one I wrote, hopefully - is that it suggests a solution someone maybe searching for. Suppose the case I have the following problem:

     

    I should share on linux another linux machine folder.

     

    The problem is that I have no idea what direction I should follow. If I find a tutorial "how to share linux folders with samba" maybe I have no idea of what samba is, but this maybe the right choice. So I read the tutorial, avoid totally the idea to copycat the solution AND document myself on samba protocol in Linux. This second part is only question of google.com It is finding the tutorial that is important.

     

    This is the reason that it is best practice to avoid obvious knowledge when writing a tutorial. The risk is that everyone that write something of new, should rewrite an entire manual. That is not important. Then in this specific context of Raspi, Linux, Python and embedded systems I think that this is the way to follow. IMHO it is absolutely useless write boring tutorials on what is the shell, what is this and that command in Linux. I wonder that any user of this community is able to search in google, download one of the thousand of books on the bash script commands and so on.

     

    Instead a detail on the RPI blogs. I have tried to write some posts like the one about the bridge (it sounded me a bit complex to be the worth to spend some lines about this method) on the specific blog area but I was denied to post there. No idea why.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube