Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7923689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:24:06+00:00 2026-06-03T17:24:06+00:00

It seems I don’t understand IPTABLES logic. I reinstalled ubuntu server 11.10 on my

  • 0

It seems I don’t understand IPTABLES logic.

I reinstalled ubuntu server 11.10 on my server and turned on forwarding (net.ipv4.ip_forward=1 in /etc/sysctl.conf). Server has two network interfaces – eth0 (ip 192.168.1.1) looks to local network and eth1 (ip 213.164.156.130) looks to internet.

There’s also another computer in local network with ip 192.168.1.2.

Then I added two simple rules to ITABLE *nat:

-A PREROUTING -i eth1 -j DNAT --to-destination 192.168.1.2
-A POSTROUTING -o eth1 -j SNAT --to-source 213.164.156.130

I thought that the first rule means forwarding every incoming packet to 192.168.1.2.

But if I run “ping google.com”, “wget google.com” from server, they successfully work. Server receives packets and doesn’t do forwarding, and I’m really stuck with this.

In case I run these commands from 192.168.1.2 they also work, that means here forwarding works.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T17:24:07+00:00Added an answer on June 3, 2026 at 5:24 pm

    These are NAT rules.

    In your first rule, address translation occurs before routing the packet. You’re changing the destination address to 192.168.1.2 and in the second rule, you’re changing the source address before routing to 213.164.156.130.

    I’m guessing you can ping & wget because your INPUT and OUTPUT chains have a default action.

    TBH, I’m confused about what you actually want to do but if you want to forward packets, you need to modify the FORWARD chain. Here’s a link for detailed and helpful information on iptables so you can understand the logic better – Ch14:_Linux_Firewalls_Using_iptables”>http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:Ch14:_Linux_Firewalls_Using_iptables.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't understand why the code isn't working, and nothing I found seems to
I don't quite understand whats happening here a=[1,2,3,4] b=[5,6,7,8] a[len(a):] = b seems to
It's a petty basic question which seems I don't fully understand, What exactly is
It seems I don't understand javascript callbacks quite as well as I thought. In
It seems I don't understand how I can get a value from a collection
It seems that I don't understand the meaning of the in keyword in JavaScript.
It seems I don't understand something simple about Protocol Buffers, but this is very
I'm trying to understand this behaviour but it seems I don't. Please see this
Using object literals for the first time and it seems I don't quite understand
It seems I still don't get generics ... I want a general function to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.