Sharing Internet in Ubuntu Linux


I have router linux with 2 ethernet (eth0 and eth1). eth1 connection to WAN (ISP Tabina) and eth0 to LAN. Actualy, in my computer has 3 ethernet; 1 onboard and 2 PCI, but ethernet onboard no good or not normal fuction. Then, I non active in BIOS ethernet onboard (User Intel Mainboard).

sharing

  1. Install Ubuntu Linux
  2. Setting eth0 to LAN (IP Address : 192.168.0.1, subnet Mask : 255.255.255.0, Gateway: blank) and eth1(IP Address: 192.168.168.2, Subnet Mask: 255.255.255.0, Gateway : 192.168.168.1) and than DNS 172.20.1.1 and 172.20.1.2
  3. Run command with root access cek ip_forward:
    cat /proc/sys/net/ipv4/ip_forward
    0
    echo “1”>/proc/sys/net/ipv4/ip_forward
  4. Run command with root access iptables :
    iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

For permanent edit file /etc/rc.local and delete exit 0 and write:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will “exit 0” on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
#Non Active
#exit 0
echo “1” > /proc/sys/net/ipv4/ip_forward
/sbin/iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s