share your 3G/Internet Dial-Up connection in Local Area Network [UBUNTU]

long time no share. wkwkwkwk

untuk anak kosan, biasanya ini beguna lumayan, hemat patungan beli modem + internet paket++ nya si Three
yang murah.wkwkwkwkwk

oke, lets do it.

asumsikan kita udah punya modem dial-up yang udah nyambung ke internet.
dan kita mau share koneksi ini ke temen2 yang laen lewat lan/switch

the scheme-nya kira2 kayak begini cuy :
INTERNET—>PC1(ini si gateway/yang konek ke inet)—>PC2,PC3,PC4 dst… (klo lebih dari 2 pake switch bro)

oke, smua konek via networks,
di komputer yang mau di share inetnya :

(PC1 gateway/Server/yang konek ke internet)
ppp0 : konek ke inet
eth0 : konek ke temen2 yang mau nebeng/LAN

(PC2 teman2 yang mau nebeng)
eth0 : konek via lan ke PC gateway

di PC1 setting kayak gini :

IP : 192.168.0.1
Netmask : 255.255.255.0

setting via terminal-nya kek gini :

# ifconfing eth0 192.168.0.1 netmask 255.255.255.0

trs allowing the packets to forward
edit file di /etc/sysctl.conf
tambain kata2 berikut di paling bawah.

net.ipv4.ip_forward = 1

trs jalanin command berikut di terminal :

# sudo sysctl -w net.ipv4.ip_forward = “1”

trs install iptables lewat terminal

# sudo apt-get install iptables

trs jalanin command selanjutnya

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

trs install dnsmasq

# sudo apt-get install dnsmasq

trs jalanin service si dnsmasq

# sudo service dnsmasq start

nah ini bagian di komputer/PC para tebengers PC2,PC3 dst….

IP : 192.168.0.X (x ini bisa 2-254) tergantung kita mau share ke mana aja
Netmask : 255.255.255.0
Gateway : 192.168.0.1
DNS : 192.168.0.1

nah sekarang para tebengers pasti bisa konek ke internet.
klo abis restart/matiin trs iptablesnya ga jalan
ya tinggal jalanin lagi aja bro, ato bkin starup scriptnya.

nih untuk re-run iptables klo abis matiin trs gak jalan lagi sharenya

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

oke, sips…
nice to share, I’ll share the others info next time (if I have free time exactly)
thanks for reading

Regards
Tommy Agustianto

Advertisements
share your 3G/Internet Dial-Up connection in Local Area Network [UBUNTU]

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