HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- iptables DNAT
Operating System - Linux
1827314
Members
4814
Online
109961
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2006 12:48 AM
01-23-2006 12:48 AM
I have a multihomed linux 2.6 machine running iptables 1.2.11 which I use as my router.
There is my network configuration:
Test1 -(subnet_1)- eth0 Linux_Router_with_Nat eth2 -(subnet_2)- Cisco_Router -(subnet_3)- Test2
I wish to do DNAT on Linux Router so that any traffic arriving on the IP_from_subnet_2 are automatically redirected to the Test1.
I've added the following rule:
iptables -t nat -A PREROUTING -d -i eth2 -j DNAT --to-destination
I have a default policy of ACCEPT in my FORWARD and INPUT chains.
Now all packets from the subnet_2 are redirected to Test1.
But I have problem with subnet_3. Test1 does not receive any packets from this subnet.
"pkts" and "bytes" columns increasing in "iptables -L -n -v -t nat" output when I attempt to make connection to Test1 from Test2 but "forward" chain is empty; seems DNAT packets not getting to FORWARD chain.
Tell anyone tell me why I can not get this working from subnet_3?
Thanks in advance,
Sergejs
There is my network configuration:
Test1 -(subnet_1)- eth0 Linux_Router_with_Nat eth2 -(subnet_2)- Cisco_Router -(subnet_3)- Test2
I wish to do DNAT on Linux Router so that any traffic arriving on the IP_from_subnet_2 are automatically redirected to the Test1.
I've added the following rule:
iptables -t nat -A PREROUTING -d
I have a default policy of ACCEPT in my FORWARD and INPUT chains.
Now all packets from the subnet_2 are redirected to Test1.
But I have problem with subnet_3. Test1 does not receive any packets from this subnet.
"pkts" and "bytes" columns increasing in "iptables -L -n -v -t nat" output when I attempt to make connection to Test1 from Test2 but "forward" chain is empty; seems DNAT packets not getting to FORWARD chain.
Tell anyone tell me why I can not get this working from subnet_3?
Thanks in advance,
Sergejs
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2006 01:45 AM
01-23-2006 01:45 AM
Solution
Just checking: have you set
"sysctl net.ipv4.ip_forward" to 1? It is the master switch for all IP routing.
What's in your routing table?
Linux_Router's default gateway should be pointing towards the Cisco_Router or there should be a specific route on Linux_router to the subnet_3 through the Cisco_Router. Otherwise the rp_filter might drop the packets.
To test, set "sysctl net.ipv4.conf.all.rp_filter=0".
If you don't have the "sysctl" command, you can use "echo 1 >/proc/sys/net/ipv4/ip_forward" and "echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter".
"sysctl net.ipv4.ip_forward" to 1? It is the master switch for all IP routing.
What's in your routing table?
Linux_Router's default gateway should be pointing towards the Cisco_Router or there should be a specific route on Linux_router to the subnet_3 through the Cisco_Router. Otherwise the rp_filter might drop the packets.
To test, set "sysctl net.ipv4.conf.all.rp_filter=0".
If you don't have the "sysctl" command, you can use "echo 1 >/proc/sys/net/ipv4/ip_forward" and "echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter".
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2006 02:03 AM
01-23-2006 02:03 AM
Re: iptables DNAT
Matti,
IP forwarding is already enabled (I can forward packet from subnet_2 to subnet_1). It was not an issue.
I have added a new route to Linux router describing the way how to reach Test2 via cisco router:
# route add -net subnet_3 gw Cisco_router
and now DNAT works Ok.
Thanks a lot.
IP forwarding is already enabled (I can forward packet from subnet_2 to subnet_1). It was not an issue.
I have added a new route to Linux router describing the way how to reach Test2 via cisco router:
# route add -net subnet_3 gw Cisco_router
and now DNAT works Ok.
Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2006 02:05 AM
01-23-2006 02:05 AM
Re: iptables DNAT
.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP