LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-04-2010, 08:08 AM   #1
jdelacruz68
LQ Newbie
 
Registered: Mar 2010
Posts: 4

Rep: Reputation: 0
linux router


I am using centos box as a router. WAN side has a public ip and lan side also using a public ip. I configured dhcp server on the LAN side and it is working perfectly, pcs on the LAN side can able to access the internet.

Problem: Considering the fact that LAN IPs is using Public IP and it is presumed that from the internet it can be able to ping IPs inside the LAN but, alas, it couldn't.

No firewall has been config!

Question: What config should be done on the box so that IPs inside the LAN can be ping from the internet?

Last edited by jdelacruz68; 03-04-2010 at 08:10 AM. Reason: spelling and grammar
 
Old 03-04-2010, 09:19 AM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
This sounds a bit fishy. When you say 'Public IP', do you mean IPs granted to you by your ISP or some other authority? If not, then you shouldn't be doing what you are doing. If you are using local IPs (192.168.x.x/16, 10.x.x.x/24, or 172.16.x.x/20), then you should not be able to do what you want. Is your problem limited to just ICMP traffic, or all traffic? What actually does happen if you try to ping one of your LAN IPs from outside the router? You and/or your ISP may need to set up DNS to permit the WAN side to find your 'LAN' hosts.

--- rod.
 
Old 03-04-2010, 05:18 PM   #3
jdelacruz68
LQ Newbie
 
Registered: Mar 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by theNbomr View Post
This sounds a bit fishy. When you say 'Public IP', do you mean IPs granted to you by your ISP or some other authority? If not, then you shouldn't be doing what you are doing. If you are using local IPs (192.168.x.x/16, 10.x.x.x/24, or 172.16.x.x/20), then you should not be able to do what you want. Is your problem limited to just ICMP traffic, or all traffic? What actually does happen if you try to ping one of your LAN IPs from outside the router? You and/or your ISP may need to set up DNS to permit the WAN side to find your 'LAN' hosts.

--- rod.

We had just applied for a public IP for our LAN side and we are granted by our ISP, that's why have both Public IPs on WAN and LAN.

SO as I said Linux is used as router and on the LAN side dhcp server is working fine using the Public IP and the all the stations on the LAN side were able to access smoothly.

Since we are using public IPs on the LAN I pressumed that it can be ping from the internet, but, it cannot. No firewall has been set on the box, so what configuration should be done on the box so that server with public ip on the LAN can be accessed fron the internet
 
Old 03-04-2010, 06:16 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
So, then the first thing to do is see if any traffic at all destined for the Public IPs reaches the WAN side of your router. Set up tcpdump on the WAN interface, and see what happens when you ping or otherwise try to access the Public IPs from the WAN. If it isn't getting at least to the router, you will have to get the ISP involved.
Post here, the output of
Code:
iptables -L
on your router (root privileges required).
You say no firewall, but there must be some routing going on if traffic is passing from the LAN to the WAN side. It might be as simple as removing some rules.

--- rod.
 
Old 03-05-2010, 12:40 AM   #5
jdelacruz68
LQ Newbie
 
Registered: Mar 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by theNbomr View Post
So, then the first thing to do is see if any traffic at all destined for the Public IPs reaches the WAN side of your router. Set up tcpdump on the WAN interface, and see what happens when you ping or otherwise try to access the Public IPs from the WAN. If it isn't getting at least to the router, you will have to get the ISP involved.
Post here, the output of
Code:
iptables -L
on your router (root privileges required).
You say no firewall, but there must be some routing going on if traffic is passing from the LAN to the WAN side. It might be as simple as removing some rules.

--- rod.
Here is my firewall:

