ก๊วนซอฟท์แวร์ </softganz> SoftGang (Gang Software)

Web &amp; Software Developer Gang.

How to Share internet connection in Ubuntu

by Little Bear @15 พ.ค. 51 20:31 ( IP : 61...6 ) | Tags : Ubuntu , Linux

My home have 3 computer. I want to share internet for all computer.

I search from internet and found Howto Share internet connection from http://ubuntuforums.org.

Following this step and it work!!!!!!

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

  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)

    My note : My ethX was eth0 and ip was 192.168.1.1

  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)

After reboot , It's work and I set Windows XP on VMware 2Beta to use this share by set DNS to my ISP.

Everything OK!!!!!

Thank for anaoum from http://ubuntuforums.org very much.

From : http://ubuntuforums.org

และมีคำแนะนำให้ใช้ firewall ชื่อ firestarter install (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...) โดย

sudo apt-get install firestarter

ที่ http://www.opentle.org บอกว่า

ไม่ต้องลงอะไรเพิ่มแค่พิมพ์ตามนี้ (แต่ต้องเป็น root ก่อน)

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

(eth0 คือขาที่ ออกเน็ต) เครื่อง ลูกก็ ตั้งให้ ip class เดียวกับ eth0 เอา ถ้าไม่อยากแจก dhcp ถ้าอยากแจกก็ ลง package dhcp ซะ

ยังไม่ได้ลองเลย ไว้มีโอกาสค่อยลองดูนะครับ

Comment #1
Rain (Not Member)
Posted @24 ก.ย. 53 17:29 ip : 195...73

Many thanks for the information. I have the same problem at home. I thought that it depends on Internet provider. They advised me to buy switcher to have Internet in all computers. I've  found some videos about it at free files SE http://www.sharedshares.com . What I didn't like is that there were so many cabels.
I'm glad I've found this post.  I'll try to follow these steps.