Results 1 to 8 of 8

Thread: accessing internet by lan cable through another computer with internet connection?

  1. #1
    Join Date
    Aug 2010
    Beans
    171

    accessing internet by lan cable through another computer with internet connection?

    Computer A and Computer B. Computer A has a vpn wifi internet connection. Can computer B get internet access through computer A by a lan cable connection between computer A and computerB? If so how? If computer A has internet connection through the build in wifi card and also has an usb wifi card connected can computer B then get internet connection through computer A's usb wifi card? If so how? Thank you.
    Last edited by ubto66; December 4th, 2021 at 07:01 PM.

  2. #2
    Join Date
    Dec 2021
    Beans
    4

    Re: accessing internet by lan cable through another computer with internet connection

    First, you must have an EI/TIA 568A Ethernet crossover cable at one end and EIA/TIA 568 B at the other end.
    Then computer A must be configurated as router through the iptables packes:
    $sudo apt install iptables
    Both computer A an B must share the same network segment. For example 192.168.1.1/24 (computer A) and 192.168.1.2 (computer B).
    Then on the computer A configure at as a router:
    $sudo echo 1 > /proc/sys/net/ipv4/ip_forward
    $sudo iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

    eth1 represents the name of network interface on the computer A.

  3. #3
    Join Date
    Aug 2010
    Beans
    171

    Re: accessing internet by lan cable through another computer with internet connection

    When I have finished using computer A as a router, then how do I reverse back the settings to when computer A was not a router?

  4. #4
    Join Date
    Mar 2007
    Beans
    1,325

    Re: accessing internet by lan cable through another computer with internet connection

    Assuming Computer A is Ubuntu you don't actually need to do anything. It will work as a workstation and as a router at the same time.
    You can also do it though wifi if you wish, simply use the name of the wifi interface above. if you're using two wifi cards some additional com figuration may be required. But beware that any other wifi computer can access your internet connections as well.
    Last edited by rsteinmetz70112; December 8th, 2021 at 06:05 PM.

  5. #5
    Join Date
    Dec 2021
    Beans
    4

    Re: accessing internet by lan cable through another computer with internet connection

    $sudo echo 0 > /proc/sys/net/ipv4/ip_forward
    $sudo iptables -F

  6. #6
    Join Date
    Sep 2011
    Location
    Pennsylvania, U.S.A.
    Beans
    3,068
    Distro
    Ubuntu Development Release

    Re: accessing internet by lan cable through another computer with internet connection

    Why not get a router with VPN capability? Or add the capability via 3rd party firmware?

  7. #7
    Join Date
    Aug 2010
    Beans
    171

    Re: accessing internet by lan cable through another computer with internet connection

    Can you explain the difference between

    $sudo echo 1 > /proc/sys/net/ipv4/ip_forward
    $sudo iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
    and


    $sudo
    echo 0 > /proc/sys/net/ipv4/ip_forward
    $sudo iptables -F


  8. #8
    Join Date
    Aug 2010
    Beans
    171

    Re: accessing internet by lan cable through another computer with internet connection

    sudo echo 1 > /proc/sys/net/ipv4/ip_forward returns permission denied. It does not ask for a psswrd.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •