[Solved] Share internet from (laptop) wifi to (RaspberryPi) ethernet

Hi,
I've been attempting to share the internet from my laptop wifi connection to a raspberry pi (with arch) connected via an ethernet port.
For some reason, the Rpi doesn't connect. I've closely followed the instructions at:
https://wiki.archlinux.org/index.php/Internet_sharing
Yet the following script doesn't seem to work. The Rpi recognizes the the Ethernet connection but dhcpcd isn't dishing out an IP address. When I plug the Rpi into an ethernet port on my router it connects fine so as far as i'm understanding it should 'just work'.
#!/bin/bash
DEVICE="enp0s25"
ip link set $DEVICE down
ip link set $DEVICE up
ip addr add 192.168.123.1/24 dev $DEVICE
sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o internet0 -j MASQUERADE
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i $DEVICE -o internet0 -j ACCEPT
dhcpcd $DEVICE
Any tips for getting to the bottom of the issue?
Tom
Last edited by anthillsocial (2015-04-08 12:03:14)

Success!! I'd mistakenly thought that dhcpcd acted as both client and server so that's where I went wrong. The following script now works using dhcpd. As a reference for others, here's my setup:
#!/bin/bash
DEVICE="enp0s25"
ROUTERIP=139.96.30.1 # 192.168.123.1
ip link set $DEVICE down
ip link set $DEVICE up
ip addr add $ROUTERIP/24 dev $DEVICE # arbitrary address
sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o internet0 -j MASQUERADE
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i $DEVICE -o internet0 -j ACCEPT
#Config file: /etc/dhcpd.conf
#Database file: /var/lib/dhcp/dhcpd.leases # cat this to see if a device has been asigned a lease
#PID file: /var/run/dhcpd.pid
dhcpd $DEVICE
And /etc/dhcpd.conf contains:
option domain-name-servers 8.8.8.8, 8.8.4.4;
option subnet-mask 255.255.255.0;
option routers 139.96.30.100;
subnet 139.96.30.0 netmask 255.255.255.0 {
range 139.96.30.150 139.96.30.250;
Then to find out the IP address assigned to the Rpi, simply
cat /var/lib/dhcp/dhcpd.leases
Thanks for the help

Similar Messages

  • [Solved] Share internet from Wlan0 to other computers

    Is it possible to share internet connection from my laptop which is connected to internet through wlan0 interface (wireless) to other PCs on the LAN with my eth0 interface and lan cable?
    (Like,  Internet >> wireless Access-point >> laptop (wlan0) >> bridge to eth0 (lan card on this laptop) >> switch (through wired connection) >> other PCs)
    and where can I find how?
    Thanks
    Last edited by ottoshmidt (2012-04-23 21:26:58)

    alex_anthony wrote:
    Can also be done with networkmanager if you don't want to get your hands dirty (and if you're using it anyway).
    In summary:
    Make sure dnsmasq and iptables are installed
    Connect nm to wireless
    Connect ethernet cable between computers
    in nm-connection-editor, edit wired connection
    Under ipv4 settings, choose method, shared to other computers
    Disclaimer: This was when I was using fedora, but I have a hotspot the other way round on arch so I presume it will work.
    https://bbs.archlinux.org/viewtopic.php?id=139653
    Actually I did that one first, saw that post, but couldn't succeed and then tried https://wiki.archlinux.org/index.php/Internet_Share and succeeded. So I needed to enable ipv4  forwards and also to install iptables (which should be running as a daemon). Can't judge what was wrong in your steps for sure but at least, as I said arch wiki gives a right direction to go.
    Thanks all anyway.
    Last edited by ottoshmidt (2012-04-23 21:28:04)

  • How to share internet connection over wifi to an ethernet decive using airport express?

    Hi i have a device that it can only be connected to the internet via ethernet in a diferent room (and far) where my primary internet connection is. I have my network configured like this: cable modem >>>  connected via ethernet >>> to airport time capsule >>> connectes via wi fi >>> to airport express last generation "n" >>> connected via ethernet cable to device. The problem is that i'm not having internet conection in my ethernet connected device. Anyone know if I have to configure something in some special way or if i'm doing something wrong?
    Thanks
    Guido

    It should work fine..
    To figure this out, check if the Express is connected by wireless properly and getting an IP.. you will see that in airport utility.
    Make sure you are set to either extend or join the wireless network. The Express should then pass an IP to the "device".
    No luck start over.. reset everything to factory.
    If the TC is older model use 7.6.1 firmware.. it works much better for extend wireless.
    Use short names.. 2-20 characters no spaces and pure alphanumeric.
    Then set the Express again in extend wireless mode.
    It is pretty easy in v6 airport utility. Look at the posts from Bob Timmons on how to extend wireless.. he must have answered those question a thousand times in the last few years.
    Here is one I did. https://discussions.apple.com/message/24161378#24161378

  • How to share internet from mac to windows

    Any one helps me how to share internet from mac to windows? I have created an internet sharing on macbook, a Mac can connect to internet, but windows pc can't connect with this sharing. I don't know why?

    I am not a Windows guru. However, in XP there is a Wireless Network icon at the lower right side. Click on that, select the network you want to join, insert the password and that's it. Any issues speak to a Windows guru.

  • How to share internet from macbook pro to android phone?

    how to share internet from macbook pro to android phone?

    Sharing your Internet connection:
    http://support.apple.com/kb/PH6589
    http://www.maclife.com/article/howtos/how_wirelessly_share_internet_connection_m ac

  • Can't share Internet from Mac to AirPort Extreme via Thunderbolt Ethernet

    Hey there!
    I'm trying to essentially use a 2013 AirPort Extreme as an AP for the network. It's connected via WAN to a Mac via a Thunderbolt to Ethernet adapter.
    I'm having a hard time telling OS X (10.10)/ OS X Server that I want it to take the Internet from "iPhone USB" and share it with "Thunderbolt Ethernet". With or without OS X Server's DHCP/DNS "help". I've been experiencing issues with Internet Sharing for years on OS X, so the fact that I'm having an issue today is no surprise, I'm just hoping someone out there has a solution.
    If I go back to Internet Sharing in System Preferences, the "share Internet connection from" combo box is blank, rather than showing "iPhone USB".
    Also, I'm unsure as to whether I should be using OS X Server... I know it's not necessary for simple Internet connection sharing, but I'd like to use DHCP and DNS services with this setup at least eventually.... Obviously just getting Internet to the AirPort is first-priority.
    Any ideas?

    Hello Kevin,
    Let me try to get this straight, it seems like you want to bridge the fee-based wifi network and your home wireless network using your MB.
    I don't know if you have done the following steps already on your MB:
    1) Choose Apple > System Preferences, and then click Sharing.
    2) Select Internet Sharing.
    3) Choose a network service from the “Share your connection from” pop-up menu, AirPort in your case.
    4) Select a networking service to share your Internet connection from the “To computers using” list, ethernet in your case.
    Sorry, yes indeed it is straight from Mac Help titled "Sharing your Internet connection." and it sounds like you have done the sharing part already. You wrote about something wrong with your MB. It might be helpful to write what is wrong with your MB, AirPort Extreme, or your "other computers." Preciseness can definably help us help you.
    May you solve the problem.

  • [Solved]Share internet connection

    Hi guys
    I know the title seems kinda dumb but maybe is not as easy as it seems (or im having a brain segmentation fault).
    What i want to do is this, i have a wireless router on the living room and i just bought a PC and put it in my bedroom i alredy had a netbook and i want to have internet connection in my PC i see 3 options:
    1. buy a giant ethernet cable, and pay like 25 euros, or 2 not so big cables a put a switch in the midle and pay even more
    2. buy a wireless card for my PC, pay 15 euros and it will problably not work in linux
    3. connect my netbook to the wireless then connect PC and netbook via ethernet cable (crossover right?) and share internet connection
    I rather option number 3 (in long term i will eventually go with number 2) but i dont know how to do it.
    Alredy tried windows to windows but of course Microshit didnt put Internet Connection Share on windows 7 starter version (the one theat came up with the netbook).
    I only have Windows on the PC yet cause i want internet so i can install arch so option 3 has to be linux-to-Windows(i also want internet on windows, not because i use it that much but you never know), but then when i install arch how i will i get the packges to configure the network without internet.
    Anyway i will problably try to talk to my Network Fundaments Teacher in College next week but i wanted this working this weekend so i could install arch.
    Help me please just bought the tower and i cant do shit with it (no internet no graphics card)
    Sorry for my poor english
    Last edited by archoriano (2011-09-30 09:43:31)

    alphaniner wrote:
    There's an Internet Share topic in the wiki.
    BTW, as is often the case, your English is better than a great many native speakers.
    Well that didnt work, the problem is as soon as i do "ifconfig eth0 up" computer disconnects from wireless so i lose internet conection on laptop... WAIT A MINUTE i just entered the forum to tell you this.
    Turns out it does work, somehow wicd says im not connected to wireless but i am :?
    i dont care its working its all that matters.
    Thanks

  • Share internet from Ethernet port on Mac mini

    After moving houses, I don't have any land line with internet. I have now got mobile internet from Vodafone connected to my Mac mini. This I share over the ethernet port and feed into my Airport extreme base station (AEBS) WAN port.
    Also, my blackbook is connected to the AEBS via ethernet cable. Iphone and Ipad to be connected over WiFi.
    Mobile internet > MacMini USB > MacMini shared ethernet > AEBS > Blacbook >> iPhone & iPad.
    What is the best way to set up AEBS? To share a public internet address? As a brigde? To distribute a IP range?
    And also what IP ranges AEBS would work on as default.
    Also: the shared ethernet port on the Mini, should that be configured by DHCP or some other way. Now it says it has a self assigned IP and may not be able to connect.
    I have tried a lot, but I am not a network savy person.
    Any help and suggestions are welcome.
    Jan
    Message was edited by: Velkey-Solvberg

    After moving houses, I don't have any land line with internet. I have now got mobile internet from Vodafone connected to my Mac mini. This I share over the ethernet port and feed into my Airport extreme base station (AEBS) WAN port.
    Also, my blackbook is connected to the AEBS via ethernet cable. Iphone and Ipad to be connected over WiFi.
    Mobile internet > MacMini USB > MacMini shared ethernet > AEBS > Blacbook >> iPhone & iPad.
    What is the best way to set up AEBS? To share a public internet address? As a brigde? To distribute a IP range?
    And also what IP ranges AEBS would work on as default.
    Also: the shared ethernet port on the Mini, should that be configured by DHCP or some other way. Now it says it has a self assigned IP and may not be able to connect.
    I have tried a lot, but I am not a network savy person.
    Any help and suggestions are welcome.
    Jan
    Message was edited by: Velkey-Solvberg

  • How can I use share internet from Mac to iphone usb

    What I did is check the share internet option from Mac -> from Ethernet to iphone usb.
    It doesn't work.
    No internet connected in iphone!
    I don't want connect through wifi.
    Please help.

    Sync using iTunes: http://support.apple.com/kb/HT1386

  • Share Internet from Mac thru Ethernet to apple tv

    Since the apple tv has no browser I can't login to the secure network at a condo.  Best answer that makes sense is to use my laptop to connect thru wifi then use Ethernet to give Internet to the apple tv.  I can't find the share on the apple laptop. Does any one know where the needle in the haystack to allow the share?

    Welcome to the Apple Community.
    Sysyem Preferences > Sharing > Internet Sharing.

  • Can't access desktop Mac from Laptop Mac via Airport/Ethernet

    Hi.
    I have an iMac G5 running 10.3.9 and a MacBook Pro running 10.4.8. I have recently gotten DSL. I have a DSL MODEM connected to a Belkin Router. The router is not wireless. I bought it when I got the iMac a couple of years ago, and the iMac had no Airport card in it.
    I have connected the router to the MODEM, and the iMac (which does not have an Airport card) to the router via Ethernet. I have an Airport Express Base Station connected to the Belkin Router via Ethernet.
    My MacBook Pro connects to the router via Airport.
    I am connected to the internet with no problem.
    My first problem is that, on the laptop in Finder, I can connect to my iMac through Connect to Server with no problems. However, I cannot do the same (i.e., connect through Connect to Server) from the iMac to the laptop.
    The second problem is that I cannot use the printer connected (USB) to the iMac from the laptop. I could when the laptop was connected via Ethernet alone, but not since I introduced the Airport intot the network.
    What am I doing wrong? BTW, I don't have an extra Ethernet cable or the right USB cable to connect the printer to the DSL MODEM, so I haven't tried that yet.
    Thanks for any help you can give me.

    Make sure that the AirPort Express Base Station (AX) has "Distribute IP addresses," found on the Network tab of the AirPort Admin Utility, disabled.

  • [solved] sharing internet from windows computer with arch laptop

    Title is descriptive I think. Stuck on windows on my desktop because I did a thing and don't feel like fixing it yet
    I used ICS but the laptop couldn't access the internet and I read someplace that it only works between a windows client and host, and I couldn't find how to do it between a windows host and linux client of any sort.
    If it's relevant I'm using a regular yellow ethernet cable (forget which one that one is) and my desktop has a gigabit ethernet card.
    Last edited by kinkinkijkin (2015-01-05 01:49:54)

    If you want make your laptop as access point, then see here
    Otherwise, from the Arch side, the wiki is the best place to start from.
    Or see this topic is of your interests.
    If these are none of your intents, please explain which is the computer and OS connected to internet and which is the computer and OS wants to access the internet.
    What are the results of your trials, what steps have you done ?
    More details of your doing and targetted answers will be the result.
    Modern NICs don't need cross cable, the NIC will detect and self adjust the connection. If one of the two PS is less modern then you need a cross CAT5 cable.
    Last edited by TheSaint (2014-12-29 02:08:37)

  • Easiest Way to obtain Wireless Internet from laptop?

    I seem to be getting no responses from my last topic so i've decided to try to ask a more general question.  Ive tried netcfg, ive tried wifi-radar, i can't seem to get any of them to work, specifically because ifconfig is not on arch linux apparently.  I was just wondering if somebody new how most people install wireless internet into arch, i have been working on this for at least 5 hours with no luck.  I've tried modifying /etc/rc.conf, the wireless-wep file under /etc/network.d many times, and i just can't seem to make anything work.
    Im really just looking for someone to point out a guide to an easy way to get wireless internet or the easiest way or the most popular way that most users obtain wifi. thanks

    Hello Pharoah_Sage and welcome to the forums. This thread is not going to get you too far in solving your issue.
    Please read the forum rules here: https://wiki.archlinux.org/index.php/Forum_Etiquette
    Closing as this thread has no future. Not TGN since there are several replies of use.
    Anyone who wants to continue helping Pharoah_Sage, go here: https://bbs.archlinux.org/viewtopic.php?id=127366
    Pharoah_Sage wrote:I seem to be getting no responses from my last topic so i've decided to try to ask a more general question.
    You should have waited. Someone did reply.
    Ive tried netcfg, ive tried wifi-radar, i can't seem to get any of them to work, specifically because ifconfig is not on arch linux apparently.  I was just wondering if somebody new how most people install wireless internet into arch, i have been working on this for at least 5 hours with no luck.  I've tried modifying /etc/rc.conf, the wireless-wep file under /etc/network.d many times, and i just can't seem to make anything work.
    netcfg works fine for me. And ifconfig is available. Use the pkgfile program from pkgtools to find it.
    Im really just looking for someone to point out a guide to an easy way to get wireless internet or the easiest way or the most popular way that most users obtain wifi. thanks
    It's in the wiki.

  • Connect internet from laptop to iphone

    hey guys i like to connect internet to iphone ....i have internet connection in my laptop so v can connect internet via wifi .........first v want to setup wireless internet i mean by laptop router v can connect iphone. my question is .. how to create router on my laptop?
    my laptop is thoshiba a300 wifi inbuild
    thank u

    If you are connecting to the Internet via WiFi on your laptop, why can you not connect to the Internet via WiFi on your iPhone?
    There is no reason to connect the iPhone to the laptop or vice versa.

  • Can I share internet from a airport express via the ethernet port

    I have a older airport express that I am trying to you to share the internet with a Marantz AV receiver. I used to be able to share the internet to a PS2 a few years back.
    I was able to set up another network parallel to my normal wireless network with an older moonbase style airport extreme using WDS.
    I am unsure if this is the limitation that apple has introduced to the unit, or it is a Telstra firewall issue.
    Is it possible using a combination of Airport Etremes or expresses to share the internet to a wired unit?

    I have a new airport extreme that I use all the time. I was using the older airport express for airplay.
    The older airport extreme I just pulled down from the cupboard trying to get the AVR connected.
    Since posting I have able to use the Airport extreme to connect the AVR via the ethernet port.
    Still curious why I cannot connect using the airport express.
    Interestingly the older airport extreme pushed the new airport extreme into WDS mode. Tried to hook up the express and it did not work.

