iptables & port forwarding/mapping


Recommended Posts

ok this is my current setup...

this pc (windows - 192.168.0.10) connected to my linux box (192.168.0.1)

and then the linux box (192.168.1.10) connect to linksys router (192.168.1.1)

i current have a few ports forwarded in the router to the linux box and then onto this pc working fine. however, the logging feature on my router doesnt get forwarded (uses snmp). whatever iptables config i try i cant seem to get it to work :(

using the log feature in iptables i think the snmp packets from the router are only noticed on the INPUT chain and my other port forwards are on the PREROUTING chain.

is there a way to forward the snmp packets to this pc?

(sorry if its a bit confusing :))

Link to comment
Share on other sites

Question: Is there a reason you don't just connect both PCs directly to the router? Or are you doing something specific in the Linux box (like filtering or something) that you wanted to be done before traffic gets to your Windows PC?

Link to comment
Share on other sites

2 reasons, one being i dont have a cable long enough to reach the router and if i did i would have to put the cable around the room and cover it up which i can't be bothered doing. secondly, i want to learn about networking in linux

the purpose of the linksys router is for my dad's and sister's comps and for security as i dont know enough about linux & networking yet :)

Link to comment
Share on other sites

using

iptables -t nat -A PREROUTING -i eth0 -p udp --dport 162 -j LOG --log-level 0

i can get it to log the snmp packets but using:

iptables -t nat -A PREROUTING -i eth0 -p udp --dport 162 -j DNAT --to 192.168.0.10

it doesn't get forwarded :(

is there something missing/wrong?

Link to comment
Share on other sites

  • 2 weeks later...

I have a hard time memorizing alot of those commands, I made a text file with the ones i use alot and for reference, i will paste them once i get back to my house.

Link to comment
Share on other sites

thnx but i fixed my problem now, if anyone elses wants to know its because the snmp data was broadcast data which iptables wont forward and so i set my router to log to a specific ip and it all works fine now :)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.