How to become gateway using a linux OS

From old notes..

Describe namran/how to become gateway here. sometime we have only one internet access but would like to have more than one device / computer/ laptop to share that same connection.

assume the one that will become gateway is a linux. kernel 2.6.* above.

enable ip forward. as root.

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

if want permanent change in /etc/sysctl.conf

and change the line that says net.ipv4.ip_forward = 0 to

net.ipv4.ip_forward = 1.


using iptables ..

export OUT=ppp0
export IN=eth0
/sbin/iptables -t nat -A POSTROUTING -o $OUT -j MASQUERADE
/sbin/iptables -A FORWARD -i $OUT -o $IN -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i $IN -o $OUT -j ACCEPT

and from the other pc.. define the gateway ip.. as in eth0 in this case.

Related Post

8 Responses

  1. Arsento says:

    I liked it. So much useful material. I read with great interest.

  2. aLe aRdHo says:

    Nice Articel, thanks for sharing 😉

  3. watches says:

    OK. Bless you on your mission. watches

  4. Suresh says:

    Thanks & All the Best.

  5. jimmy choo outlet online says:

    Your article is very nice

  6. Davein says:


  7. burberry bags says:

    ack Obama. Younger voters and liberals, too, but to a lesser extent. All are important Democratic constituencies that helped him win the White House in 2008 and whose support he’ll need to keep it next year. An analysis of Associated Press-GfK polls, includin

  8. moncler says:

    I added it to favorites and i’ll be your constant reader.


Leave a Reply

Your email address will not be published. Required fields are marked *