Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have this setup to secure my Email server.
However, the incoming IP displayed was not originated from 220.127.116.11. How can I make it to display the original internet incoming address?
Appreciate any suggestions.
internet router <--> FW <---> Email Server
FW WAN - 2x.x.x.130
FW LAN- 192.168.0.4
Email Server - 192.168.0.5
At FW I have ip forwading to Email server
iptables -t nat -A PREROUTING -j DNAT -p tcp -d 2x.x.x.141 --dport 25 --to 192.168.0.5:25
iptables -t nat -A PREROUTING -j DNAT -p tcp -d 2x.x.x.141 --dport 110 --to 192.168.0.5:110
My NAT (for the rest of the local LAN PC)
iptables -t nat -P POSTROUTING DROP
iptables -t nat -A POSTROUTING -j MASQUERADE
not clear for me: what is 2x.x.x.141 address? if you want redirection you should use 2x.x.x.130
are the rules you are using legal (accepted)?
in my opinion it should be:
iptables -t nat -A PREROUTING -d 2x.x.x.130 -p tcp --dport 110 -j DNAT --to-destination=192.168.0.5
iptables -t nat -A PREROUTING -d 2x.x.x.130 -p tcp --dport 25 -j DNAT --to-destination=192.168.0.5
and what abou forwarding?
you should have (for instance) also:
iptables -A FORWARD -m state --state NEW -p tcp --dport 110 -j ACCEPT
iptables -A FORWARD -m state --state NEW -p tcp --dport 25 -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
"The packet going thru have the address of the internal IP 192.168.0.4" - which packets ? I assume the packets received by email server. It is obvious. You are doing masquerade on both "firewall ends" (i.e. eth cards).
But in fact you need only one-end masquerade:
iptables -t nat -A POSTROUTING -o ethN -j MASQUERADE
where ethN is the eth connected to the router.
BTW: if you have got the static IPs you should use
iptables -t nat -A POSTROUTING -o ethN -j SNAT --to-source=2x.x.x.130
rather than 'MASQUERADE' construction.
Besides, yeah, you're right. I do not understand you. For instance:
"This is my other IP address in the same IP block. (/28 - 16 IPs)" - but is it firewall external eth address? I can only assume that it is. You have nowhere mentioned it.
"It doesn't make any differences to have .141 or .130 as the forwarding address" - ???? If your firewall eth has .130 IP address there is no way (except case of promiscuous mode or multi-IP mode) to see packet send to .141
Regarding "the three forwarding rules". If you really do not need add any forwarding lines it means that the policy for FORWARD chain is ACCEPT.
Nice to hear that it works, although I still don't understand why you use .141 IP address...
Regarding the ACCEPT policy: usually in firewall's setting the policies at least for INPUT and FORWARD chains are set to DROP. And I don't know the situation it could not to be that.
130 is my firewall, do not want to use that.
Since I have other IP, I choose to use 141, anyway I have 14 usable
My INPUT policy is defaulted to DROP, however, not sure why my POSTROUTING cannot be defaulted to DROP. FORWARD is default to ACCEPT.
My reasoning to use forwarding is to maintain one firewall and harden one machine instead of so many other machines. I only want to open ports 22,25,80,110. The rest if I have forgotten to turn it off, I am still safe. My default firewall rules will block all of them. Otherwise, I will have to maintain and harden 14 machines.