I suddenly need a wired connection for a job starting very soon but it won’t be hooked up for quite some time. I have my neighborswifi password though. Iknow this is a longshot, but would I be able to use my laptop to change a wireless connection into a wired connection?

It’s an older desktop Mac managed by the company. My laptop is an HP omen 15 with arch Linux on it

  • user28282912@piefed.social
    link
    fedilink
    English
    arrow-up
    11
    ·
    edit-2
    14 hours ago

    Assuming that:

    • your Linux Laptop uses wlan0 for its wireless connection and your home network uses 192.168.1.x for IP space.

    On the Linux laptop:

    • as root or with sudo – enable IP forwarding and load the change with sysctl -p.

    sudo sysctl net.ipv4.ip_forward
    sudo sysctl -p

    • if you have ufw installed and running – setup a NAT masquerading rule for any hosts forwarding IPv4 traffic to it.
      add this line to /etc/ufw/before.rules file right after the “*nat” line

    :POSTROUTING ACCEPT [0:0]

    -A POSTROUTING -s 192.168.1.1/24 -o wlan0 -j MASQUERADE

    On the mac:

    • set your IP address manually to be on the same LAN as the Linux laptop, but for the gateway address… point that at the IP for the Linux Laptop.
    • FauxLiving@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      edit-2
      9 hours ago

      sudo sysctl net.ipv4.ip_forward

      sudo sysctl -p

      Those do not enable forwarding. One prints the value of forwarding and the other loads the config file.

      To set it temporarily

      sudo sysctl net.ipv4.ip_forward=1
      

      To set it permanantly, edit /etc/sysctl.conf (or add a config file to /etc/sysctl.d/). You only need to add one line that reads ‘net.ipv4.ip_forward=1’

    • pageflight@piefed.social
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      17 hours ago

      If you just run dhcpd on eth0 would that be enough? I’m assuming no based on your answer.

      • INeedMana@piefed.zip
        link
        fedilink
        English
        arrow-up
        1
        ·
        6 hours ago

        Ah, that link did not go into details, I’m sorry. Take a look here. It might look daunting but effectively it was just a few lines AFAIR

      • osaerisxero@kbin.melroy.org
        link
        fedilink
        arrow-up
        7
        ·
        17 hours ago

        No, because there wouldn’t be anything connecting the two ports together. In your scenario, all each side would be able to do would be to talk to ‘cpu’, there would be no mechanism to forward traffic upstream without iptables or something similar handling that function.

  • rouxdoo@lemmy.world
    link
    fedilink
    arrow-up
    15
    ·
    17 hours ago

    Get a cheap travel router that can use “bridge mode” to receive the wifi and pass along the connection through it’s ethernet port to your computer.

  • StrawberryPigtails@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    7
    ·
    17 hours ago

    Basically what you want is to turn the linux laptop into a router. Thats doable. I believe Ars did an article on a similar build a couple years ago.

    And here it is: https://arstechnica.com/gadgets/2016/04/the-ars-guide-to-building-a-linux-router-from-scratch/

    It’s an old build based on an almost 10 year old version of Ubuntu, but quickly glancing through it, I didn’t see anything completely out of date. Version numbers will have changed and perhaps some package names will have changed but it will give you a starting point for further research. You won’t want to cargo cult this build.

    I think the main difference is that your internet would be coming in from the wifi interface and going out the ethernet interface rather than the other way around.

  • db2@lemmy.world
    link
    fedilink
    arrow-up
    9
    arrow-down
    1
    ·
    edit-2
    17 hours ago

    Don’t do it the hard way. Get a GL.iNet GL-SFT1200 (or any but that one is inexpensive) and set it up as an extender for the neighbor WiFi. It’s a basic function of the router and the Mac shouldn’t know the difference.

  • MagnificentSteiner@lemmy.zip
    link
    fedilink
    English
    arrow-up
    5
    ·
    15 hours ago

    If you have a mobile phone you just just connect it to your laptop via USB and turn on tethering to use your mobile data.

  • Dr Jekell@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    2 hours ago

    Rather than trying to get your idea to work you would be better off getting a cheep WiFi access point as they often allow you to connect it to a wifi network and pass it through to wired devices via ethernet (bridging).

    Some Wifi routers have a setting to allow it to be used in bridge mode as well.

  • plateee@piefed.social
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    11 hours ago

    Wait, why are you doing this? Is there some network throughput requirement? Just bridging wifi to Ethernet won’t get you Ethernet speed, latency, or stability (since the back haul to the internet is WiFi).

    This feels a bit like an XY Problem.

    Edit: Wait, I’m guessing the company doesn’t allow wifi? (That seems weird, if they’re using a mandatory VPN, it shouldn’t matter how the laptop gets to the internet). Leaving this in case anyone doesn’t know about XY Problems. They’ve bitten me several times over the years.

    • sorrybookbroke@sh.itjust.worksOP
      link
      fedilink
      English
      arrow-up
      7
      ·
      edit-2
      10 hours ago

      Yup, company requirement. I’m hoping that this will make it seem like I have a wired connection when I actually don’t. Though it is a bit of an XY problem as there are other solutions like using a router in bridge mode as others have stated

      • plateee@piefed.social
        link
        fedilink
        English
        arrow-up
        3
        ·
        2 hours ago

        In that case, grab one of these: GL-iNet Opal Travel Router.

        They’re sub $40 on Amazon (in the states), will do bridging for you, and are rock solid. I’ve used one for the past three years whenever I’ve traveled to conferences/for work.