LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-19-2016, 06:49 AM   #1
orrik
LQ Newbie
 
Registered: May 2016
Distribution: Centos
Posts: 10

Rep: Reputation: Disabled
The problem with redirecting IP address


Hello

I have two public IP addresses. For just the one of them (111.222.333.444) I registered the domain http://somedomain.org. In the settings of servers dns provider I pointed my public IP address (111.222.333.444).
I started the DNS and Web on one of the computers on the local network with the address 192.168.0.195. The DNS server running the Web as well. DNS translates names into IP addresses and vice versa.
Code:
# nslookup google.com
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
Name:   google.com
Address: 216.58.209.174
Code:
# nslookup 216.58.209.174
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
174.209.58.216.in-addr.arpa     name = bud02s21-in-f14.1e100.net.
174.209.58.216.in-addr.arpa     name = bud02s21-in-f174.1e100.net.

Authoritative answers can be found from:
209.58.216.in-addr.arpa nameserver = ns3.google.com.
209.58.216.in-addr.arpa nameserver = ns2.google.com.
209.58.216.in-addr.arpa nameserver = ns1.google.com.
209.58.216.in-addr.arpa nameserver = ns4.google.com.
ns2.google.com  internet address = 216.239.34.10
ns4.google.com  internet address = 216.239.38.10
ns1.google.com  internet address = 216.239.32.10
ns3.google.com  internet address = 216.239.36.10
Code:
# ping google.com
PING google.com (216.58.209.174) 56(84) bytes of data.
64 bytes from bud02s21-in-f174.1e100.net (216.58.209.174): icmp_seq=1 ttl=58 time=27.3 ms
64 bytes from bud02s21-in-f174.1e100.net (216.58.209.174): icmp_seq=2 ttl=58 time=27.2 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1341ms
rtt min/avg/max/mdev = 27.254/27.316/27.378/0.062 ms
Code:
# host google.com
google.com has address 216.58.209.174
google.com has IPv6 address 2a00:1450:400d:802::200e
google.com mail is handled by 20 alt1.aspmx.l.google.com.
google.com mail is handled by 40 alt3.aspmx.l.google.com.
google.com mail is handled by 10 aspmx.l.google.com.
google.com mail is handled by 50 alt4.aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.
In my router (Linux) in the firewall did redirecting 111.222.333.444 IP address 192.168.0.195.
Code:
G_NET_IP1=111.222.333.444
L_S1_IP=192.168.0.195
iptables -t nat -A PREROUTING -d $G_NET_IP1 -j DNAT --to-destination $L_S1_IP
iptables -t nat -A POSTROUTING -s $L_S1_IP  -j SNAT --to-source $G_NET_IP1
And here begins my problem ... internet on the web is seen but only after entering the IP address or http://111.222.333.444. When I type the address http://somedomain.org I have a message that the page does not exist.

It seems to me that I have kicked off a redirect in my firewall but I can not deal with it. Do any of you could point out where I made a mistake?


Regards
orrik
 
Old 07-19-2016, 09:03 AM   #2
gda
Member
 
Registered: Oct 2015
Posts: 130

Rep: Reputation: 27
It's strange... To me it sounds like only the DNS resolution is not working...
Did you check if your domain is actually resolved by your DNS provider?

Moreover as far as I understood you have set-up an additional local DNS which is different from the one resolving your domain. It is not clear to me why you need it as you are making nat using iptables.

Last edited by gda; 07-19-2016 at 09:33 AM.
 
Old 07-20-2016, 12:45 AM   #3
orrik
LQ Newbie
 
Registered: May 2016
Distribution: Centos
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by gda View Post
It's strange... To me it sounds like only the DNS resolution is not working...
Did you check if your domain is actually resolved by your DNS provider?
I think so. I've never had a problem with it. But I check it and.

Quote:
Moreover as far as I understood you have set-up an additional local DNS which is different from the one resolving your domain.
Yes. At the moment it looks like it has two functions - server and router.
At the ip address 111,222,333,444 I wanna get Wine to launch second server. When ready to replace the current server on the router and firewall.

Quote:
It is not clear to me why you need it as you are making nat using iptables.
The reason that such a solution seems to me to be the best for my intentions.
You are suggesting a different solution? What? We are happy with him I will read.

Regards
 
Old 07-20-2016, 01:29 AM   #4
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Linux is also acting as a router? or you have a physical router or firewall between your ISP?
 
Old 07-20-2016, 02:00 AM   #5
orrik
LQ Newbie
 
Registered: May 2016
Distribution: Centos
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by JJJCR View Post
Linux is also acting as a router? or you have a physical router or firewall between your ISP?
Everything is on linux. No hardware solutions
 
Old 07-20-2016, 03:27 AM   #6
gda
Member
 
Registered: Oct 2015
Posts: 130

Rep: Reputation: 27
As far as I understood from the first post in this thread your final goal is to run a web server on the private IP 192.168.0.195 and make it answering to http requests made using the name http://somedomain.org which is resolved in the public IP 111.222.333.444.

To accomplish that you should need:

1) A DNS server performing the forward and reverse resolution for the domain http://somedomain.org to IP 111.222.333.444 - this job is done by your (external) DNS provider
2) A router forwarding all the traffic from 111.222.333.444 to 192.168.0.195 (and the way back) - and this job is done by your local Linux router using the two iptable rules you reported above (by the way I would change a bit both these rules specifying also the port 80 or other ports you would like to use for http connection)

I think a second local DNS is not needed.

Moreover as http://111.222.333.444 redirects you to the right place, I suppose your firewall/router configurations are correct otherwise you wouldn't be able to contact your web server.

Just check if the forward and reverse resolution of the domain http//somedomain.org is working as expected. You could also check using for example traceroute or tcpdump where the communication stops to work.
 
Old 07-20-2016, 03:57 AM   #7
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
So basically, you are not able to ping your domain name right? The http://somedomain.org.

Did you give some time to propagate the DNS?

I think you might need to contact the hosting provider why it's not resolving the domain name.

Have you tried the whois tool on Google to check your domain name.

Quote:
http://whois.domaintools.com/<domain_name.com>
 
Old 07-20-2016, 07:09 AM   #8
orrik
LQ Newbie
 
Registered: May 2016
Distribution: Centos
Posts: 10

Original Poster
Rep: Reputation: Disabled
Hello

Thank you all for your suggestions. It is working now! GDA you were right. The case was messed up DNS provider. After the intervention it's working.
THX gda!

Regards
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Redirecting root emails to a different address anon091 Linux - Server 6 10-04-2013 09:43 AM
Web Site is Redirecting to Ip Address. sandeepreddy945 Linux - Server 4 10-10-2011 08:41 PM
ipv6 redirecting to loopback address vikasmca05 Linux - Newbie 7 05-06-2009 02:24 AM
Redirecting ip address jonnyhashem Linux - Networking 1 04-15-2008 05:40 PM
Apache redirecting to IP address di11rod Linux - Software 6 06-03-2004 06:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration