[ask] Redirect domain ke IP

Diskusi tentang Ubuntu Server baik webserver, database server, samba server dan service lainnya serta jaringan menggunakan Sistem Operasi Ubuntu.
Post Reply
User avatar
ikh_one
Contact:

[ask] Redirect domain ke IP

Post 26 Jul 2012, 16:00

Allow mas bro...
mau tanya klo cara ngeredirect nama domain ke IP bagaimana ya?
saya udah coba pake iptables

iptalbes -t nat -A PREROUTING -i eth1 -d namadomain.com -p tcp --dport 80 -j DNAT --to 192.168.1.1

saya pasangnya di router


User avatar
KangPaidjo
Contact:

Post 26 Jul 2012, 21:18

coba ini boss

#!/bin/sh
internet='eth0 # Or the interface on which you see the network
source="0.0.0.0/0.0.0.0" # this will redirect everybody to that port. If you want you may specify only one IP address or an IP range.
domain="redirect.mydomain.com" # the domain/subdomain that will be redirected sourcePort="22" #the port which you'll redirect.
toDestination="192.168.0.2" #where to redirect to. destinationPort="22" # on which port to redirect.

iptables -t mangle -P PREROUTING ACCEPT $IPTABLES -t nat -A PREROUTING -p tcp -i $internet --source 0.0.0.0/0.0.0.0 -d $domain --destination-port $serverPort -j DNAT --to-destination $toDestination:$destinationPort


User avatar
semut
Contact:

Post 26 Jul 2012, 22:24

bentar2.... maksudnya meredirect DomainName ke IP, itu gimana nih..?
tuh akses domain dr lokal atau dari internet ?


User avatar
ikh_one
Contact:

Post 27 Jul 2012, 12:45

semut wrote:bentar2.... maksudnya meredirect DomainName ke IP, itu gimana nih..?
tuh akses domain dr lokal atau dari internet ?
ya mendirect domain ke IP lokal, aksesnya dari lokal aja supaya si klien klo ngebuka domain tersebut langsung di direct ke IP lokal begitu


User avatar
ikh_one
Contact:

Post 27 Jul 2012, 12:48

KangPaidjo wrote:coba ini boss

#!/bin/sh
internet='eth0 # Or the interface on which you see the network
source="0.0.0.0/0.0.0.0" # this will redirect everybody to that port. If you want you may specify only one IP address or an IP range.
domain="redirect.mydomain.com" # the domain/subdomain that will be redirected sourcePort="22" #the port which you'll redirect.
toDestination="192.168.0.2" #where to redirect to. destinationPort="22" # on which port to redirect.

iptables -t mangle -P PREROUTING ACCEPT $IPTABLES -t nat -A PREROUTING -p tcp -i $internet --source 0.0.0.0/0.0.0.0 -d $domain --destination-port $serverPort -j DNAT --to-destination $toDestination:$destinationPort
terlalu rumit masbro, saya yg simple aja


User avatar
semut
Contact:

Post 27 Jul 2012, 14:23

setahu semut, kalau ip server DNS udah di jadikan default di DNS-server maka penamaan domain lgsung bisa dipakai mas bro..
misal ip dns-server : 192.168.0.2
dipasang di client-linux di

Code: Select all

# echo "nameserver 192.168.0.2" > /etc/resolv.conf

kalau di client wind$
di dns-server

*CMIIW..


User avatar
ikh_one
Contact:

Post 27 Jul 2012, 14:46

semut wrote:setahu semut, kalau ip server DNS udah di jadikan default di DNS-server maka penamaan domain lgsung bisa dipakai mas bro..
misal ip dns-server : 192.168.0.2
dipasang di client-linux di

Code: Select all

# echo "nameserver 192.168.0.2" > /etc/resolv.conf

kalau di client wind$
di dns-server

*CMIIW..
wah sy ga maen di dns server bro semut malah ga diinstal, cuma mau redirect pake iptables aja


User avatar
blackshirt
Contact:

Post 09 Sep 2012, 07:52

bukan domain maksudnya mungkin... Hostname kali


Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests