IP Forward ubuntu 9.10

Diskusi tentang Ubuntu Server baik webserver, database server, samba server dan service lainnya serta jaringan menggunakan Sistem Operasi Ubuntu.
User avatar
Harizst
Posts: 27
Joined: 13 Feb 2010, 13:45
Location: Parapat, Indonesia
Contact:

IP Forward ubuntu 9.10

Postby Harizst » 16 Oct 2010, 01:23

saya sudah bisa menshare koneksi internet dengan memasukkan perintah sbb:

ifconfig eth0 192.168.1.100
ifconfig eth1 192.168.1.101
/etc/init.d/networking restart
iptables -t nat POSTROUTING -o eth1 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
/etc/init.d/networking restart

tapi setiap kali server mati/restart, harus disetting lagi seperti itu, kalo tidak koneksinya tidak bisa dishare... apa yang salah ya??
mohon bantuannya ya...
User avatar
thrvers
Posts: 4458
Joined: 01 Jan 2010, 13:28
Location: Jombang, Indonesia
Contact:

Re: IP Forward ubuntu 9.10

Postby thrvers » 16 Oct 2010, 05:24

'
kalau mau auto waktu habis restart/turn off

jangan pakai ifconfig :D
$ sudo gedit /etc/network/interfaces
Tampilkan

Code: Select all

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.1.100
    netmask 255.255.255.0

auto eth1
iface eth1 inet static
    address 192.168.1.101
    netmask 255.255.255.0

$ sudo /etc/init.d/networking restart

terus yang satunya iptable masukin startup :D
$ sudo gedit /etc/rc.local
Tampilkan

Code: Select all

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

exit 0

restart sudah bisa langsung share :D

CMIIW
User avatar
Harizst
Posts: 27
Joined: 13 Feb 2010, 13:45
Location: Parapat, Indonesia
Contact:

Re: IP Forward ubuntu 9.10

Postby Harizst » 20 Oct 2010, 17:37

nggak bisa bro... udah sy coba, tapi malah nggak bisa konek samasekali... cuma LANnya aja yg konek
sebagai info, pengaturan ip address server sy:

eth0
IP : 192.168.1.100
netmask : 255.255.255.0
gateway : 192.168.1.1
DNS : 202.152.5.36

eth1
IP : 192.168.1.101
netmask : 255.255.255.0
gateway : 192.168.1.1
DNS : 202.152.5.36

gimana solusinya yach..
User avatar
blackshirt
Posts: 2336
Joined: 02 Jan 2010, 17:00
Location: Solo dan Kebumen
Contact:

Re: IP Forward ubuntu 9.10

Postby blackshirt » 20 Oct 2010, 18:09

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

perintah tersebut memang hanya sementara, yang akan hilang "pengaruhnya" saat direboot. biar permanen, tambahkan di /etc/sysctl.conf
net.ipv4.ip_forward = 1
User avatar
thrvers
Posts: 4458
Joined: 01 Jan 2010, 13:28
Location: Jombang, Indonesia
Contact:

Re: IP Forward ubuntu 9.10

Postby thrvers » 20 Oct 2010, 18:37

'
[quote=Harizst]nggak bisa bro... udah sy coba, tapi malah nggak bisa konek samasekali... cuma LANnya aja yg konek
sebagai info, pengaturan ip address server sy:
Tampilkan
eth0
IP : 192.168.1.100
netmask : 255.255.255.0
gateway : 192.168.1.1
DNS : 202.152.5.36

eth1
IP : 192.168.1.101
netmask : 255.255.255.0
gateway : 192.168.1.1
DNS : 202.152.5.36

gimana solusinya yach..

Ada DNS juga yah :confused:
selama ini q DNS selalu gagal kalau q masukkan startup (rc.local), biasanya q masukkan manual ke /etc/resolv.conf
$ sudo su
[sudo] password for thrvers:
# echo "nameserver 202.152.5.36" > /etc/resolv.conf


------------------------------------------------------------------------------------------------------------------------------------------------
solusi lain (otomatis startup) pakai dnsmasq (thx to mastah):
  • $ sudo aptitude install dnsmasq
  • $ sudo gedit /etc/dhcp3/dhclient.conf
    hilangkan '#': prepend domain-name-servers 127.0.0.1;
  • $ sudo gedit /etc/dnsmasq.conf
    Tampilkan
    resolv-file=/etc/resolv.dnsmasq.conf
    listen-address=127.0.0.1
    dhcp-leasefile=/var/lib/misc/dnsmasq.leases
    cache-size=150
  • $ sudo gedit /etc/resolv.dnsmasq.conf
    Tampilkan
    ## DNS saja
    nameserver 202.152.5.36

    ## Speedy
    nameserver 180.131.144.144
    nameserver 180.131.145.145
    nameserver 192.168.1.1
    nameserver 202.134.0.155
    nameserver 203.130.196.155
    nameserver 125.160.4.82
    nameserver 202.134.0.61
    nameserver 203.130.196.5
    nameserver 222.124.198.150
    nameserver 222.124.249.115

    ## Google
    nameserver 8.8.8.8
    nameserver 8.8.4.4
  • $ sudo /etc/init.d/dnsmasq restart

CMIIW