Maybe you are looking for

  • GW2012 SP3 - send to feature Office 2013

    Hello, our environment Windows 7 (64bit) and Office 2013 Home and Business (64bit) software. We cant use the send to feature at Office 2013 HB with GroupWise 2012 SP3. At the moment office shows always a MAPI failure by creating an e-mail attachment.

  • Get "Access Denied" when click open a PDF file

    Hi Friends, Get "Access Denied" when click open a PDF file linked from SharePoint 2013 page. What are the route causes any one is remove the permissions are stopped the inheritance permissions of the library. Can anyone face the same issue please hel

  • Inactive filter in the infopackage

    Hi, There is a problem with the restrictions of the objects, specifically with the filters of infopackages, in PROD. All fields are inactive in filter and i can't change any of them. Where could i find some settings to change filter to 'modifiable'?

  • App World Web Plugin Error.

    App World Web Plugin Error An error has occurred communicating with the BlackBerry App World Web plugin. Please restart your device and try again. If you have content protection enabled on your device, please disable and try again. Please help.

  • NetBeans Mobility Pack

    HIs does anyone know if 1) netBeans Mobility Pack comes bundled wit hWireless Toolkit, or I have to download it separately? 2) Can I integrate my Wireless Toolkit version 1 with netBeans Mobility Pack? 3) Can I develop midlets based on midp1.0 and cd