Page 1 of 25 12311 ... LastLast
Results 1 to 10 of 249

Thread: Howto Share internet connection

  1. #1
    Join Date
    Jun 2005
    Location
    Australia
    Beans
    81

    Lightbulb

    Hello,

    The following will explain how to share your Internet connection:

    Note: Type all the following commands in a root terminal, DO NOT use sudo.

    1. Start by configuring the network card that interfaces to the other computers on you network:

    # ifconfig ethX ip

    where ethX is the network card and ip is your desired server ip address (Usually 192.168.0.1 is used)

    2. Then configure the NAT as follows:

    # iptables -t nat -A POSTROUTING -o ethX -j MASQUERADE

    where ethX is the network card that the Internet is coming from

    # echo 1 > /proc/sys/net/ipv4/ip_forward

    3. Install dnsmasq and ipmasq using apt-get:

    # apt-get install dnsmasq ipmasq

    4. Restart dnsmasq:

    # /etc/init.d/dnsmasq restart

    5. Reconfigure ipmasq to start after networking has been started:

    # dpkg-reconfigure ipmasq

    6. Repeat steps 1 and 2.

    7. Add the line "net.ipv4.ip_forward = 1" to /etc/sysctl.conf

    # gedit /etc/sysctl.conf

    8. Reboot. (Optional)

    I hope this helps.

    Good luck!
    Last edited by anaoum; January 30th, 2006 at 05:33 AM. Reason: update

  2. #2
    Join Date
    Nov 2005
    Location
    Finland
    Beans
    2
    Distro
    Ubuntu Breezy 5.10

    Re: Howto Share internet connection

    By following your instructions (after a long while spent at the ages-old art of trial-and-error I got as far as this:

    eth0 connects me to the Internet.
    eth2 connects me to my winxp machine.
    ping gets reply both ways and my winxp is hosting ftp server which is reachable.
    winxp firewall is disabled (just in case)

    Xp machine, however, does NOT reach Internet. Possible reason for this could be in the way I've set up the xp machine's networking. You did not give specifics as to how those should be set up, but I've tested both fixed ip and DHCP. Also, the networking adapters and cables im using are reliable... Any ideas?

    -Squirreli

    PS. I do have a slight virus problem on the XP machine's lsass.exe, but it connects to Internet just fine when there's no linux box between it and the Internet, so I don't believe that to be the trouble.

  3. #3
    Join Date
    Jun 2005
    Location
    Australia
    Beans
    81

    Re: Howto Share internet connection

    Hello,

    On your winxp machine configure it with a static ip (make it similar to the ip on your server. eg if server ip is 192.168.0.1, then make your ip 192.168.0.10). Also make sure that you set the "Default Gateway" and "Preffered DNS" to the ip on your ubuntu machine (the one that's sharing the internet connection). It should work fine after that.

    Good luck
    Last edited by anaoum; November 18th, 2005 at 10:50 PM.

  4. #4
    Join Date
    Nov 2005
    Location
    Finland
    Beans
    2
    Distro
    Ubuntu Breezy 5.10

    Re: Howto Share internet connection

    Ha! Now it works.
    Setting default gateway didn't help, but didn't do any harm either. Setting preferred DNS server did the trick... So, these XP comp tcp/ip settings made it work.
    -fixed ip:192.168.0.1 (subnet mask 255.255.255.0)
    -default gateway:192.168.0.2
    -preferred DNS server:192.168.0.2

    Paljon kiitoksia/Thank you very much

    -Squirreli

  5. #5
    Join Date
    Jun 2005
    Location
    Australia
    Beans
    81

    Re: Howto Share internet connection

    No worries. I'm glad it has helped!

  6. #6
    Join Date
    Jan 2005
    Location
    Calgary AB
    Beans
    126
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Howto Share internet connection

    I'm having some fun with this -
    set up is a PPC laptop that needs the internet from a x86 desktop (which gets the internet with ath0 , a wifi adapter, and is sharing with eth0), both running Breezy. Is it a matter of just changing Network settings?

    So far, the laptop can ping x86 when static IP and DNS is set to the x86 IP (192.168.0.2), but cant get to the internet. Also x86 cant get to the internet while eth0 is activated .
    Should I also change submasks?

    PLUS when I restart dnsmasq I get :

    Restarting DNS forwarder and DHCP server: dnsmasqstart-stop-daemon: warning: failed to kill 8006: Operation not permitted
    rm: cannot remove `/var/run/dnsmasq.pid': Permission denied
    dnsmasq: failed to bind listening socket: Permission denied
    (failed to start).

    I'm also using a crossover cable - thats right isnt it?

  7. #7
    Join Date
    Jun 2005
    Location
    Australia
    Beans
    81

    Re: Howto Share internet connection

    Hello nicholaspaul,

    Make sure that the subnet masks on your ppc are set to 255.255.255.0.

    Also make sure that the Default Gateway on the ppc is set to the ip of the x86 (192.168.0.2)

    About restarting dnsmasq, are you sure you are executing the command as root user?

  8. #8
    Join Date
    Jan 2005
    Location
    Calgary AB
    Beans
    126
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Howto Share internet connection

    Hi anaoum
    Yea... tried all that. x86 still can't get to the internet unless I deactivate eth0 even tho ath0 is the default gateway device.

    So the full story is:
    x86
    ath0:

    Static IP: 192.168.0.102
    Subnet: 255.255.255.0
    Gateway Address: 192.168.0.1 [the address of my wireless router]

    eth0:

    Static IP: 192.168.0.2
    Subnet: 255.255.255.0
    Gateway Address: 192.168.0.1

    Default Gateway Device: ath0



    PPC Laptop

    eth0:

    Static IP: 192.168.0.2
    Subnet: 255.255.255.0
    Gateway Address: 192.168.0.2
    DNS: 192.168.0.102
    Search domain: home (the name of the intranet)
    ---------------------------------------------------
    Should I change search domains on the PPC?

  9. #9
    Join Date
    Jan 2005
    Location
    Calgary AB
    Beans
    126
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Howto Share internet connection

    Quote Originally Posted by anaoum

    2. Then configure the NAT as follows:

    # iptables -t nat -A POSTROUTING -o ethX -j MASQUERADE

    where ethX is the network card that the Internet is coming from

    # echo 1 > /proc/sys/net/ipv4/ip_forward
    Oh wait a minute - should ethX be the interface that gets x86 the internet, or the one I'm sharing with?

  10. #10
    Join Date
    Nov 2004
    Location
    Purdue University, Indiana
    Beans
    816
    Distro
    Dapper Drake Testing/

    Re: Howto Share internet connection

    The Firestarter firewall can do all of this for you, by the way...

    Code:
    sudo apt-get install firestarter
    Its just a frontend to iptables.

    In its preferences, set "internet connected device" to the internet, and "local network device" to the local device. Then enable NAT and DHCP if you want...

Page 1 of 25 12311 ... LastLast

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
  •