S o f t G a n z.

Web & Software Developer Gang.

How to Share internet connection in Ubuntu

by Little Bear @May,15 2008 20.31 ( IP : 61...6 )

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 ซะ

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

แสดงความคิดเห็น

« 4777
หากท่านไม่ได้เป็นสมาชิก ท่านจำเป็นต้องป้อนตัวอักษรของ Anti-spam word ในช่องข้างบนให้ถูกต้อง
The content of this field is kept private and will not be shown publicly. This mail use for contact via email when someone want to contact you.
Bold Italic Underline Left Center Right Ordered List Bulleted List Horizontal Rule Page break Hyperlink Text Color :) Quote
คำแนะนำ : เนื่องจากได้มีการเปลี่ยนแปลงวิธีการขึ้นบรรทัดใหม่ ซึ่งมีรายละเอียดดังนี้
  • วิธีการขึ้นบรรทัดใหม่โดยไม่เว้นช่องว่างระหว่างบรรทัด ให้เคาะเว้นวรรค (Space bar) ที่ท้ายบรรทัดจำนวนหนึ่งครั้ง
  • วิธีการขึ้นย่อหน้าใหม่ซึ่งจะมีการเว้นช่องว่างห่างจากบรรทัดด้านบนเล็กน้อย ให้เคาะ Enter จำนวน 2 ครั้ง

Member Zone

Playing