[ask] Redirect domain ke IP

Diskusi tentang Ubuntu Server baik webserver, database server, samba server dan service lainnya serta jaringan menggunakan Sistem Operasi Ubuntu.
User avatar
ikh_one
Posts: 25
Joined: 04 Jan 2010, 06:35
Location: Jakarta, Indonesia
Contact:

[ask] Redirect domain ke IP

Postby ikh_one » 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
Posts: 8
Joined: 13 Jan 2011, 12:03
Contact:

Re: [ask] Redirect domain ke IP

Postby KangPaidjo » 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
Posts: 455
Joined: 05 Jul 2010, 19:15
Location: kendal,Indonesia
Contact:

Re: [ask] Redirect domain ke IP

Postby semut » 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
Posts: 25
Joined: 04 Jan 2010, 06:35
Location: Jakarta, Indonesia
Contact:

Re: [ask] Redirect domain ke IP

Postby ikh_one » 27 Jul 2012, 12:45

[quote=semut]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