[root@batman ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[sysops@batman ~]$ exit

I don't know how to setup tcpdump as you mention, please give procedure also.

Thanks.

John
 
Old 03-05-2010, 10:44 AM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
With those rules, it is hard to imagine that any traffic is passing through your router. Is the router actually separating the two networks, with two NICs, one attached to each network? And just to confirm - your LAN traffic is presently traversing the router and accessing WAN hosts (LAN hosts initiating connections)? If so, then you must have another parallel router, or you're inaccurate about something.
At any rate, to capture traffic on an interface you simply run, as root:
Code:
/usr/sbin/tcpdump -i eth0
Substitute eth1, eth2, etc. as appropriate for your setup. While you are monitoring the interface, get a host on the WAN to try to access one of your Public IP LAN hosts. You either will or will not see the traffic. If not, then you probably need some help from your ISP. If you do, then you will need to set up some iptables rules. Post your findings here.

Perhaps you should consider the use of a canned router package, if you are not acquainted with the nuances of assembling a router for production use. The benefits are that you get a system that should work right out of the box, and if it is a mature system, you will be leveraging the experience and expertise of many skilled developers. One such package that I have had success with in the past is Coyote Linux. The are numerous others, and a Google search should turn up more. This Wikipedia page is also a good starting point.

--- rod.

Last edited by theNbomr; 03-05-2010 at 10:57 AM.
 
Old 03-05-2010, 02:49 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
Question: What config should be done on the box so that IPs inside the LAN can be ping from the internet?

Then you'd have to allow icmp packets between the subnets/nic's.


I agree that you may be better off with a dedicated package. Look also at untangle.
 
Old 03-05-2010, 05:13 PM   #8
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Hmmm. Sorry, I misread the rules originally posted. I feel shame.
Those rules should pass all traffic between the LAN & WAN. This is probably not good, if it propagates non-public IPs onto the public net. Also, it will propagate traffic onto the LAN which needn't be there.
This explains why the LAN hosts are able to get access to the WAN. It does not explain why the LAN Public IP hosts are not reachable from outside the LAN. My present hypothesis is that the original poster's adventures with tcpdump should verify that the traffic is not reaching the router from the WAN.
For the sake of interest, would the OP please repeat the iptables dump with greater verbosity:
Code:
iptables -t filter -L -v
iptables -t mangle -L -v
iptables -t nat -L -v
If the traffic from the WAN is appearing at the router NIC, then we will want this anyway.

--- rod.
 
Old 03-06-2010, 01:41 AM   #9
jdelacruz68
LQ Newbie
 
Registered: Mar 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by theNbomr View Post
Hmmm. Sorry, I misread the rules originally posted. I feel shame.
Those rules should pass all traffic between the LAN & WAN. This is probably not good, if it propagates non-public IPs onto the public net. Also, it will propagate traffic onto the LAN which needn't be there.
This explains why the LAN hosts are able to get access to the WAN. It does not explain why the LAN Public IP hosts are not reachable from outside the LAN. My present hypothesis is that the original poster's adventures with tcpdump should verify that the traffic is not reaching the router from the WAN.
For the sake of interest, would the OP please repeat the iptables dump with greater verbosity:
Code:
iptables -t filter -L -v
iptables -t mangle -L -v
iptables -t nat -L -v
If the traffic from the WAN is appearing at the router NIC, then we will want this anyway.

--- rod.
well i think the masquerading is the cause of not having to ping public ip inside lan.

is there a config aside from masquerade in order to access the public ip's inside the lan.

john
 
Old 03-06-2010, 09:05 AM   #10
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
well i think the masquerading is the cause of not having to ping public ip inside lan.

is there a config aside from masquerade in order to access the public ip's inside the lan.
Do you see evidence that masquerading is occurring? How do you think this is a cause of problems? As I read the existing rules, masquerading should not be required, although if there are rules in the nat table, perhaps they are broken. Can you post them. Is the problem you cite restricted to ICMP, or to all traffic in general? What is the result of your tcpdump test?

--- rod.
 
  


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
Adding new Linux firewall/router on network with pre-existing gateway/router grittyminder Linux - Networking 4 08-13-2008 02:17 AM
Small Linux Router/firewall behind D-Link Hardware router dleidlein Linux - Networking 6 04-30-2007 05:12 AM
linux as router/gateway/firewall to dsl-router sjoerdvvu Linux - Networking 2 02-24-2006 10:56 PM
Linux Router & Netgear Wireless Router DMaCATO Linux - Wireless Networking 1 04-30-2004 09:16 AM
/etc/resolv.conf configuration when behind a router(not a linux router) rmanocha Linux - Networking 2 04-28-2004 01:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:10 AM.

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